Files
Charon/backend/internal/models/notification_config.go
GitHub Actions 8294d6ee49 Add QA test outputs, build scripts, and Dockerfile validation
- Created `qa-test-output-after-fix.txt` and `qa-test-output.txt` to log results of certificate page authentication tests.
- Added `build.sh` for deterministic backend builds in CI, utilizing `go list` for efficiency.
- Introduced `codeql_scan.sh` for CodeQL database creation and analysis for Go and JavaScript/TypeScript.
- Implemented `dockerfile_check.sh` to validate Dockerfiles for base image and package manager mismatches.
- Added `sourcery_precommit_wrapper.sh` to facilitate Sourcery CLI usage in pre-commit hooks.
2025-12-11 18:26:24 +00:00

40 lines
1.3 KiB
Go

package models
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
// NotificationConfig stores configuration for security notifications.
type NotificationConfig struct {
ID string `gorm:"primaryKey" json:"id"`
Enabled bool `json:"enabled"`
MinLogLevel string `json:"min_log_level"` // error, warn, info, debug
WebhookURL string `json:"webhook_url"`
NotifyWAFBlocks bool `json:"notify_waf_blocks"`
NotifyACLDenies bool `json:"notify_acl_denies"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// BeforeCreate sets the ID if not already set.
func (nc *NotificationConfig) BeforeCreate(tx *gorm.DB) error {
if nc.ID == "" {
nc.ID = uuid.New().String()
}
return nil
}
// SecurityEvent represents a security event for notification dispatch.
type SecurityEvent struct {
EventType string `json:"event_type"` // waf_block, acl_deny, etc.
Severity string `json:"severity"` // error, warn, info
Message string `json:"message"`
ClientIP string `json:"client_ip"`
Path string `json:"path"`
Timestamp time.Time `json:"timestamp"`
Metadata map[string]interface{} `json:"metadata"`
}