Repository navigation
fix(ui): check CSkeleton sizes, refuse is and key in item attrs, send trusted strings as text - #757
Merged
Merged
Conversation
…send trusted strings to the browser as text - CSkeleton width, height and last_line_width accept one positive CSS length or percentage, in the units CGrid min_col takes plus %. - The root attrs of the list item components and of CNativeSelect refuse `is` and `key`, through the shared reject_data_item_vue_name helper. - reject_citry_ui_reserved_attr reads a str subclass name as its real text. - CButton href and tabindex, and CAvatar img_attrs, send the browser the same decoded text the server writes, so Markup and SafeString values no longer fail the render. - Label patterns with placeholders are filled on the server by plain text replacement, as the browser code fills them (shared fill_label). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED
The shared reserved-name check, which every Citry UI attrs= and *_attrs= input calls, now also refuses `is` and `key` in any ASCII letter case, as the data item maps already do. The layout components (CCard, CContainer, CGrid, CGridItem, CRow, CCol, CSidebar) choose their tag only from their fixed tag= list. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED
Resolve the conflicts in docs/design/trust_boundaries.md and docs_site/content/ui-library/index.md. Main's refreshed rows (the CNavigationMenuLink row, the longer list of attribute names a request can still set, the form= and CTourStep id row) are kept. Where this branch changes behavior, its text wins: every attribute map refuses is and key, CSkeleton sizes are checked, and label patterns use fill_label. Line numbers are checked against the merged code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED
Each Citry UI attribute-name check now reads the key through attr_name_text(), which copies the stored characters into a plain str before lower(), casefold(), startswith() or set membership runs. A key of a str subclass now gets the same checks as a plain str key in the shared owned-name check, CButton's formaction and link-only form attribute checks, and the per-component attribute allowlists. Citry already writes such a key into the page as its stored characters, so the checks now compare the same text the browser gets. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED
Resolves the conflict in docs/design/trust_boundaries.md. The label pattern row and the CIcon row keep this branch's text and line numbers. The id and name row keeps main's text about form members read past a control with the same name, with this branch's validate_html_id line number. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED
The merge of main moved REFUSED_DYNAMIC_ELEMENT_TAGS in client.js from line 888 to line 904, so the dynamic tag row cites the new line. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED
Resolves the conflict in docs/design/trust_boundaries.md. The dynamic element row keeps this branch's Citry UI wording (Citry UI refuses an `is` key in its attribute maps) and takes the line numbers the merged tree has for html.py, replay.py and client.js. The Citry-owned binding row now points at attrs.py:140-143. 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]>
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.
What changed
Tightens several Citry UI inputs. Every change is in
citry-ui, which is still 0.x, so the new refusals are allowed there and the changelog states each one.width,heightandlast_line_widthnow take one positive CSS length or percentage (px,rem,em,ch,vw,vh,vmin,vmaxor%), the unitsCGrid(min_col=)takes plus%. Anything else raisesValueError. Before, any text without;, braces or a comment reached the CSS custom property.isandkeyin item attrs. The rootattrsofCListItem(and itssurface_attrs),CTimelineItem,CTreeItem,CSortableItem,CTransferListItem,CVirtualListItemand theCNativeSelectroot now refuseisandkeyin any letter case. They use the sharedreject_data_item_vue_namehelper, the same rule the table, grid, select and breadcrumb data items already follow. Before,keyfailed the render of four of these items with an unclear template error. The helper's message now fits every caller.strsubclass names.reject_citry_ui_reserved_attrcallsstr.translateon the class, so astrsubclass name is read as its real text.CButtonsends itshrefand atabindexfromattrsto the browser throughattribute_text, andCAvatardoes the same forimg_attrs. AMarkupor DjangoSafeStringvalue no longer fails the render with aTypeError, and the browser code gets the same decoded text the server writes into the attribute.fill_labelhelper fills app-supplied label patterns on the server by replacing each exact{name}as plain text, the same way the browser code fills them. It replacesstr.formatinCTransferList(count_label),CSortable,CFormCollection,CTreeGrid,CRating,CCascader,CTagsInputandCToast. A format spec such as{total:>99}now stays in the label as typed instead of padding the text, so the server and the browser show the same label.docs/design/trust_boundaries.mdsection 13 (theis/keysentence, the CSS row, a new label row, two stale line cites) andcskeleton/api.yml.Why
Each input now gets a check that matches what its docs promise (CSkeleton sizes), one rule across every attribute map (
isandkey), and the same text on the server and in the browser (trusted strings, label placeholders).Checks
is/key, thestrsubclass name,MarkupandSafeStringin browser data,fill_labeland two components that use it, the CTransferList count label). The independent reviewer ran them against the base commit: 84 fail there andtest_fill_label.pyfails at import.citry-uinon-e2e suite: 4,406 passed, 6 skipped.ruff check,ruff format --check(0.14.13): clean.mypy(1.20.2) on the touched modules and new tests: clean, also with--platform linux.Review
An independent reviewer covered security (attribute names, CSS, URL attributes), checked the change against the kinds of bug in other frameworks' published advisories, and did a separate prose pass. Fixed during the review: a
Truetabindexnow reaches the browser as"true", as the server writes it; end-to-end tests for theCTreeGridandCSortablelabels; changelog accuracy; comment wording; line cites.Versioning
citry-ui0.x only, nothing incitryorcitry-core. The refusals and the label change are listed under[Unreleased]inpackages/py/citry_ui/CHANGELOG.md; the nextcitry-uiminor release (0.7.0) covers them.Addition:
isandkeyin every attrs mapattrs=and*_attrs=input calls (reject_citry_ui_reserved_attr) now also refusesisandkey, in any ASCII letter case and with any value, with the same message as the data item maps. The layout components (CCard,CContainer,CGrid,CGridItem,CRow,CCol,CSidebar) now take their tag only from their fixedtag=list. Core's<c-element>tag checks apply as before.tests/test_root_attrs_vue_names.py(59 cases over seven layout components,CButtonand a non-rootCCombobox.input_attrs, plusdata-keyandtag=controls) replacestests/test_foreign_is_from_attrs.py, whoseattrs={"is": ...}route is now refused; 16 new unit cases intest_reserved_attr_names.py. The existing source sweep there checks every component module with an attrs input calls the shared check. Whole non-e2e citry_ui suite: 4460 passed, 109 skipped; ruff and mypy (also--platform linux) clean on touched files.trust_boundaries.mdrows for attribute names and tags, and the "Pass request data safely" list on the Citry UI page.strsubclass keys in every name check. Each attribute-name check, includingreject_owned_attrsand theCButtonformactioncheck, now reads a key throughattr_name_text()as the plain text Citry writes, so astrsubclass key gets the same checks as a plainstr(13 new tests intests/test_str_subclass_attr_names.py; citry_ui non-e2e suite 4468 passed, 109 skipped; independent review found no hole).🤖 Generated with Claude Code
https://claude.ai/code/session_01KUhrHXH1mNfRCnPcsQt7ED