Skip to content

Commit f8dc6f0

Browse files
committed
docs(auth): correct stale SESSION_IP_BINDING comments
The 'wired but not yet consulted' struct comments became false when validation started honoring the mode; document the fail-closed default for managers built without config.Load, and note in .env.example that log mode persists the (parse-validated) new IP as the session binding.
1 parent 3c2837c commit f8dc6f0

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

deploy/.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ SSO_SECRET=
1818

1919
# How a session presented from a different client IP than it was created from
2020
# is handled (default: log). One of: log, strict, off.
21-
# log - record the mismatch and serve the request anyway
21+
# log - record the mismatch, serve the request, and remember the new IP
22+
# as the session's binding (a parseable IP only; garbage is never
23+
# persisted)
2224
# strict - reject the session, forcing re-authentication
2325
# off - do not compare client IPs at all
2426
# SESSION_IP_BINDING=log

internal/auth/portal_session.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ type PortalSessionManager struct {
5858
cookieManager
5959
db database.Database
6060
// ipBinding is the resolved SESSION_IP_BINDING mode (config.SessionIPBinding*)
61-
// that portal session validation applies to a client-IP change. Wired but
62-
// not yet consulted; ValidatePortalSession still behaves as before.
61+
// that portal session validation applies to a client-IP change. An unknown
62+
// or zero value is treated as strict so managers built without config.Load
63+
// fail closed.
6364
ipBinding string
6465
}
6566

internal/auth/session.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ type SessionManager struct {
5555
opaqueKey []byte
5656
sessionValidation *sessionValidator
5757
// ipBinding is the resolved SESSION_IP_BINDING mode (config.SessionIPBinding*)
58-
// that session validation applies to a client-IP change. Wired but not yet
59-
// consulted; validation still behaves as before.
58+
// that session validation applies to a client-IP change. An unknown or
59+
// zero value is treated as strict so managers built without config.Load
60+
// fail closed.
6061
ipBinding string
6162
}
6263

0 commit comments

Comments
 (0)