Skip to content

fix(meetings): refuse a note editor id or note image name that ends in a newline - #34534

Merged
javenciu merged 1 commit into
mainfrom
fix/meetings-anchor-validators
Nov 10, 2026
Merged

javenciu merged 1 commit into
mainfrom
fix/meetings-anchor-validators

Conversation

@javenciu

Copy link
Copy Markdown
Contributor

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.py checks a note image name with _SAFE_NOTE_IMAGE_RE, and routes/meeting_lifecycle.py checks the editor of 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 main write_note_image("m1", "<32 hex>.png\n", data) creates a file whose name ends in a newline, and PUT .../note with "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.py holds 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

  • No other package's patterns.
  • No change to what a valid id, name or editor is.

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_RE and _SAFE_NOTE_IMAGE_RE end at \Z, with the reason in a comment.
  • src/kiro_crew/apps/builtins/meetings/backend/routes/meeting_lifecycle.py: _NOTE_EDITOR_RE ends at \Z.
  • src/kiro_crew/apps/builtins/meetings/backend/providers/calendar.py: _LINE_RE and _DURATION_RE end 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 whole backend package.
  • test/test_regex_anchor_contract.py: meetings.backend joins _REQUEST_PATH_PACKAGES, and the four request-path patterns join _VALIDATORS with a valid input each.
  • test/test_meetings_note_images.py: a name plus "\n" joins the refused names, and test_a_trailing_newline_never_reaches_an_image_file_name checks 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

  • Before: on main the 8 new or extended checks fail (the four patterns accept valid + "\n", the structural walk lists six $-anchored patterns, the editor save answers 200, the image name is accepted and written).
  • After: every test/test_meetings_*.py, the package's own tests/, test/test_regex_anchor_contract.py and test/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.
  • The whole backend suite on a local merge with current main fails only the tests this environment fails on main itself (optional dependencies it lacks).
  • 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.
  • Reproduce: python -m pytest test/test_meetings_note_images.py test/test_meetings_note.py test/test_regex_anchor_contract.py -n0
  • Proof: PROVEN test/test_meetings_note.py::TestOneEditorsSavesLandInOrder::test_a_malformed_order_is_refused_not_ignored[extra4], test/test_meetings_note_images.py::TestStore::test_only_a_generated_name_is_accepted[0123456789abcdef0123456789abcdef.png\n], test/test_meetings_note_images.py::TestStore::test_a_trailing_newline_never_reaches_an_image_file_name, test/test_regex_anchor_contract.py::TestTrailingNewlineContract::test_valid_input_plus_newline_is_rejected[meetings-meeting-id], test/test_regex_anchor_contract.py::TestTrailingNewlineContract::test_valid_input_plus_newline_is_rejected[meetings-agent-id] (head 54b94e6)

Manual 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/backend with an unescaped $ and no re.MULTILINE; the contract's structural walk lists none after this change.
Sibling: src/kiro_crew/apps/builtins/meetings/backend/store.py -- changed here
Sibling: src/kiro_crew/apps/builtins/meetings/backend/routes/meeting_lifecycle.py -- changed here
Sibling: src/kiro_crew/apps/builtins/meetings/backend/providers/calendar.py -- changed here

Pattern harvest

Rule candidate: none new. test/test_regex_anchor_contract.py already 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

…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 $.
@javenciu
javenciu requested review from a team and KiroCrewCaptain as code owners November 10, 2026 12:34
@javenciu
javenciu enabled auto-merge (squash) November 10, 2026 12:34
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 54b94e6fd3b0aaed66b0f1096026615dfe35a9b7 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 54b94e6fd3b0aaed66b0f1096026615dfe35a9b7 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. This is the repo's existing \Z fix for this class of bug, applied to a built-in app not yet pinned in adoption-pins.json, so fixing it in core is allowed.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 54b94e6fd3b0aaed66b0f1096026615dfe35a9b7 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

The two $→\Z fixes (note image name, note editor id) have test-proven defects. The other four pattern edits change no match and exist only so the package passes the anchor contract it now registers in.

Notes

  • Item 3 — rides along: the diff's own comment says "\Z keeps the package free of $ anchors for the regex-anchor contract without changing a match". Nobody gains anything without it except the contract registration (item 4). That registration is how this PR keeps the fix from regressing, so this is a note and not a blocker.

What this change ships

Inventory (4 items) — 3 justified

Intent: stop a Meetings note image name or editor id that ends in a newline from being accepted. FIX.

  1. A note image name ending in \n is refused instead of becoming a newline-named file — justified
  2. A note save with an editor id ending in \n gets 400 instead of counting as a second editor — justified
  3. Meeting-id, agent-id and calendar _LINE_RE/_DURATION_RE re-anchored with no change in what they match — rides along
  4. Meetings backend registered in test/test_regex_anchor_contract.py so a $ anchor cannot come back — justified

[FIRST-PRINCIPLES-REVIEWED] 54b94e6

Description read

[DESCRIPTION-READ] 9a5e1fbd352c41d1b4b9a5d86054cd725876092edce4bd2c1190a88c3f37cb52

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 54b94e6fd3b0aaed66b0f1096026615dfe35a9b7 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 54b94e6

Verdict parsed from the review's SHA-scoped output markers for commit 54b94e6fd3b0aaed66b0f1096026615dfe35a9b7.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 54b94e6fd3b0aaed66b0f1096026615dfe35a9b7 false-positive: <reason, 20 to 500 characters>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 54b94e6fd3b0aaed66b0f1096026615dfe35a9b7 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 54b94e6

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 54b94e6fd3b0aaed66b0f1096026615dfe35a9b7 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 10, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.meetings rows in the contract test should leave with it.

@javenciu
javenciu merged commit c80f3e4 into main Nov 10, 2026
98 checks passed
@javenciu
javenciu deleted the fix/meetings-anchor-validators branch November 10, 2026 13:55
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 10, 2026
KiroCrewCaptain added a commit to KiroCrewCaptain/kirocrew-app-meetings that referenced this pull request Nov 13, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants