Skip to content

fix(runtime): own-key i18n lookups, form member reads, cookie reading - #755

Merged
JuroOravec merged 3 commits into
mainfrom
fix/browser-runtime-hardening
Nov 18, 2026
Merged

JuroOravec merged 3 commits into
mainfrom
fix/browser-runtime-hardening

Conversation

@JuroOravec

@JuroOravec JuroOravec commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

What changes

Three fixes in Citry's browser runtime. This is the first of two pull requests; the second, #756, covers applyActions redirects, csrfHeaders and the i18n configuration compare (#660).

  1. i18n lookups read own keys only (Make the browser i18n runtime look up profile names and message ids as own keys #701). The browser i18n runtime reads format profiles, number and percent parsers, message entries, the Fluent NUMBER profile, bundle directions and the artifact merge check through a new ownValue helper. A name such as constructor or __proto__ now fails with the same error code as any other unknown name (I18N_FORMAT_INVALID, I18N_PARSE_INVALID, I18N_MESSAGE_MISSING, I18N_NUMBER_INVALID, I18N_ARTIFACT_INVALID). The editableValueProps props copy in client.js leaves out a __proto__ key.
  2. Form members are read past named controls (Call form methods through callBuiltIn in every runtime listener #703). A control whose name matches a form member hides that member. Citry's runtime now reads isConnected, contains, querySelectorAll, dispatchEvent, addEventListener, removeEventListener, checkVisibility, getClientRects and focus on a component root, host element or focused element through readBuiltIn, callBuiltIn and nodeConnected. The development checks (dev_checks.js) read node members through a prototype helper, memberOf.
  3. Tighter cookie reading. Both places that read the CSRF cookie skip a cookie whose value is not valid percent-encoding and use the next cookie with the same name.

docs/design/trust_boundaries.md rows for message ids, profile names, id=/name= and form members are updated, and the two open-question rows for #701 and #703 are removed. runtime.js, events.js, dev_checks.min.js and the i18n plugin are rebuilt with node build.mjs.

Updated tests that encoded the old behavior: the .outside fallback test in citry-listeners.test.mjs now removes checkVisibility from the stand-in's prototype (the runtime reads built-in members from the prototype), and page-dom.test.mjs extracts the new readBuiltIn helper.

Checks

  • pnpm --dir packages/js/citry-client run check (vue types, tsc, biome, node --test): 370 passed, 0 failed.
  • New Node tests: i18n-own-keys.test.mjs (7), client-helpers.test.mjs (3), one cookie test in vue-events.test.mjs, one form test in dev-checks.test.mjs. Each fails against the main sources.
  • New e2e test in test_vue_named_elements_e2e.py: a form root with fields named dispatchEvent, contains, isConnected, querySelectorAll, removeEventListener, re-rendered by a server Render, plus Citry.events.send(element). It fails with the main runtime (root.contains is not a function).
  • Full e2e suite in Chromium: 609 passed, 3 skipped (benchmark file left out).
  • Python tests that read the runtime files (test_vue_dev_checks.py, test_vue_prepared.py, test_hashed_runtime.py, test_vue_runtime_coverage_secondary.py): 101 passed.
  • ruff check and ruff format --check on the changed test file: clean.

Review

An independent reviewer did a security pass (addresses and keys from the server, element id and name, translated messages), checked the advisory survey kinds (prototype keys, DOM clobbering, CSRF token leaks, crashes on bad input) and did a prose pass. It found no hole. Its findings are applied: more dev-check reads and focus restore go through the helpers, the __proto__ prop is dropped from the copy rather than kept as a key, a dev-checks test was added, and the trust row wording was narrowed.

Left out: Vue's own code still reads form members directly, so a control named addEventListener stops the Vue app that renders the form. docs/security.md ("Check form field names") already says so. The artifactsAgree own-key lookup has no test of its own.

Versioning

Bug fixes only. Nothing the 1.x promise covers changes. Needs a patch release (1.0.2).

Fixes #701
Fixes #703

🤖 Generated with Claude Code

https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED

The browser i18n runtime reads format profiles, parsers, message
entries, the NUMBER profile and bundle directions as own keys only, so
a name such as `constructor` fails like any unknown name (#701).

Citry's runtime reads form members such as `isConnected`, `contains`
and `dispatchEvent` past a control with the same name, on component
roots, host elements and the focused element, and the development
checks read node members from the prototype (#703).

Both CSRF cookie readers skip a cookie whose value has a broken `%`
escape and use the next cookie with the same name.

Fixes #701
Fixes #703

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED
JuroOravec and others added 2 commits November 18, 2026 10:39
The development checks read node members from the prototype chain so a
form field cannot stand in for them. Searching the chain on every read
made large comparisons about seven times slower. The checks now keep
each prototype's answer per member, read each element's tag once per
pairing instead of once per pair, and read a node's type once per node
when grouping text. A large comparison is again within about a third of
its earlier time, and the form protection is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED
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
JuroOravec merged commit 2304edc into main Nov 18, 2026
33 checks passed
@JuroOravec
JuroOravec deleted the fix/browser-runtime-hardening branch November 18, 2026 11:14
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.

Call form methods through callBuiltIn in every runtime listener Make the browser i18n runtime look up profile names and message ids as own keys

1 participant