Repository navigation
fix(apps): drop the app web origin label regexes, document its shared site - #37670
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. Both validators now run plain character tests that accept the same set the regexes did, and the doc changes stop the "own site" wording from suggesting Notes
[DESIGN-REVIEWED] c3df582 Description read[DESCRIPTION-READ] b4f04fa7048878c80efc5e1d63ebcf2d46f77c8636eea385fa2a6341cb5fa7ef That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The PR changes no user-visible control. It swaps the label regexes for a character test, and edits SDK comments and developer docs. Since no dashboard UI changed, the missing blind read leaves no evidence gap. [UX-REVIEWED] c3df582 Description read[DESCRIPTION-READ] c8e88ee26639ae50f1dc06413d55a7decd8372bc903d6cc6eb70baf949f7b4f8 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This is a fix for the maintainer review of #36967: the regex goes and the docs are reworded. Nothing in it is new surface, and the one possible duplicate is a small private helper. Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: Validate the app web origin's host label without a regex, and make the app docs accurate about what the origin does and does not separate. FIX.
[FIRST-PRINCIPLES-REVIEWED] c3df582 Description read[DESCRIPTION-READ] b467ceff2a99dea0995e60f03f53497ef29e7cfef0a9853b03dfaf8c3f1f0eae That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
9d80c47 to
1bf91c7
Compare
… site The project takes no regex parsing or validation in product code, and the app web origin added two: _LABEL_RE in apps/app_web_origin.py and LABEL_RE in website/src/app-sdk/webOrigin.ts. Both are now a plain character test: 1 to 63 characters, each a lowercase letter, digit or "-", not starting or ending with "-". The docs called each app origin "its own site". Under the Public Suffix List's default rule every app origin may share the one site apps.localhost, so SameSite cookies do not separate apps. The docs now say "own origin" and tell apps to check Origin or a CSRF token on state-changing routes. They also say that Authorization is dropped on the origin, and that appWebOrigin reads only the dashboard's host name, so an app probes the origin before switching its frame. Every admission stays audited, reads included: each is a permission decision, and AUTOSDE.yaml requires a SEL event for every one. The audit test now pins GET, HEAD and OPTIONS rows too. Refs #36965
1bf91c7 to
c3df582
Compare
|
GPT 6.1 finding on The audit reduction came from an optional suggestion on #36967. It conflicts with |
Code change approver recommendation: ApproveWhy: the decider estimates a 5% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. The new character-test label checks in Python and TypeScript accept and refuse the same names as the regexes they replace. On the Python side the label is cut from a host that has already been canonicalized and ends in An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
I reviewed head c3df582. The new character-based DNS label checks in the gateway and the SDK replace the two regexes. A brute-force comparison found that they accept and refuse the same names as before, except a label with a trailing newline, which the old Python pattern let through and the new check refuses. The app web origin test suite passes on this head. The extended audit test checks that GET, HEAD and OPTIONS are each relayed and each leave a granted audit row. The rest of the change is documentation, and it matches what the code does, so nothing blocks.
Problem / Motivation
Goal: The app web origin from #36967 validates its host label without a regex, and its docs say what the origin does and does not separate.
These are the points from the maintainer review of #36967, taken after it merged:
_LABEL_REinapps/app_web_origin.py, used byparse_app_host, andLABEL_REinwebsite/src/app-sdk/webOrigin.ts, used byappWebOrigin. This was the review's one blocking point.apps.localhost, soSameSitecookies do not keep one app's framed page from another app's backend. An app reading "own site" would lean onSameSiteand skip its own CSRF check.Authorizationis dropped on the origin, andappWebOriginanswers from the dashboard's host name alone. Neither is in the app docs, so an app author finds them by debugging a blank frame.Why it matters
The regexes break a project rule that #36967 merged with. The docs are what an app author builds against, and the "own site" wording invites a CSRF hole in the backend the origin exposes.
Not a goal
Authorizationon the app origin. The gateway drops every credential it could be asked to trust; this PR only documents that, and says how a framed site that needs the header gets it.grantedSEL rows. The review suggested dropping the row for a served GET, HEAD or OPTIONS.AUTOSDE.yamlrequires a SEL event for every permission decision, and an admission is one, so every served request keeps its row.What changed (motivation → approach → change)
apps/app_web_origin.py:_LABEL_REis replaced by_is_dns_label(label), a plain character test: 1 to 63 characters, every one instring.ascii_lowercase + string.digits + "-", not starting or ending with-.import reis gone. The check stays local rather than going throughapp_name_error, because the rule is the DNS label one (63 characters, no trailing-). A name that passes it but is not an installed app still gets the same 404 from the backend lookup.website/src/app-sdk/webOrigin.ts:LABEL_REis replaced byisDnsLabel(name), the same test, withLABEL_CHARSaSetof the lowercase letters, digits and-.docs/app-kit/manifest-reference.md(backend.webOrigin): "own origin", not "own site". Every app origin can count as the one siteapps.localhost, so checkOriginor a CSRF token on every route that changes state.Authorizationis dropped, so a framed site that signs in with bearer or Basic auth needs the backend to add the header itself.docs/app-kit/api-reference.md(appWebOrigin): the answer reads the dashboard's host name only, so probe the origin with ano-corsfetch first and keep the loopback frame when the probe fails.docs/system-specs/modules/app-kit-platform.md§18k: the heading says origin, and the audit paragraph says why every admission is recorded. There is a new "One site for every app" paragraph, theAuthorizationconsequence, and the probe step under Discovery.docs/system-specs/modules/sel.md: the row says reads are included.docs/feature-map/README.md, the module docstring,webOrigin.ts,index.tsand the vendoredkirocrew-app-sdk.mjscomment: the same wording.Backwards compatibility
Compatible: the label test accepts and refuses exactly what the regexes did (the existing cases pass unchanged), and no route, header, response or SDK answer changes.
Removes nothing: the label rule accepts and refuses the same names, and every SEL row #36967 writes is still written.
Tests
test_parse_app_host, 63 characters and0are accepted, andx-anda_bare refused. InwebOrigin.test.ts,a,0,a-band 63 characters are accepted, andéanda\nare refused.webOrigin.test.ts: 22 passed. eslint is clean.test_each_serve_and_refusal_is_auditednow also sends GET, HEAD and OPTIONS. Each is served (200, and the backend sees all three), and each leaves agrantedrow, along with the POST, the WebSocket open and the refusal.test/test_app_web_origin.py: 72 passed.test_user_facing_doc_links.py,test_check_feature_map.pyand thetest_sel*.pysuites: 563 passed.main. flake8, mypy and black are clean.Proof: not provable -- other: the label rewrite keeps the regexes' accept and refuse set, which the label tests pin; the rest is documentation
Manual verification
N/A: a validation rewrite pinned by the tests above, and documentation.
Related Issues
Refs #36965
Sibling sweep
Swept: git show 860a01b -- src website/src | grep -nE "re.compile|RegExp|= /^"
Siblings: none -- #36967 added exactly the two label regexes replaced here, and no other file in it parses with a regex
Pattern harvest
Rule candidate: semgrep
Pattern: a new
re.compile(...)or regex literal in product code undersrc/orwebsite/src/, which the project does not take and no gate caught hereChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)