Repository navigation
Carry a host's CSP nonce on every inline block of the browser page - #141
Merged
Merged
Conversation
A host with a nonce-based policy (script-src 'self' 'nonce-...') hands its nonce to Vite. The loader, the frame style, the stylesheet, the module and dev-server scripts now carry it, and a csp-nonce meta tag gives it to the styles React Aria injects. Without a host nonce the package's nonce mode supplies core's, as before.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
A fresh dependency resolution minifies one default parameter differently (i=void 0 becomes i); no source changed. The committed-build check compares against exactly this.
The page chunks import ./inertia-app.js with no query, and the layout loaded the entry with ?v=, so the browser held two copies of the module and two Inertia contexts: every page threw 'usePage must be used within the Inertia component' and the browser showed no icons.
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.
Summary
The browser page now runs under a host's nonce-based Content-Security-Policy, which ichava.com needs before it can serve the browser at
/ichava/icons.script-src 'self' 'nonce-…'/style-src 'self' 'nonce-…'hands its nonce to Vite (Vite::useCspNonce()). The page now puts it on the loader's<style>and<script>, the frame<style>, the stylesheet, the module scripts and the dev-server scripts, and writes<meta name="csp-nonce">for the styles React Aria injects at runtime. Before, those blocks had no nonce and ichava.com's policy blocked them.nonceCSP mode supplies core's nonce, as before; with neither, the page writes no nonce.Support\PageNonceresolves which, andPrepaintuses it.HostCspNonceTestrenders/ichava/iconswith a host nonce and checks every non-JSON<style>/<script>and the meta tag (proved red against the old view);PrepaintTestgains the host-wins and no-nonce cases.docs/tools/host-integration.mdgains a Content Security Policy section.The bundle loads nothing from another origin (its external URLs are documentation links), so
'self', the nonce andimg-src 'self' data:cover it.Verification
Local:
vendor/bin/pest(411 passed),phpstan --debug --memory-limit=2G(no errors),laranail-pint --test(passed).