PST-017: Single sign-on, login, logout and sign-up accept a next address with an http scheme on an https instance #746
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#746
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Found in the security audit of 2026-10-10 (
SECURITY-AUDIT-2026-10-10.md), run againstmainatc30851bfrom 8 to 10 October 2026, as PST-017. Severity: Low.The text below is the audit's entry, unchanged apart from links to the other issues it names. The finding was produced by automated review and checked by a second automated pass; re-check it before acting on it.
third-party: allauth/account/adapter.py(643-676)Who can do it, and what they need. Anyone who can hand a victim a link to the instance's sign-in page. Only meaningful where HSTS does not apply: an instance reached over a mesh VPN or plain HTTP with POSTULO_SSL_REDIRECT off, or a first visit before HSTS is cached.
How it works.
https://postulo.example/accounts/login/?next=http://postulo.example/settings/.nextwithurl_has_allowed_host_and_scheme(url, allowed_hosts=...)WITHOUTrequire_https, so the http:// form of the same host passes.Impact. Scheme downgrade for the same host; a network attacker on the path could read the session cookie on instances configured without secure cookies. Postulo's own
safe_nextpassesrequire_https=request.is_secure()and refuses this; the allauth paths do not. Confirmed by scratch test:GET /accounts/login/?next=http://testserver/downgraded/over HTTPS answered302 http://testserver/downgraded/.Evidence.
Verification (verdict: confirmed; severity after verification: Low). Keep it low, and treat it mainly as a gap against the project's own stated invariant ('drops from https to http' is refused; every
nextgoes through safe_next) and against Django's and Postulo's own admin-login behaviour. The auditor's stated impact overreaches in two ways. (a) The cookie is not exposed under default production settings: Secure cookies are not sent on the http hop, HSTS is on, and SECURE_SSL_REDIRECT bounces the hop to https. (b) The 'cookie travels in clear' case needs an HTTPS-served instance with Secure cookies turned off, no HSTS yet cached and a network attacker, and that attacker could strip the first visit anyway. It is a same-host scheme downgrade only; a foreign host is correctly refused. Precise location: the weakness is the missing is_safe_url override in src/postulo/accounts/adapter.py (AccountAdapter), not in a Postulo edit of allauth; SignInView is at src/postulo/accounts/views.py:629, which is accurate. Suggested fix: override AccountAdapter.is_safe_url to call super() and then also refuse an http:// target when context.request.is_secure() (or reimplement with require_https=request.is_secure()). …Suggested remediation. Override
AccountAdapter.is_safe_urlinpostulo.accounts.adapterto call the parent and additionally require https whenrequest.is_secure()(or delegate topostulo.core.redirects.safe_next's rule), so everynexton the instance obeys one rule.Fixed in
de37c4720on main.