Repository navigation
fix(events): refuse standard DOM event names in Dispatch and in the browser - #867
Merged
Merged
Conversation
…rowser actions.Dispatch now raises ValueError for a standard DOM event name such as click or submit, in any ASCII letter case, and for a name starting with vue: or vnode- (citry: was already refused). The browser runtime refuses the same names before it fires the CustomEvent, on every path. Its list is a copy of DOM_EVENT_NAMES that scripts/generate_html_attribute_values.py writes into _vue/client.js, and a test checks the two match. Closes #704 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add legacy, prefixed and Window/Document event names that browsers still fire (webkitAnimationEnd, search, mousewheel, the mutation events, and others) to DOM_EVENT_NAMES, require the common ones in the generator, state letter-case folding and the fix in both error messages, add an end-to-end test for the mounted-component path in the browser, and bring the docs, the spec row and the writing guide's quoted message in line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sult The end-to-end test now sends an action list aimed at the mounted component with an untargeted standard name after it, which reaches the Events bridge's page-wide dispatch. Also refuse Chromium's installresult and tidy the wording the reviewer flagged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 24, 2026
JuroOravec
added a commit
that referenced
this pull request
Nov 24, 2026
* build: refresh the HTML attribute tables from the live standards Run scripts/generate_html_attribute_values.py with network access so every table and the module header's generation date match the current sources. The only table change is the HTML Standard's new `switch` attribute of `input`, a boolean attribute. DOM_EVENT_NAMES is unchanged: the 44 names added in #867 live in SUPPLEMENTAL_EVENT_NAMES in the script, and a full run keeps all 175. Add tests for `switch` and for the script's hand-added event names, and document the script's copy of the event names in client.js. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * docs(changelog): note the new switch findings in citry check Both rules that read the new `switch` entry are errors by default, so a template with `switch="false"` or a typo of `switch` now fails `citry check`. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
JuroOravec
added a commit
that referenced
this pull request
Nov 24, 2026
#871 (#878) Records the Mechanism 7 security reviews of six merged Events changes, in the form docs/security/reviews/README.md describes. Each record is built from the pull request description, the merged diff and its tests; where a description does not record something the template asks for, the record says so. Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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)
actions.Dispatch(name=...)now refuses the name of a standard DOM event, such asclick,submit,input,change,keydownorfocus, and names that start withvue:,vnode-orcitry:. Citry's browser code refuses the same names before it fires theCustomEvent, soCitry.events.applyActionsrejects them too. Custom names such asTaskRow:savedororder-savedare still accepted.Closes #704
Why
An
eventaction fires a bubblingCustomEventat the component's first element. It reaches listeners on that element, its ancestors,documentandwindow. A name such asclicktherefore runs the page's own listeners, including Vue@clickhandlers and@c-*bindings that call the server. When a handler takes the name from request data, the request picks which of those listeners run. The maintainer decided on #704 to refuse these names on the server and again in the browser.The list and where it lives
DOM_EVENT_NAMESincitry/_html_attribute_values.py, made byscripts/generate_html_attribute_values.py. It merges the HTML Standard's event handler index, Vue'sEventstype and names added by hand. The lint rules already read it. This PR adds 44 names browsers fire atdocumentandwindow, or still fire without a current standard, for 175 in all. Examples:DOMContentLoaded,readystatechange, thewebkit*animation events,search,mousewheel, the mutation events, gamepad and picture-in-picture events._vue/client.jsbetween marker comments.--client-onlycopies the committed table without downloading anything.runtime.jsis rebuilt from it.test_events_dispatch_names.pychecks that theclient.jsblock matches the Python table exactly, and that the prefix lists match.citry:,vue:andvnode-live inRESERVED_EVENT_PREFIXESinactions.py, with a copy inclient.js.REQUIRED_NAMESnow also requiressubmit,input,change,keydownandmessage, so a refresh from the sources cannot quietly drop a common name.Letter case
Both checks lowercase A-Z and then compare, so
Click,KEYDOWN,DOMContentLoadedandCitry:readyare refused.Clickwould not run aclicklistener. Some readers still fold case: HTML reads anonClickattribute asonclick, and Vue reads@Clickon a component tag asclick. No app needs a custom event that differs from a standard one only in case.с, the Kelvin sign) matches no standard listener. Python'sstr.lowerand JavaScript'stoLowerCasealso disagree on some non-ASCII letters, so full Unicode folding would let the two checks drift apart.click.Browser paths
One function,
refuseReservedEventName, runs before any listener on every path:applyPublicActionsWithoutApp:applyActionson a page with no mounted component, includingwait: falseand delayed actions.dispatchEvent: a server result for a mounted component. The check runs before theonEventlisteners as well as before the DOM event.dispatchEventGlobal: an untargeted event in an action list applied for a mounted component.The protocol's reference validators (Python, JS and JSON Schema) still accept these names. The spec row says so: the refusal is Citry's own rule, applied on top of the wire format.
Versioning
Citry 1.2.x accepted these names, so this refuses input that used to work. It ships in 1.3.0 under the security exception in CLAUDE.md and docs/codebase.md "Breaking changes". Request data could choose which of the page's own listeners run, including
@c-*bindings that send a server call. The changelog entry is marked Security. It lists the refused names, including common words such asclose,toggle,error,loadandmessage, and shows the fix: prefix the name with the component's name and listen for the new name.The trust-boundaries doc had recorded an earlier plan to warn now and refuse in 2.0.0. The maintainer's decision on #704 replaces it, and the open-question row is removed.
Tests
tests/test_events_dispatch_names.py(33 tests) covers representative refused names, case variants, prefixes, accepted custom names (including lookalikes and whitespace), the sync between the two copies, and the generator's marker writer. The focused events, lint, LSP and analysis suites pass (3254 tests).citry-client/test/dispatch-event-names.test.mjs(22 tests) runs against the shippedruntime.js: refused and accepted names,wait: false, and the runtime's own check when the protocol validator is bypassed. All 414 citry-client tests pass, including the canary that compares the rebuilt bundle.test_the_browser_refuses_a_standard_event_name_on_a_mounted_componentcovers both bridge paths. Removing either browser check makes it fail; I confirmed this for each path.--platform linux.scripts/validate.pypasses. In the local fast gate, pytest, the validators and the JS packages passed. The Rust phases and some pnpm phases failed only because this worktree has no ruff submodule and no node_modules for those packages; CI runs them.Review
on*handler outside the list remains. The browser test also did not reach either bridge path; the end-to-end test above now covers both.docs-cold-readerread the changed docs as a first-time reader. Its findings are folded in.Left for the maintainer
CustomEventname of an Eventseventaction) as a place where a value reaches the browser? I did not edit CLAUDE.md.DOM_EVENT_NAMESline was rewritten in the generator's exact format without downloading the sources, which this environment cannot reach. The module header still says it was generated on 2026-10-21. Run the generator online before the release to refresh all tables together.🤖 Generated with Claude Code