Skip to content

fix(security): let Outlook's own webLink through the link guard (0.12.2 backport of #34034) - #34567

Merged
buluoray merged 1 commit into
release/0.12.0from
crew/slack/owa-weblink-0.12.0
Nov 11, 2026
Merged

buluoray merged 1 commit into
release/0.12.0from
crew/slack/owa-weblink-0.12.0

Conversation

@buluoray

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On 0.12.x, an Outlook message or event link that Microsoft Graph returns as webLink reaches the user instead of being masked or blocked by the link guard.

Backport of #34034 (merge commit 56ed09453b20d778cd6cce386b5de8f72ca4a431 on main) into release/0.12.0 for 0.12.2. A user hit this on Slack: Graph's own webLink (/owa/?ItemID=<id>&exvsurl=1&viewmodel=ReadMessageItem, and the calendar form) carries a long base64 Exchange id in the query, so the redactor masked it and the exfil gate refused the reply.

Why it matters

Any 0.12 user who asks the agent for an Outlook mail or meeting link gets a masked link or a withheld reply, even though the link is Microsoft's own.

Not a goal

What changed (motivation → approach → change)

git cherry-pick -x of the main commit, no prerequisites. The fix recognises only the exact Graph webLink shape on Outlook hosts, the id must pass the same Exchange-id decode as a path id, and one matcher is shared by the redactor and the exfil gate; the streaming segment flush stops counting a removed value only when every occurrence is wholly inside such a kept link. Files: src/kiro_crew/security/redaction_entropy.py, src/kiro_crew/security/exfil.py, src/kiro_crew/security/redaction.py, src/kiro_crew/dashboard/chat_turn/segment_flush.py, docs/system-specs/modules/security.md, test/test_outlook_web_link_redaction.py, test/test_segment_flush_outlook_links.py, test/test_security_gate_liveness.py.

Hand-resolved hunk: one conflict, in test/test_security_gate_liveness.py's _PACKAGE_LINE_BUDGET. Main's value (35,227) and its comment history count two main-only changes (the crew-oauth-bridge leaf and DeniedCommandRule.note) that are not on release. Those are unrelated features, so they were not picked; the resolved value is release's 35,048 plus this fix's 67 lines, 35,115, which is the measured kiro_crew.security total on this branch. No code hunk conflicted.

The commit author is reset to the public identity because the leak guard refuses the squash commit's noreply author; the content and the (cherry picked from commit ...) line are unchanged.

Backwards compatibility

Compatible: only this one exact link shape changes, from blocked to allowed. Every other URL is judged exactly as on release.

Removes nothing: no check, key or path is taken away.

Tests

release/* gets no backend CI lanes, so these were run locally on this branch, one pytest process (-n 0): test_outlook_web_link_redaction, test_segment_flush_outlook_links, test_security_gate_liveness, and every test_*segment_flush*, test_*exfil* and test_*redaction* file.

Result: 2161 passed, 1 skipped. Left out of that run: test_crew_log_emit_redaction_and_flag.py, whose two boot-probe tests fail the same way on a clean release/0.12.0 checkout on this host (the probe's child process cannot import aiohttp), so it is environmental, not this pick.

black and flake8 pass on the changed files; the comment-history gate passes against release/0.12.0. git merge-tree --write-tree origin/release/0.12.0 HEAD is clean.

Proof: not provable -- other: backport of an already-proven main fix; see #34034

Manual verification

N/A — same change as #34034, which was verified there.

Related Issues

Backport of #34034. Reported on Slack (internal), no GitHub issue.

Sibling sweep

Siblings: none -- the backport carries the main fix as is; the sibling sweep was done on #34034

Pattern harvest

Not generalizable: backport of a one-link-shape fix; see #34034.

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

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 10, 2026 14:20
@buluoray
buluoray requested review from Zedmor and removed request for a team November 10, 2026 14:21
@github-actions

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security/exfil.py

  • src/kiro_crew/security/redaction.py

  • src/kiro_crew/security/redaction_entropy.py

  • No reasoning template for 63eba98 yet.

How to clear this check:

  1. The PR author posts the template below as a PR comment, with
    every field filled (N/A needs a reason). Keep the
    Head commit line: it must name the current head SHA.
  2. The check turns green within a minute, with no push.
  3. A new push resets this check: post it again for the new head.

Only the author's comment counts this way. A reviewer can instead
paste the filled template into an "Approve" review on this head.
Merging still needs a reviewer's approval.

## Sensitive change review
- Head commit: 63eba98444d3ba75f78b51061fab4f4f9eb28d32
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

@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 63eba98444d3ba75f78b51061fab4f4f9eb28d32 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

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 63eba98444d3ba75f78b51061fab4f4f9eb28d32 — 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

Nothing blocks: this is a straight backport of #34034's one-link-shape fix, and the reported defect comes from a Slack report with failing-shape tests.

Notes

  • Item 3 — undeclared: the flush exemption also covers Outlook's existing path links (/mail/drafts/id/<id>), as test_a_streamed_path_link_is_saved_whole shows. The Goal names only the webLink route, but the same delta-cut problem makes this in scope, so it is inventory only.

What this change ships

Inventory (5 items) — 4 justified

Intent: on 0.12.x, an Outlook mail or event link that Graph returns reaches the user unmasked and not withheld. This is a FIX.

  1. Graph webLink (/owa/?ItemID=…&exvsurl=1&…) on Outlook hosts is no longer masked by the credential pass — justified
  2. The exfil gate no longer refuses that exact link and still judges whatever is glued after it — justified
  3. A streamed reply holding an Outlook link that one delta cut is saved whole instead of being withheld (this also covers path links) — undeclared
  4. The kiro_crew.security line budget rises 35,048 → 35,115 (hand-resolved conflict) — justified
  5. The security spec documents the new route and the exfil carve-out — justified

[FIRST-PRINCIPLES-REVIEWED] 63eba98

Description read

[DESCRIPTION-READ] 21f2854dc1dd2a5194f1f087c7b5782d70eada12ff77808768fee3904aa7366b

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

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Faithful backport of a narrow carve-out. The redactor and the exfil gate share one matcher, nothing is removed, and the conflict resolution is explained.

Notes

  • The segment-flush change imports private names (_OUTLOOK_HOSTS, _chat_mail_link_spans) from security.redaction into dashboard/chat_turn/. That is acceptable for a pure backport, but on main a public helper in security should own this.

[DESIGN-REVIEWED] 63eba98

Description read

[DESCRIPTION-READ] 59e90ba9cd95cad7fd5364d06ec3e569475cf31595bd5f8e06b8a50aab5d71bc

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

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 63eba98444d3ba75f78b51061fab4f4f9eb28d32 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 63eba98

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

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 63eba98444d3ba75f78b51061fab4f4f9eb28d32 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 63eba98

Verdict parsed from the review's SHA-scoped output markers for commit 63eba98444d3ba75f78b51061fab4f4f9eb28d32.

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

@github-actions

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 63eba98444d3ba75f78b51061fab4f4f9eb28d32 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 8 classified, 0 newly refused, 8 still allowed.
  • ubuntu-latest (platform posix): 8 classified, 0 newly refused, 8 still allowed.
  • windows-latest (platform windows): 3 classified, 0 newly refused, 3 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: This change loosens two output-side gates. It adds an exemption for Outlook's Graph webLink in the credential redactor, in the exfil URL classifier and in the segment-flush comparison. It does not touch the shell deny composite, which reads none of the changed code: audit_bash_exfiltration does not call _exfil_url_warning, and is_denied uses redaction only to log a denial. So the adjudicated set measures the shell gate as a control and nothing more. One possible over-refusal sits in the exfil classifier for companion-exempt hosts. Nothing can classify it, and it is named below.

TIGHTENING: No guard got broader. The one ordering change that could refuse more is the exfil URL classifier, where the new webLink branch now runs before the companion exact-host exemption: + elif (_owa := _outlook_web_link_tail(_dom, path_and_query, port, is_https)) is not None: / + heuristic_query = _owa (placed ahead of elif _dom in exempt_hosts: heuristic_query = ""). The threat it keeps refused is a key or payload glued after, or smuggled into, a link that is otherwise exempt: "Whatever the scan glued after the link (a sentence's ., a fragment) is returned, so it stays judged."

ADJUDICATED: 11 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: I wrote posix rows (curl, open, xdg-open, echo/printf, pytest with / paths) and windows rows (curl.exe with %VAR%, start "" with cmd quoting, pytest with \ paths). The diff itself makes no host-path or interpreter assumption: it matches URL text, and _URL_PATH_SEP is / on every host by design. The windows rows check that cmd's %VAR% and quoting around the same webLink query don't reach a shell tier differently. I wrote no any rows, because every row names an executable. No platform the diff assumes is left unprobed.

UNADJUDICATED:

  • Exfil URL classifier, _exfil_url_warning in src/kiro_crew/security/exfil.py.
    • Call path: model output → scan_exfiltration_urls / redact_exfiltration_urls (and _exfil_retained_path) → _exfil_url_warning → the new _outlook_web_link_tail branch → _chat_mail_link_at in redaction_entropy.py.
    • The branch now runs before elif _dom in exempt_hosts. On a deployment whose companion CredentialPolicy._exempt_exact_hosts() lists outlook.office365.com or outlook.office.com, a valid webLink used to get heuristic_query = "". Now it gets the bytes after the link span, judged under the length and base64 heuristics. So a webLink on an exempt Outlook host followed by a long glued tail of 200+ chars, or a 40+ char base64-shaped run (for example a long # fragment with no whitespace), is newly flagged where the old order skipped it.
    • The public Default has an empty exempt set, so I could not show this with a call path on a shipped configuration. It stays a named gap, not a block.
    • Inputs I would have submitted, in prose: on a companion-exempt Outlook host, a message webLink with a long #-fragment anchor glued on; a message webLink wrapped in markdown with a trailing ) plus punctuation; and an event webLink immediately followed, with no space, by a long base64url run such as a Graph @odata.etag.
    • If this proves real, the narrowest fix is to return "" from the webLink branch when _dom in exempt_hosts, so tenant trust still wins.
  • Segment flush, _whole_text_refusal in dashboard/chat_turn/segment_flush.py. Two changes here: _kept_removed_values now skips values found only inside Outlook link spans, and _saved_text_shows_more now runs on _blank_spans(saved, links). Both only loosen. Blanking a span splits one run into pieces of that run, and _shows_only tests each run as a substring of the per-delta text, so a run that passed before still passes. Nothing could classify this guard either. The inputs I would have submitted are a streamed webLink split mid-id, and one wrapped in [x](...) or a JSON "webLink":"..." field.
  • Credential redactor, _chat_mail_link_at. This only adds a route: the /owa/ path, which no rule matched before, now reads into its query. Every other route still refuses a query (parts.query and not outlook). Nothing could classify this guard, and I see no input that is newly redacted.

[SCOPE-REVIEWED] 63eba98

@buluoray
buluoray merged commit 68403ee into release/0.12.0 Nov 11, 2026
25 of 28 checks passed
@buluoray
buluoray deleted the crew/slack/owa-weblink-0.12.0 branch November 11, 2026 02:23
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Nov 11, 2026
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.

1 participant