Repository navigation
docs(security): resolve the page nonce snippets' URLs as the browser sends them - #830
Merged
Merged
Conversation
…sends them The htmx snippet now checks the request path against the page's base URL as well as its address, and the fetch() example builds its URL from location.href and refuses redirects. Both pages say how a redirect on the site's own origin passes the header on. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017pjjQc1w8PkP2VuK3qFsKw
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.
(Opus 5.5)
Tightens the two docs snippets that send
Citry.pageNonce()in theX-Citry-Page-Nonceheader (added in #822, not yet in a package release):security.md, Nonces in fragments): htmx resolves a relative path against the page's base URL, so the snippet now checks the path's origin against bothdocument.baseURIandlocation.href, and sends no nonce when the path is not a valid URL.fetch()example (reference/browser-apis.md): builds the URL fromlocation.hrefand passesredirect: "error".Review: an independent reviewer checked both snippets in Chromium with htmx 2.0.10:
<base>tags, path forms (//,/\\,\\\\, absolute,javascript:, empty), elements namedbaseURIor with idCitry,selfRequestsOnlyon and off. All safe with the new snippets. It also swept Citry's browser code (resolveOnPage, Events and i18n fetches,csrfHeaders); nothing to change. Its redirect recommendation is folded in. Prose pass: no findings.Docs only; no package change. Lands before the citry 1.2.0 publish so the 1.2.0 docs snapshot carries it.
🤖 Generated with Claude Code
https://claude.ai/code/session_017pjjQc1w8PkP2VuK3qFsKw