Repository navigation
fix(ui): refuse Citry's reserved data-* names in every Citry UI attrs map - #722
Merged
Merged
Conversation
Every Citry UI attrs= and *_attrs= input now runs one shared check, reject_citry_ui_reserved_attr, which refuses a name that starts with data-citry-, data-cev or data-cid. Most components already refused these prefixes with their own copy of the loop; CButton, CCombobox, CDialog, CDrawer, CField, CForm, CSidebar, CTable and CTabs refused only the names they set themselves. A data-citry-* name passes only with a CitryUiOwnedValue, which Citry UI writes into slot data such as activator_attrs, so the documented <c-CButton c-attrs="activator_attrs"> composition keeps working. Closes #716 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Citry UI's browser code also reads data-cui-* names, such as data-cui-listbox-option-disabled on a listbox option, so the shared check refuses that prefix as well. The error message now puts "rename the key" first, the docs say how to add keys to slot attrs, and the trust boundary rows cite the moved line numbers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 15, 2026
JuroOravec
added a commit
that referenced
this pull request
Nov 16, 2026
* docs: record the security reviews of #713, #714, #718 and #722 Adds the Mechanism 7 step 7 records for four merged pull requests: GHSA-x773 (#713, reserved attribute names as c-bind keys), #714 (out-of-date pages and the rolling-deploy check), #718 (one Rust URL scheme reader), and GHSA-7fjh (#722, reserved data-* names in Citry UI attribute maps). The two advisory records name the advisory and the affected and fixed versions; the facts come from the pull requests. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * docs: link the #720 follow-up from the #714 review record Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- 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.
Closes #716.
What changes
Every Citry UI
attrs=and*_attrs=map now runs one shared check,reject_citry_ui_reserved_attrincitry_ui/components/_attrs.py. It raisesValueErrorfor a name that starts withdata-citry-,data-cui-,data-cevordata-cid, compared after lowercasing ASCII letters only, as browsers compare names.data-citry-,data-cevanddata-cidwith their own copy of the loop. Those copies now call the shared check.CButton,CCombobox,CDialog,CDrawer,CField,CForm,CSidebar,CTableandCTabsrefused only the names they set themselves.reject_owned_attrsnow calls the shared check, which covers them.CTabsandCTablehave their own helpers, which call it too.data-cui-*is new for every component. Citry UI's browser code readsdata-cui-*names too, and the independent review found thatdata-cui-listbox-option-disabledfrom data on aCListboxOptionmade the option behave as disabled.CCalendar,CDatePicker,CDateRange,CNumberInput,CPinInput,CRating,CSlider,CTimePicker) did not refusedata-cev; they do now. Their own extra prefixes (data-cniand so on) stay.Slot attrs keep working
Some components hand their own marker names to the caller in slot data, for example
CDialog'sactivator_attrsholdsdata-citry-dialog-trigger, and the documented pattern spreads it onto a button:<c-CButton c-attrs="activator_attrs">. A plain list of allowed names would let request data namedata-citry-dialog-closetoo, which is the case in the issue.So the components that hand out such names now write the value as
CitryUiOwnedValue, astrsubclass. The check accepts adata-citry-*name only with such a value (orNone/False, which write no attribute). Request data and JSON only produce a plainstr, and string operations drop the subclass. Merging your own keys ({**activator_attrs, 'title': 'More'}) keeps it. I checked that the value survives slot data intoCButtonon static pages and on a State-backed (Vue) page.CContextMenu(target_attrs=)keeps acceptingdata-citry-context-menu-native, its documented escape that only turns the custom menu off, and re-marks it so it can reach a<c-CButton>in the target slot.Why the whole prefix, not a list from the browser code
The browser code builds some names at run time (
dataset[...], names made from a part or action), so a list read from the source would miss names and go stale with the next component. Refusing the prefix covers names a later release starts reading. A test scans the shipped source (componentjs,runtime.source.js, templates, CSS,dataset.citryXproperties) for everydata-citry-*/data-cui-*name and fails if the check stops refusing one.Tests
packages/py/citry_ui/tests/test_reserved_attr_names.py: the shared check (prefixes, ASCII case, non-ASCII lookalike passes,None/False, owned value,data-cidnever unlocked, extra prefixes); the source scan; CButton with the issue's case; Dialog and Popover slot attrs on a CButton (also with keys added); the ContextMenu escape; one render case each for CDialog, CDrawer, CForm, CField, CSidebar, CTabs (attrs,tab_list_attrs), CComboboxinput_attrs, a CTable cell, a CListboxOptiondata-cui-*name; and a source check that every component module with anattrsinput calls the shared check.Checks
test_distribution_metadata_and_resources_use_only_the_citry_ui_namespace,test_the_editor_accepts_digit_inputs_as_text_or_numbers) fail the same way onmainin my local environment.ruff check,ruff format --check(repo),scripts/validate.py: pass.citry_uiand--platform linux: pass.docs_site/tests(the local environment lackslxml), and the browser e2e tests. CI covers them.Review
An independent reviewer (technical, Mechanism 7 security brief: attribute names and markers for Citry's browser code, Mechanism 8 advisory survey) ran a harness that injected a probe name into every
attrs/*_attrsinput of every quality scenario: all 171 public inputs reached the check with the real value. Findings and what I did:data-cui-*names reach the browser code from data (CListboxOption). Fixed: prefix added, test added.data-citry-. Fixed: it coversdata-cui-and names one such name.Nonehad no component-level test. Fixed.data-cui-; "storage cannot produce one" was too strong;data-cniand similar extra prefixes are read by no browser code. Fixed wording; extra prefixes kept as they were.trust_boundaries.md.strsubclass, so no collision.A docs cold read and prose pass (
docs-cold-reader) asked to move the CButton rule under "Configure Button", say how to add keys to slot attrs, put "rename the key" first in the error message, add an upgrade action to the changelog, reflow lines, and fix several comments and docstrings. All applied.🤖 Generated with Claude Code