SEC2-042: The dedicated CSP browser test overrides the real policy with a stale hand copy #984
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#984
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 on 2026-10-16 in a read-only security review of
postuloat56fc9d531, checked by a second, independent pass.Severity: Informational · Category: Configuration · Reference: CWE-1059 (Insufficient Technical Documentation); OWASP A05:2021 (Security Misconfiguration)
Location:
tests/e2e/test_csp.py:23-39(strict_cspfixture) and:56-130(the pages it visits)src/postulo/config/settings/base.py:818-851(the policy it claims to copy)Issue
The fixture says "Exactly what
config/settings/prod.pysends" and then writes its own dictionary:The real policy has
style-src 'self' 'nonce-…',base-uri 'none',worker-src,manifest-src,frame-src 'self',object-src 'none', the OIDCform-actionorigins andreport-uri. The four tests therefore run under a different policy from production, and the pages they visit do not include the two exceptions (the framed CV/letter preview with its nonce, the map page with its tile origin).The production policy is exercised elsewhere:
tests/e2e/conftest.py:336-370has an autouse fixture that runs every browser test undersettings.SECURE_CSPand fails on any reported violation, andtests/security/test_requests.py:203-204already asserts the policy carries nounsafe-inlineorunsafe-evaland no third-party origin. So the gap is the test named for the CSP, not the coverage.Impact
No exploit; a misleading test. The file is the one a reviewer reads to learn what the CSP test proves.
Fix
Delete the
strict_cspoverride (the autouse fixture already enforces the real policy), or derive it fromsettings.SECURE_CSP, and correct the docstring; optionally add/jobs/companies/map/and a preview frame to the visited pages. Done when:tests/e2e/test_csp.pyholds no directive literals and still passes.Related
#232 (closed) - introduced the test. #822 (closed) - the CSP hardening (
base-uri, reporting) that made the copy stale.