Repository navigation
fix(meetings): refuse a note editor id or note image name that ends in a newline - #34534
Conversation
…n a newline Python's $ also matches just before a trailing newline, so the note editor check accepted "tab-a\n" as a second editor beside "tab-a", and the note image check let write_note_image create a file whose name ends in a newline. Anchor the Meetings backend's request-path patterns at \Z and register the package in the regex-anchor contract. The meeting id and agent id helpers strip first, and the calendar feed patterns never see a newline, so those change only to keep the package free of $.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. This is the repo's existing Notes
[DESIGN-REVIEWED] 54b94e6 Description read[DESCRIPTION-READ] b18e023533eea6cf88196ad026ea16e942c2a6190f29421a6f17ccb5071c9147 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The two Notes
What this change shipsInventory (4 items) — 3 justifiedIntent: stop a Meetings note image name or editor id that ends in a newline from being accepted. FIX.
[FIRST-PRINCIPLES-REVIEWED] 54b94e6 Description read[DESCRIPTION-READ] 9a5e1fbd352c41d1b4b9a5d86054cd725876092edce4bd2c1190a88c3f37cb52 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: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved. On this head the review checked that _NOTE_EDITOR_RE now refuses "tab-a\n" at the PUT note route with a 400, where main stored it as a separate editor key. It also checked that _SAFE_NOTE_IMAGE_RE now stops write_note_image from creating a file whose name ends in a newline. Every caller of the other four re-anchored patterns strips or splits its input first, so those edits change no match, as the body says. Real client values (randomUUID editor ids, server-generated image names) still pass. Each fix has a test that fails if the change is reverted, and the contract test only gains entries.
Well done: registering the whole meetings backend in test_regex_anchor_contract.py means a $-anchored validator anywhere in that package now fails CI, not just the ones listed here.
Optional:
- The image-name half is defense-in-depth. The only route that writes an image builds the name from
uuid4, so the editor id is the one value a request can actually reach. - When Meetings moves out of core, the new
kiro_crew.apps.builtins.meetingsrows in the contract test should leave with it.
Port the Meetings backend and skill changes Kiro Crew made to its built-in copy since this repository was last kept in step: - a note editor id or note image name ending in a newline is refused (kirodotdev/KiroCrew#34534) - a Start that omits agents_enabled keeps the roster the meeting holds (kirodotdev/KiroCrew#28263) - the calendar provider loads on aiohttp 3.9 (kirodotdev/KiroCrew#35292) - filing a task never saves over an unreadable task ledger (kirodotdev/KiroCrew#35846) - a multipart note image upload with no boundary is a 400 (kirodotdev/KiroCrew#36046) - the skill's pip line double-quotes its specifiers (kirodotdev/KiroCrew#33244) - two test-only changes (kirodotdev/KiroCrew#34299, #33539) Each fix comes with the built-in's test; PORTING.md gains one row each. Co-authored-by: KiroCrewCaptain <312312717+KiroCrewCaptain@users.noreply.github.com>
Problem / Motivation
Goal: a Meetings note image name or note editor id that ends in a newline is refused, like every other value those checks refuse.
meetings/backend/store.pychecks a note image name with_SAFE_NOTE_IMAGE_RE, androutes/meeting_lifecycle.pychecks theeditorof a note save with_NOTE_EDITOR_RE. Both are$-anchored and used with.match, and Python's$also matches just before a trailing"\n". On mainwrite_note_image("m1", "<32 hex>.png\n", data)creates a file whose name ends in a newline, andPUT .../notewith"editor": "tab-a\n"answers 200 and counts as a second editor beside"tab-a". The meeting id and agent id patterns (_SAFE_ID_RE,_SAFE_AGENT_ID_RE) have the same shape, but their helpers strip the value first, so no newline reaches them; they change so the package meets the contract below.test/test_regex_anchor_contract.pyholds a package's request-path validators to\Z, package by package (#12161 began it; #34336 and #34465 registered Mochi and pptx-maker). Meetings is not registered there yet.Why it matters
The note image check is the barrier that keeps a name inside the images directory, and the editor check promises "letters, digits, '-' or '_'" in its error message. Neither keeps that promise for a trailing newline.
Not a goal
What changed (motivation → approach → change)
Approach: the repo's existing fix for this class. Anchor at
\Z, which matches only at the true end of the string, and register the package so the contract keeps it that way.src/kiro_crew/apps/builtins/meetings/backend/store.py:_SAFE_ID_RE,_SAFE_AGENT_ID_REand_SAFE_NOTE_IMAGE_REend at\Z, with the reason in a comment.src/kiro_crew/apps/builtins/meetings/backend/routes/meeting_lifecycle.py:_NOTE_EDITOR_REends at\Z.src/kiro_crew/apps/builtins/meetings/backend/providers/calendar.py:_LINE_REand_DURATION_REend at\Z. They read calendar feed text, not a request value, and neither can see a trailing newline (lines are split on\n, the duration is stripped), so a match is unchanged. They change only because the contract walks the wholebackendpackage.test/test_regex_anchor_contract.py:meetings.backendjoins_REQUEST_PATH_PACKAGES, and the four request-path patterns join_VALIDATORSwith a valid input each.test/test_meetings_note_images.py: a name plus"\n"joins the refused names, andtest_a_trailing_newline_never_reaches_an_image_file_namechecks that no newline-named file is created.test/test_meetings_note.py:{"editor": "tab-a\n", "seq": 1}joins the malformed orders that answer 400.Backwards compatibility
Compatible for every valid value: the patterns accept exactly what they did, minus a value with one trailing newline.
Tests
valid + "\n", the structural walk lists six$-anchored patterns, the editor save answers 200, the image name is accepted and written).test/test_meetings_*.py, the package's owntests/,test/test_regex_anchor_contract.pyandtest/test_pptx_maker_paths.py(which shares the contract): 1274 passed, three runs in a row at-n0. No test creates a file whose name holds a newline; the image test checks that none exists after the refusal.flake8,isort, the black gate, the comment-history gate, CI's semgrep rules and source gates, and the flake-pattern and wait-discipline ratchets pass locally.python -m pytest test/test_meetings_note_images.py test/test_meetings_note.py test/test_regex_anchor_contract.py -n0Manual verification
N/A: the tests call the store helpers and the note route, on real temporary directories.
Sibling sweep
Swept: every module-level compiled pattern under
src/kiro_crew/apps/builtins/meetings/backendwith an unescaped$and nore.MULTILINE; the contract's structural walk lists none after this change.Sibling:
src/kiro_crew/apps/builtins/meetings/backend/store.py-- changed hereSibling:
src/kiro_crew/apps/builtins/meetings/backend/routes/meeting_lifecycle.py-- changed hereSibling:
src/kiro_crew/apps/builtins/meetings/backend/providers/calendar.py-- changed herePattern harvest
Rule candidate: none new.
test/test_regex_anchor_contract.pyalready states the rule; this registers one more package under it.Screenshots / video
Why no screenshot: no markup change; a refused value is answered the way other unsafe values are.
Related Issues
None open for Meetings. Same class as #34199, #34238, #34336 and #34465; the contract began in #12161.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement