feat: add security header profile assignment to proxy hosts

Implement complete workflow for assigning security header profiles
to proxy hosts via dropdown selector in ProxyHostForm.

Backend Changes:
- Add security_header_profile_id handling to proxy host update endpoint
- Add SecurityHeaderProfile preloading in service layer
- Add 5 comprehensive tests for profile CRUD operations

Frontend Changes:
- Add Security Headers section to ProxyHostForm with dropdown
- Group profiles: System Profiles (presets) vs Custom Profiles
- Remove confusing "Apply" button from SecurityHeaders page
- Rename section to "System Profiles (Read-Only)" for clarity
- Show security score inline when profile selected

UX Improvements:
- Clear workflow: Select profile → Assign to host → Caddy applies
- No more confusion about what "Apply" does
- Discoverable security header assignment
- Visual distinction between presets and custom profiles

Tests: Backend 85.6%, Frontend 87.21% coverage
Docs: Updated workflows in docs/features.md
This commit is contained in:
GitHub Actions
2025-12-18 15:56:47 +00:00
parent c039ef10cf
commit 555ab5e669
11 changed files with 878 additions and 97 deletions

View File

@@ -60,10 +60,11 @@ func TestConnect_WALMode(t *testing.T) {
// Phase 2: database.go coverage tests
func TestConnect_InvalidDSN(t *testing.T) {
// Test with completely invalid DSN
_, err := Connect("")
// Test with a directory path instead of a file path
// SQLite cannot open a directory as a database file
tmpDir := t.TempDir()
_, err := Connect(tmpDir)
assert.Error(t, err)
assert.Contains(t, err.Error(), "open database")
}
func TestConnect_IntegrityCheckCorrupted(t *testing.T) {