- Added SecurityConfig model to manage Cerberus settings including admin whitelist and break-glass token. - Introduced SecurityService for handling security configurations and token generation. - Updated Manager to check for admin whitelist before applying configurations to prevent accidental lockouts. - Enhanced frontend with hooks and API calls for managing security settings and generating break-glass tokens. - Updated documentation to include self-lockout protection measures and best practices for using Cerberus.
26 lines
683 B
Go
26 lines
683 B
Go
package caddy
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/Wikid82/charon/backend/internal/models"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestBuildACLHandler_GeoBlacklist(t *testing.T) {
|
|
acl := &models.AccessList{Type: "geo_blacklist", CountryCodes: "GB,FR", Enabled: true}
|
|
h, err := buildACLHandler(acl, "")
|
|
require.NoError(t, err)
|
|
require.NotNil(t, h)
|
|
b, _ := json.Marshal(h)
|
|
require.Contains(t, string(b), "Access denied: Geographic restriction")
|
|
}
|
|
|
|
func TestBuildACLHandler_UnknownTypeReturnsNil(t *testing.T) {
|
|
acl := &models.AccessList{Type: "unknown_type", Enabled: true}
|
|
h, err := buildACLHandler(acl, "")
|
|
require.NoError(t, err)
|
|
require.Nil(t, h)
|
|
}
|