Skip to content

fix(runtime): applyActions rejects a refused redirect; i18n config compared by content - #756

Merged
JuroOravec merged 1 commit into
mainfrom
fix/browser-runtime-actions-i18n-config
Nov 18, 2026
Merged

JuroOravec merged 1 commit into
mainfrom
fix/browser-runtime-actions-i18n-config

Conversation

@JuroOravec

Copy link
Copy Markdown
Member

What changes

Three fixes in Citry's browser runtime. This is the second of two pull requests; the first, #755, covers i18n own-key lookups (#701), form member reads (#703) and cookie reading. The two touch the same generated files, so whichever merges second needs a rebase and node build.mjs in packages/js/citry-client.

  1. The i18n configuration is compared by content (An Events revision of a region containing <c-i18n c-client> fails on a config key-order mismatch #660). An Events Render of a region with <c-i18n c-client> sends the project's i18n configuration again, and the server may list formats and parsers in another order. configureManifest used to compare JSON.stringify output, so the call failed with "an i18n fragment uses a different project configuration". It now compares formats with sameJsonContent (object keys as a set, array order kept), parsers by locale, and locales as a set. The artifact merge check (artifactsAgree) uses the same compare.
  2. Citry.events.applyActions() rejects when a redirect is refused. navigateToRedirect now throws on a refused URL (a scheme other than http:/https:, a non-string, or a URL that leaves the page's origin), so the Promise rejects with that error and the actions after it do not run. Before, it logged and resolved. A redirect marked wait: false still only logs, since it does not hold up the call. A sent event call whose result holds such a redirect now fails and fires citry:events:error; the server already refuses those redirects, so only the experimental on_event_result hook can produce one.
  3. csrfHeaders reads only a string or URL. The browser plugin host's csrfHeaders(url) gives {} for any other value. Before, String(request) on a Request read as a path on the page's own origin.

Docs: events/actions.md and the applyActions section of reference/browser-apis.md describe the rejection; docs/design/security_csrf.md and the Redirect(url=) row in docs/design/trust_boundaries.md are updated. runtime.js, events.js and the i18n plugin are rebuilt.

Updated tests that encoded the old behavior: redirect-scheme.test.mjs collected the refusal message from console.error; it now collects it from the rejection.

Checks

  • pnpm --dir packages/js/citry-client run check: 364 passed, 0 failed.
  • New Node tests: i18n-configuration-order.test.mjs (3; the reordered-configuration case fails against the main sources), csrf-headers.test.mjs (1), and two redirect tests (rejection; wait: false logs).
  • New e2e test test_i18n_events_render_e2e.py: two Renders of a <c-i18n c-client> region with several format profiles. It fails with the main i18n plugin with the An Events revision of a region containing <c-i18n c-client> fails on a config key-order mismatch #660 error and passes now.
  • Full e2e suite in Chromium: 609 passed, 3 skipped (benchmark file left out).
  • Python tests that read the runtime files: 148 passed. ruff check on the new test: clean.

Review

An independent reviewer did a security pass (navigation, addresses and keys from the server, translated messages), checked the advisory survey kinds (open redirect, URL schemes, CSRF token leaks, prototype keys) and did a prose pass. It found no hole: no refused URL can navigate, and sameJsonContent tells arrays and objects apart and compares __proto__ keys as data. Its findings are applied: the wait: false case is documented and tested, and security_csrf.md describes the new csrfHeaders rule.

Versioning

  • An Events revision of a region containing <c-i18n c-client> fails on a config key-order mismatch #660 and csrfHeaders: bug fixes. host.csrfHeaders is on the experimental browser plugin host and no user docs page teaches it.
  • applyActions: maintainer decision. The docs said "the browser logs an error and stays on the page". The page still stays, but the Promise now rejects and later actions do not run, which changes a covered browser API. I treated it as a bug fix (a Promise that resolves when its action failed), so it fits a patch release (1.0.2). Under a strict reading it is a behavior change that wants a minor release or an "Upgrading" note.

Fixes #660

🤖 Generated with Claude Code

https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED

…mpared by content

An Events Render of a region with `<c-i18n c-client>` compared the
project's i18n configuration by `JSON.stringify` output, so a different
key order failed the call. Formats are now compared by content, parsers
by locale and locales as a set (#660).

`navigateToRedirect` throws on a refused URL, so
`Citry.events.applyActions()` rejects and later actions do not run. A
redirect marked `wait: false` is still only logged.

The browser plugin host's `csrfHeaders(url)` reads only a string or a
`URL` and gives `{}` for any other value.

Fixes #660

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED
@JuroOravec
JuroOravec merged commit 0f7f679 into main Nov 18, 2026
34 checks passed
@JuroOravec
JuroOravec deleted the fix/browser-runtime-actions-i18n-config branch November 18, 2026 09:55
JuroOravec added a commit that referenced this pull request Nov 18, 2026
Keeps both PRs' browser runtime changes: own-key reads (ownValue)
from this branch and key-order-insensitive config comparison
(sameJsonContent) from #756. Generated runtime files rebuilt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED
JuroOravec added a commit that referenced this pull request Nov 18, 2026
)

* docs(security): add review records for #754, #755, #756, #757 and #759

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED

* docs(security): apply review findings to the 1.0.2 hardening records

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An Events revision of a region containing <c-i18n c-client> fails on a config key-order mismatch

1 participant