Repository navigation
test: add real CSP violation assertions (#107 remainder) - #110
Merged
Merged
Conversation
PR #109 left this explicit gap: "only console-error/external-request checks exist today." Those catch a violation only incidentally, if one happens to also log to console during a normal run -- neither proves the policy is actually enforced nor verifies its exact value. - trackPageHealth() now registers a securitypolicyviolation listener via addInitScript on every page it's attached to, and assertHealthy() (now async) fails on any real violation. Every existing call site gets this for free, matching the helper's own stated design goal. - New "#107 CSP enforcement" describe block: asserts the login page's actual Content-Security-Policy header matches Keycloak's real deployed default (frame-src 'self'; frame-ancestors 'self'; object-src 'none'; confirmed live against auth.<domain>/realms/apiary/account/, not guessed -- this repo's realm fixture carries no browserSecurityHeaders override, so Keycloak's own default applies), and drives a real object-src violation (same-origin <object>, so a failure can only mean object-src, never externalRequests/CORS) to prove enforcement actually fires, not just that the header is present. Verified against the real disposable-Keycloak harness: both new tests pass; the 2 pre-existing screenshot-diff failures elsewhere in the suite (TOTP QR baseline, 200%-zoom baseline) reproduce identically on the unmodified file too -- environment font-rendering, not a regression from this change.
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #109 left this explicit gap: "only console-error/external-request checks exist today." Those catch a violation only incidentally, if one happens to also log to console during a normal run -- neither proves the policy is actually enforced nor verifies its exact value.
What
Test plan