Repository navigation
fix(csp): respect app 'unsafe-inline' — no nonce override (ADR-0100, #330) - #253
Merged
Merged
Conversation
… (ADR-0100, #330) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Andre van Zuydam <andrevanzuydam@gmail.com>
tina4stack
force-pushed
the
fix/csp-nonce-unsafe-inline-330
branch
from
October 23, 2026 14:26
d37b288 to
9f02d48
Compare
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.
Fixes tina4-php#330 (a regression since 3.13.143), at four-framework parity.
ADR-0088 injects a per-response nonce into
script-src/style-srcso theframework's own inline content runs under the strict default CSP. The injector
added the nonce to whatever policy it was handed — including an app's own
TINA4_CSP. Under CSP Level 2+ a browser ignores'unsafe-inline'in anydirective that also lists a nonce, so an app that deliberately allowed inline
through
'unsafe-inline'had all of it silently blocked after upgrading, with noway to turn the injection off. Invisible to
curl; only a real browser enforces it.The rule now (ADR-0100): a
script-src/style-srcdirective that already carries'unsafe-inline'— present in the policy, or derived from an'unsafe-inline'default-src— gets no nonce. The app's explicit choice wins; its inline runsand the framework's own inline rides the same allowance. The strict default policy
is unchanged and still nonced, an explicit directive without
'unsafe-inline'isstill nonced, and a policy that opts into inline on one axis only is nonced on the
other.
Verified at HEAD, no mocks (the real injector, a pure string transform): 6/6 in
all four frameworks, each mutation-proven — dropping the guard turns 4 cases red.
New contract invariant
csp-nonce-respects-unsafe-inlineinsecurityheaders_contract.json.🤖 Generated with Claude Code