Repository navigation
fix(security): let Outlook's own webLink through the link guard - #34034
Conversation
|
Closing and reopening to re-trigger CI: every run on da33347 failed at startup on 2026-11-09 18:13Z from the installation API rate limit, and startup-failed runs cannot be retried. |
Sensitive Change ReviewSensitive files changed:
|
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: one matcher on validated bytes decides both gates, the flush change only skips values that sit wholly inside a matched Outlook span, and no other URL changes. Notes
[DESIGN-REVIEWED] 7e13248 Description read[DESCRIPTION-READ] c90885ae796246341a9d003e382c66d026c9658e2c291d3718795677c0cc59f0 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 Nothing blocks. All three gate changes are needed to open the reported link, and each one reuses the existing What this change shipsInventory (5 items) — 5 justifiedIntent: a person can open the Outlook
[FIRST-PRINCIPLES-REVIEWED] 7e13248 Description read[DESCRIPTION-READ] 213a8786d5176ab35ef09a4a9a7b47968d61dc3a0a5925a629781f551a5e8a6a 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: |
da33347 to
c8093e4
Compare
|
span=ec9ed038f45d
|
c8093e4 to
b84f2d6
Compare
b84f2d6 to
8b9372e
Compare
|
span=40b4e3d07714
|
8b9372e to
8961c8a
Compare
|
/ai-review override scope c3dc90a infra-failure: agent: stale monotonic floor, not a finding. Attempt 3 adjudicated VERDICT: PASS (https://github.com/kirodotdev/KiroCrew/actions/runs/42716562857/job/129549910126) but is held at the failure that attempts 1 and 2 published when GitHub answered "API rate limit exceeded for installation": https://github.com/kirodotdev/KiroCrew/actions/runs/42716562857/job/129500679268 https://github.com/kirodotdev/KiroCrew/actions/runs/42716562857/job/129522626864 |
Human judgment recorded@buluoray recorded a infra-failure release (class
This decision applies only to this commit. A new push requires a new judgment. |
|
Human judgment recorded, but the following reviewer lane(s) could not be re-run automatically: Security Scope Review. Re-run the lane's latest workflow run for |
c3dc90a to
7e13248
Compare
|
/ai-review override scope 7e13248 infra-failure: agent: rate-limited lane, not a finding. Run 42738125200 adjudicated VERDICT: PASS, then its floor step could not read this head's prior check-runs ("API rate limit exceeded for installation", 3 attempts) and failed closed: https://github.com/kirodotdev/KiroCrew/actions/runs/42738125200/job/129575551378 A rerun would be held at that failure, as on c3dc90a. |
Human judgment recorded@buluoray recorded a infra-failure release (class
This decision applies only to this commit. A new push requires a new judgment. |
Code change approver recommendation: A person should decideAutomated, not a person, and not a review: a maintainer still decides.
Why: 454 changed lines > 400 (small/medium only). The PR adds a narrow, validated exemption for Microsoft Graph's Outlook If this recommendation is wrong, reply here; the replies are how the approver is evaluated. |
bolichen97
left a comment
There was a problem hiding this comment.
Read the whole diff at 7e13248: the Outlook webLink route in redaction_entropy.py, its use in exfil.py and redaction.py, the segment flush change in segment_flush.py, the docs and the three test files. Approving. It loosens a false positive on one exact route and adds no new refusal and no regex. The reasoning template below is filled for this head.
Sensitive change review
- Head commit: 7e13248
- What rule changed: Outlook's own
webLink(/owa/?ItemID=<id>&exvsurl=1&viewmodel=ReadMessageItem, or the event form?itemid=<id>&exvsurl=1&path=/calendar/item) is kept by the bare-secret pass and judged narrowly by the exfil gate. The segment flush also stops counting a piece of such a link as a removed value coming back. - Before -> after (what was allowed/blocked, now): Before, the item id looked like a key and the 201-character query looked like exfiltration, so the link was masked or blocked, and a streamed reply holding it could be withheld whole. Now exactly that route is kept: https, an Outlook host, no port, the fixed path, the fixed fields in the fixed order, and an id that decodes as one whole Exchange id. Any other host, scheme, port, route, field order or extra field is judged as before.
- Worst case if wrong (breaks commands / leaks secret / locks user out): A secret-shaped value hidden in this one route would pass the length and base64 checks. The id must decode whole with no key-shaped piece, and the hard credential patterns and the heavy percent-encoding check still run on the link. No command is blocked and no one is locked out.
- Evidence checked (which sandbox result proves it): test_outlook_web_link_redaction.py shows the link surviving both gates in six wrappers, nine cases with a key in or next to the link still blocked, and nine look-alike cases (other host, http, a port, another path, reordered or renamed fields, an extra field) still blocked. test_segment_flush_outlook_links.py shows a streamed link saved whole at several cut points and a key split next to it still hidden.
- No regression:
- Tools still work (which tools/commands were run, result):
redact_credentials,scan_exfiltration_urlsandredact_exfiltration_urlsrun in the new tests on the link and on keys, with the results above. No command rule or sandbox rule is touched. - Backward compatible (old config / old data / old callers still work, how checked):
_URL_REand the other routes are unchanged, and the tests show other routes' queries stay outside the span. The package line budget test is raised by 67 for the new code. - Existing tests (which suites passed on this head): 99 of 100 checks pass on this head, including the backend and frontend test shards. The only red check is this one.
- Tools still work (which tools/commands were run, result):
- How to undo: revert this commit. No stored data or config changes.
Backport note: _PACKAGE_LINE_BUDGET is release's 35,048 raised by the same 67 lines (35,115; the package measures 35,114 on this branch). (cherry picked from commit 56ed094)
Problem / Motivation
Goal: Outlook on the web links that Microsoft Graph returns for a message or an event (
webLink) open from a Kiro Crew reply, while a key hidden in or near them is still masked and blocked.An agent reply with a link to an Outlook on the web draft was blocked by the link guard. The chip said the query has 201 characters (over the 200-char limit) and that part of it looks like a secret, so the full address was not kept and the link could not be opened from the card. The link is Graph's own
webLink:https://outlook.office365.com/owa/?ItemID=<id>&exvsurl=1&viewmodel=ReadMessageItem. Reported in the internal Kiro Crew debug channel on 2026-11-09.Why it matters
Every Graph message, draft and event link has this shape, and its id alone is ~160 characters of base64, so nearly every Outlook link an agent writes from a mail or calendar tool is blocked. A host exemption cannot help: the credential pass masks the id on any host, so the "looks like a secret" part stays.
Not a goal
outlook.office365.comas a host, or any other Outlook route's query. The path routes (/mail/.../id/<id>) were fixed in fix(security): keep Outlook and Slack links out of the bare AWS secret pass #25599 and are unchanged.What changed (motivation → approach → change)
Symptom: Graph's Outlook
webLinkis blocked and its id masked. Cause: #25599 exempts Outlook item ids only in the path; this route carries the id in the query, so the bare-secret pass masks it, and the exfil gate flags its 201-char, base64-shaped query. Change: recognise this one exact link and judge it with one matcher on both gates.redaction_entropy.py:_chat_mail_link_atreads on into the query only when the path is exactly/owa/. The query must be exactlyItemID=<id>&exvsurl=1&viewmodel=ReadMessageItemoritemid=<id>&exvsurl=1&path=/calendar/item, fields in that order, nothing else (_OWA_WEB_LINK_QUERIES,_outlook_web_link_item). The id passes the same checks as a path id: Exchange prefix, alphabet, length, whole-Exchange-id decode. The no-key-shaped-piece check runs on the whole link. No regex.exfil.py:_exfil_url_warningasks the same matcher (_outlook_web_link_tail) on https with no port. If it matches, only the bytes after the link (a sentence's., a fragment) stay under the length and base64 heuristics, the way the Slack app-create carve-out keeps its alias. The earlier checks (hard and fixed credentials, the multi-pass decode, heavy percent-encoding) run first and are unchanged.segment_flush.py:_outlook_link_spans,_blank_spans,_only_inside;_kept_removed_valuestakes the link spans;_whole_text_refusalpasses them (see the note at the top).docs/system-specs/modules/security.md: both rules.test_security_gate_liveness.py:_PACKAGE_LINE_BUDGET35,160 → 35,227, measured.redaction.py: the five new owner names are listed in the facade'sTYPE_CHECKINGmanifest.Security
This is a narrowed carve-out on the exfil gate, so here is why it is safe. It is keyed to validated bytes, not to the host. The path, the field names and the fixed values are constants, so the only free bytes are the id's. The id must decode as one whole Exchange folder or message entry id. Its free fields are GUIDs and counters, at most 22 bytes each, about 77 bytes in all. That is less than the sub-200-char query any URL may carry past these heuristics today. A 40-char key-shaped piece anywhere in the link (raw, between escapes, decoded) voids the match. Then the link is masked and blocked as before. Any extra field, other order, other value, other path, look-alike host,
httpor a port also voids it and falls back to the old rules.Backwards compatibility
Compatible: only this one exact link changes, from blocked to allowed. Every other URL is judged exactly as on main.
Removes nothing: no check, key or path is taken away. One link shape moves from masked to allowed.
Tests
test/test_outlook_web_link_redaction.py(new):test_the_reported_link_trips_both_gates_on_its_own_merits: the reported query is 201 chars, trips the bare-secret pass, and is flagged on another host.test_the_web_link_survives_both_gates: message, event andoutlook.office.comlinks surviveredact_credentials,scan_exfiltration_urlsandredact_exfiltration_urlsin 6 text templates.test_a_key_in_or_near_the_web_link_is_still_blocked: a key as the id, glued after the id or the last field, in an extra field, in a fixed value, in the path or in the fragment is still masked AND still flagged.test_anything_but_the_exact_web_link_is_still_blocked: other host, look-alike host,http, a port, another path, reordered or renamed fields, another value, or a long extra field with no key shape is still flagged.test/test_segment_flush_outlook_links.py(new), streamed through the real per-delta removers and the segment flush:test_a_streamed_web_link_is_saved_whole/test_a_streamed_path_link_is_saved_whole: 4, 8, 16, 32 and 64-char deltas, a mid-id cut, and (web link) a cut before&exvsurl; each saves the reply unchanged.test_a_split_secret_in_or_near_an_allowed_link_stays_hidden: a key alone, as the id of an allowed-looking link, glued after an allowed link or after its., or as the next word, at each delta size; the key never appears in the save.test_a_key_split_after_a_kept_link_is_masked_and_the_link_kept,test_the_reply_is_still_withheld_when_a_removed_value_shows_outside_a_link(inside, outside, inside+outside, straddling the start or the end, no links),test_a_non_outlook_chat_link_gets_no_exemption,test_a_reply_repeating_a_link_costs_occurrences_plus_spans_not_their_product(counts span reads for 2,000 copies; the per-occurrence rescan reads 20,010 and fails it).Mutation-checked: making
_only_insidenever true, any-occurrence instead of every, dropping the start or end bound, dropping the span blanking, or dropping the Outlook host filter each turns at least one test red.test_the_span_covers_the_query_and_stops_before_a_sentence_end,test_another_routes_query_stays_outside_its_span: span edges; a/mail/route's query stays outside its span, as on main.Proof: PROVEN test/test_outlook_web_link_redaction.py::test_the_web_link_survives_both_gates[bare-message], test/test_outlook_web_link_redaction.py::test_the_web_link_survives_both_gates[bare-event], test/test_outlook_web_link_redaction.py::test_the_web_link_survives_both_gates[bare-office-host], test/test_outlook_web_link_redaction.py::test_the_web_link_survives_both_gates[sentence-message], test/test_outlook_web_link_redaction.py::test_the_web_link_survives_both_gates[sentence-event] (head 7e13248)
With only
segment_flush.pyreverted to main (the rest of the fix kept), 7 of the 57 tests intest/test_segment_flush_outlook_links.pyfail; they pass on this head. (prove.py --per-hunkcould not run: pytest wrote no report for one mutant.)Related tests run locally, single process (
-n 0):test_outlook_web_link_redaction.py,test_document_link_redaction.py,test_security_exfil_urls.py,test_redaction_blocked_links.py,test_redaction_mirror_parity.py,test_security_gate_liveness.py,test_redaction_allow.py,test_security_oauth_urls.py: 966 passed; the segment-flush, chat_runner composition/coverage, SRI and facade-mirror files: 1206 passed.test_flake_pattern_ratchet.pypassed, semgrep diff scan clean, black/isort/flake8/mypy clean.Determinism: the new file is pure functions on constant inputs (no clock, files, threads or network). 39 passed on each of 3 repeats and once in reversed collection order.
Manual verification
N/A — unit coverage sufficient: the change is two pure functions, and the tests drive the real public redactors on the reported link shape.
Related Issues
Reported on Slack (internal), no GitHub issue. Follows #25599.
Sibling sweep
Swept: git grep -n "_OUTLOOK_HOSTS|_chat_mail_link_at" -- src/
Sibling: src/kiro_crew/security/redaction_entropy.py -- changed here
Sibling: src/kiro_crew/security/exfil.py -- changed here
Pattern harvest
Not generalizable: each link format needs its own closed shape and id check; a general rule for "base64 in a query" is what the gate exists to block.
Checklist