refactor(auth): replace dashboard sessions with stateless tokens and session control (#6329)
* refactor(auth): replace dashboard sessions with stateless tokens * feat(auth): harden session issuance and distributed enforcement * fix(proxy): preserve trusted proxy compatibility defaults * refactor: address dashboard auth review feedback * refactor: remove classic frontend and flatten web app
This commit is contained in:
@@ -193,3 +193,29 @@ func TestInitSessionCookieSettingsRejectsEmptyTrustedURLInList(t *testing.T) {
|
||||
|
||||
require.Error(t, InitSessionCookieSettings())
|
||||
}
|
||||
|
||||
func TestInitSessionCookieSettingsNormalizesExactOrigins(t *testing.T) {
|
||||
resetSessionCookieSettingsAfterTest(t)
|
||||
t.Setenv("SESSION_COOKIE_SECURE", "true")
|
||||
t.Setenv("SESSION_COOKIE_TRUSTED_URL", "https://EXAMPLE.com:443,https://admin.example.com:8443/")
|
||||
|
||||
require.NoError(t, InitSessionCookieSettings())
|
||||
assert.Equal(t, []string{"https://example.com", "https://admin.example.com:8443"}, SessionCookieTrustedURLs)
|
||||
}
|
||||
|
||||
func TestInitSessionCookieSettingsRejectsNonOriginURLs(t *testing.T) {
|
||||
for _, trustedURL := range []string{
|
||||
"https://*.example.com",
|
||||
"https://user@example.com",
|
||||
"https://example.com/admin",
|
||||
"https://example.com?next=admin",
|
||||
"https://example.com#admin",
|
||||
} {
|
||||
t.Run(trustedURL, func(t *testing.T) {
|
||||
resetSessionCookieSettingsAfterTest(t)
|
||||
t.Setenv("SESSION_COOKIE_SECURE", "true")
|
||||
t.Setenv("SESSION_COOKIE_TRUSTED_URL", trustedURL)
|
||||
require.Error(t, InitSessionCookieSettings())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user