fix(web): accept absolute OIDC issuer URLs in safe_redirect #43
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
psa-systems/bunyip!43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/bunyip-web-safe-redirect-allow-issuer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
safe_redirect rejected anything that didn't start with a single '/' and
defaulted to /dashboard. That broke the OIDC authorize -> login -> authorize
round-trip end-to-end: bunyip-api's /oauth2/authorize passes the full
authorize URL (https://api.a8n.systems/oauth2/authorize?...) as ?redirect=
when it bounces unauthenticated users to bunyip-web's /login, but
login_get + login_post both ran that through safe_redirect, dropped it on
the floor, and sent the user to /dashboard instead of back to authorize.
Allow absolute URLs whose origin matches Config.oidc_issuer (the BFF
already trusts this for cookie + Bearer purposes; same trust is now
extended to redirect targets). The check is an exact-origin string prefix
match so substring attacks like https://api.a8n.systems.evil.com/... still
fall back to /dashboard. Relative paths starting with '/' (but not '//')
keep their current behaviour; everything else is rejected.
Lock the behaviour with seven unit tests covering: None, relative path,
protocol-relative URL, same-origin absolute URL, foreign-origin absolute
URL, substring attack, and javascript: scheme.