Skip to content

fix: name the refused file in the flagged-file delivery audit trail - #13311

Merged
iamwhatever merged 1 commit into
mainfrom
fix/audit-refused-file-name-9091
Sep 25, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/audit-refused-file-name-9091

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What is the problem?

When the credential scanner refuses to deliver a file, nothing records which file it
was. The consent audit trail records a flagged file that went OUT under a grant
(detail=f"file_send: {clean_name}"), and it records grants, revocations and
non-owner denials. It records nothing at all on the refusal. The only place the
refused file's name appears is the error string returned to the calling agent.

So the asymmetry is: an incident review can see which flagged files left, and cannot
see which ones were stopped. And the owner standing in front of the
Settings > Security > Flagged-file delivery panel, being asked to allow delivery,
has no way to find out what was flagged.

Writing the name into the audit log turned out to expose a second, older problem in
the same sentence: GET /api/sel/events served that log to any authenticated
dashboard session, not to the owner. See "The endpoint gate" below.

Why this issue matters to the user

The owner is the one who decides. The panel asks them to allow delivery of
scanner-flagged files to this machine's outbox and their own dashboard, and the whole
step-up around it -- the masked nonce, the host kirocrew file-delivery approve
command, the safety epoch -- exists so that the decision is genuinely theirs. A
decision they cannot inform is a weaker decision, however well the mechanism is
protected: they either allow it blind or refuse work they would have allowed.

The error string cannot serve them. It is returned to the AGENT, and the agent is
exactly the party the consent constrains.

How our fix solves it

Symptom: the owner cannot learn which file was refused.

One step up: the name is not in any record. The refusal sites hold the name in a
local variable and write a SEL tool-invocation entry that omits it
(error="sensitive_content_detected").

Root cause: the refusal was treated as not worth recording, on the ground that it was
"self-evident in the tool's error string" -- which is true only for the agent that
receives the string, not for the owner. audit_decision's own docstring said so.

The fix records the name at every refusal the scanner causes, under a new refused
outcome. No new store and no new endpoint: audit_decision already redacts the
detail before clipping it, and its entries already reach the owner over
GET /api/sel/events. Recording a refused name is therefore the same disclosure
class through the same channel as the delivered entry that already names a flagged
file.

The sites, and what each one covers:

Leg Scans Records Through
file_send (tool) name, content both audit_refusal
api_outbox_notify name or path, content both audit_refusal
api_outbox_download content it audit_refusal
_gate_upload_file (Slack, channel) name, binary content, text content all three its own _sel()

audit_refusal is the single spelling of the entry for the three grantable-class
legs, so they cannot drift into several vocabularies an owner would have to learn.

The shared channel-upload gate is deliberately NOT one of them. That function carries
a structural guarantee -- it is the single admission gate both third-party legs pass
through, and because it contains no reference to the consent store, no grant can reach
the Slack or channel leg by any code path. A test asserts that property on the real
source. Routing its refusals through the consent module would have broken it for an
audit write that needs nothing from that module, so the gate names the refused file in
the tool-invocation entry it already writes, in the code: detail shape its
neighbouring refusals already use. The legs it serves can hold no grant, so a consent
decision is not what those entries record anyway.

Refusals caused by shape rather than by the scanner -- a missing field, a path
outside the allowed roots, an oversized read, a type off the binary allowlist, a
redaction failure -- record no file name, because none was flagged and an entry would
claim the scanner stopped something it never looked at.

Which refusal, and by whom

Two of the seven sites sit behind a gate with TWO conjuncts: the outbox download
honours a grant, but only for the owner, and it refuses on text and on binary content
separately. A single refusal entry served both failures, so the
owner's trail read the same whether the scanner had held a file back or another
authenticated principal had reached for a file the owner's own grant covers -- and the
second, read as the first, says the owner's grant lapsed while naming the other
principal nowhere. Identity is what the entry now reports, and it carries the
requester: audit_decision stamps every refusal gateway, which is the process, not
who asked. The five single-principal sites carry no caller clause,
because an entry trailing a bare caller= would read as an identity the log failed to
capture.

Why the file name composes last. audit_decision clips the detail at 200
characters, and the name is the only field in the entry with no length bound: an
outbox name arrives in the request path and is resolved inside the outbox, never
measured. Composed name-first, a long enough name pushes the reason and then the
caller off the end, and what survives reads exactly like a plain scanner hold-back
with no identity -- the reading the caller field exists to prevent, on the one leg
where the requester is recorded nowhere else. So the leg, the reason and the caller
compose ahead of the name: the fields that say what happened and to whom always fit,
and the name degrades to a prefix, which is honest.

The discriminator is identity, not the grant. The gate's conjunction
short-circuits, so in the default no-grant state a non-owner is refused before the
owner check is ever evaluated. Keyed off the grant, that caller would be recorded as
an ordinary scanner hold-back -- byte-identical to the owner's own -- so the entry
would lose its attribution in the configuration almost every install runs, which is
the one case it exists for. _requester_is_not_the_owner() answers in every
configuration and needs no thread, being attribute reads over the request's claims and
the in-memory owner id, unlike the grant's store read.

The endpoint gate

This part is outside the original issue, and here is why it is in this PR. The
fix above rests on one claim: the audit log is a surface the OWNER reads. That claim
was false. api_sel_events ran no identity check and returned recent() rows
verbatim to any authenticated session, and a dashboard session is not by itself the
owner -- the messaging bridges mint a presigned token whose subject is the allowed
user's own id. Writing refused filenames into that log would have handed one
principal another's audit trail, and the same hole was already serving main's
delivered entries, which name a flagged file too.

So the gate is not scope growth bolted on; it is the premise of the change, and
leaving it for later would have shipped the disclosure and called it a disclosure to
the owner. The read is now gated on is_owner_dashboard_request, the rule the secrets
vault and the delivery-consent surface already follow, rather than a second
hand-rolled check that could drift from them. The refusal is audited: an ungated read
attempt against the security log is itself an event an operator wants, and the denial
row names the calling app, never a credential.

Nothing in the product consumed the endpoint -- there are zero callers in the
frontend -- so the gate closes a hole without taking a reader away from anyone.
GET /api/sel/verify is untouched: it returns an integrity verdict, not rows.

The denial tail, for the one caller who can act on it. A dashboard session signed
before an owner was configured keeps its bootstrap subject, and a token refresh
preserves the subject, so the real owner keeps failing this gate until they sign in
again. A generic 403 tells them nothing they can act on, so the denial goes through
_owner_denial_response, the tail every other owner gate in the dashboard shares: it
relabels exactly that class 401 stale_session_reauth and leaves every other refused
caller on the generic 403, since an unsigned or app-token caller must not learn which
denial class it hit. The audit is written first, so the relabel changes the response
and not the recorded decision.

Why the name stays off the consent card. The issue asks for three steps: capture,
a read endpoint, and rendering on the card. The read endpoint already exists, so step
2 needs no new route. Step 3 is deliberately not done. The primary refusal runs in the
agent-side MCP process, so the name is text the agent chose; putting it on the grant
surface would let a prompt-injected agent display a reassuring name to coax a
standing grant, in the product's own voice, on the one surface whose design exists to
make that coaxing hard. The grant also covers the whole destination class rather than
one file, so a single name on the card would imply a per-file scope that does not
exist. An owner who wants to know what was refused reads the security event log,
which now names it -- and which now only they can read.

Comments that asserted the refusal is deliberately unrecorded were corrected in the
same change, since they are the prose form of the bug.

The gate is the shared one, and why the allow row stays

The owner check, the refusal audit and the stale-session relabel are all
require_owner_dashboard_request, the helper ~103 other owner-only dashboard
surfaces call. An earlier revision hand-rolled those three steps inline, including a
cold-path thread hop around the SEL singleton; the helper does the same work and
relies on the startup warm (sel.warm_sel_singleton) instead, guarded so a failed
warm cannot change the outcome. There is no difference the helper cannot provide, so
the second spelling is gone along with the two cold/warm hop tests that only existed
to describe it. The denial code is therefore the standard owner_only, and sel.md
says so.

The allowed row is kept, and it is kept on a named requirement rather than on
completeness for its own sake. GPT 5.6 blocked the immediately preceding revision on
exactly this: a successful owner read left no row anywhere, which its adjudication
upheld as security-class against the backend-security-controls anchor. No denial row
can answer that -- a denial says who was turned away, never that the log was read --
and this endpoint is the one that serves the audit trail itself, so reading it is a
security event in a way that reading an ordinary owner surface is not. Deleting the
row would re-open a finding already adjudicated as blocking.

The owner has to be able to READ the name

Writing the name is only half of it. audit_decision puts it in the SEL resources
field, and kirocrew security events -- the read path an owner actually has, since the
endpoint is owner-only and there is no audit UI -- printed timestamp, source, event
type, operation, outcome, caller, error and downstream_service, and dropped
resources. So every refusal said that a refusal happened and never said what was
refused. The renderer now prints resources, which also makes the delivered rows
already on main legible for the first time. It is a small change in an otherwise
untouched file and it is in scope because without it this change does not reach the
person it is for.

Printing that field safely is part of the same step. A refused file name is text the
AGENT chose, a POSIX name may carry ESC/OSC bytes, and nothing upstream removes them:
the consent module's redaction and SEL's own write-path pass both police credentials and
length, not control sequences. Raw, those bytes execute in the owner's terminal -- the
one place this trail is read. Both untrusted fields the renderer prints, resources and
the pre-existing error, now go through safe_terminal_line, the shared stdlib-only
policy other CLI surfaces already use. error is included rather than left alone
because this change is what routes agent-chosen file names into it, at the
channel-upload gate's four denial entries.

That guard is applied to the WHOLE row, not only the two fields the refused name
lands in. SEL's _REDACTED_TEXT_FIELDS names operation beside resources and
error, and log_api_access documents outcome the same way, because an installed
app reaches it through ctx.audit -- so the summary line one row above carried the
same exposure and is sanitized too. The same helper also coerces before sanitizing:
recent() validates only that a line is a dict, the log is sandbox read-write, and
safe_terminal_line hands its argument to re.sub, so a forged line with a
non-string field would have aborted the listing and hidden every other event.

One doc claim went with it. The app-kit reference said an app "cannot read it back",
four lines above its own statement that hook code runs inside the gateway and can
reach the log directly. The endpoint is owner-gated; in-process app code is not
isolated from the log, and the page now says that instead.

The allow row is written AFTER the rows are captured, not before. recent() opens with
flush(), so a row enqueued first reaches disk in time to come back as the newest
record: the owner would have received their own audit row in place of a real event, and
a limit=1 read would have returned nothing else. Captured first, the payload is real
events only.

Disposition: the advisory CONCERNS on a second SEL row (withdrawn upstream)

On an earlier head First Principles asked for audit_refusal and its call sites to be deleted, with
the name appended to the log_tool_invocation denied row each site already writes --
the shape the channel-upload gate uses in this same diff. Its facts are right: every
site does sit beside a denied row, one base row already carries the name
(error=f"sensitive_filename: {redact(clean_name)}"), both families reach the same
owner-read log, and the gate here does take the one-row route.

The reason to keep the separate entry is what that family already holds. granted,
revoked and delivered are all file_delivery_consent.* entries on the base --
delivered at two sites, naming the flagged file that went OUT. refused is the
counterpart of that delivered row, and the asymmetry between what left and what was
stopped is the whole complaint this change answers. Collapsing the refusal into
log_tool_invocation puts the pair in two different families: the delivery in the
per-destination-class decision history, the refusal in per-tool-call telemetry. An
owner asking "what did I grant, what went out, what was held back" then reads two
vocabularies to reassemble one class's history, which is the same asymmetry in a new
place.

The channel-upload gate is not a concession to the contrary. It takes the one-row
route because a structural test forbids it referencing consent state at all -- it
serves legs a grant can never cover -- so it was never eligible for this family.

Superseded on the rebased head. That verdict re-sampled to a different finding:
the notify leg's own binary-content refusal named no file. It was the twin of the
download branch and the omission was real, so it is fixed rather than argued, and the
per-leg count pin moved from two to three so the gap cannot reappear silently. The
subtraction above is no longer asked for on the current head; the reasoning is kept
here because the entry it defends is still the one this change ships.

Rebased onto the restructured gates

#13269 landed on main after this branch was cut and rewrote the same delivery
gates: the grant read moved into a thread, the two-conjunct owner test became the
_grant_permits_this_handover closure, and a wide-encoding scan plus a binary-content
scan were added on both owner-facing legs. This branch is rebased onto that work
rather than around it -- main's control flow is kept everywhere the two touched the
same lines, and this change re-applies on top of it.

Consequences for the count. Both owner-facing legs now refuse on binary content as
well as text: download carries TWO refusal entries and both discriminate the conjunct
that failed, and notify carries THREE (name, text content, binary content). The upload
gate now has four scanner denials to name rather than three, the new one being the
wide-encoding scan. The per-leg count test pins each number, so a scan added without
an entry reddens it. Both owner-facing legs gained that binary scan, so notify carries THREE entries
and download TWO, and audit_refusal has seven call sites. #13269 shipped its two new denials without the file name, so naming
them is the same gap this change closes, in code that did not exist when it was
opened.

What tests we did

Every run named its file and passed an explicit -n0.

  • test/test_file_delivery_consent.py, the three classes this change touches
    (TestARefusalNamesTheFileItHeldBack, TestConsentedDownloadRequiresOwnerIdentity,
    TestEveryScannerRefusalRecordsTheName): 14 passed. They cover the refusal helper's
    recorded fields, the primary tool leg end to end, a flagged name recorded without
    reproducing it, the negative direction (a granted delivery records no refusal), the
    per-leg count of refusal entries, which upload-gate entries carry the file name, the
    pre-existing structural guarantee that the upload gate references no consent store,
    the caller clause in both directions (named on the two-conjunct leg, absent on a
    single-principal leg), that the download entry says which conjunct refused, and that
    a 4000-character name still cannot clip the reason or the caller off the row, and that
    both download branches -- text and binary -- discriminate the conjunct.
  • test/test_dashboard_handlers_core_coverage.py::TestSelEndpoints: 15 passed. Three
    owner reads; four non-owner classes that must fail closed -- a different user, no
    user claim, an app token, and an absent app claim -- each asserted to return 403 and
    to leave recent() uncalled, so a 403 whose body still carried the rows could not
    pass; both bootstrap subjects asserted to get 401 stale_session_reauth with
    recent() still uncalled; and the negative, that a caller under NO configured owner
    keeps the generic 403 rather than being told to re-authenticate.
  • test/test_sel_dashboard_offload.py: 5 passed. Its fake request carries the owner
    identity the endpoint requires, and the denial audit is asserted to hop off the loop
    when the SEL singleton is cold and to stay inline when it is warm.

Mutation-verified against the code as it now stands, each mutation applied alone and
the file restored byte-identically afterwards (asserted by hash): with the download
refusal collapsed back to one reason string, the conjunct test reddens; with the
detail composed name-first again, four row-shape tests redden; with the notify
binary-content entry removed, the per-leg count test reddens; with the refusal
attributed by the grant instead of identity, the conjunct test reddens; with the
allow row deleted, the two read-audit tests redden; with that row moved back ahead of
the read, the ordering test reddens; with the renderer's resources line removed, the
visibility test reddens; with that line printing the field raw instead of through
safe_terminal_line, the control-byte test reddens; with the summary line's
operation read raw again, the summary-line test reddens; and with the coercion
removed so re.sub meets a non-string, the forged-row test reddens. The owner decision and the denial
audit are no longer mutated here because they are no longer this handler's code -- they
belong to the shared gate, which its own ~103 callers cover.
Unmutated, the three handler/consent files are 289 passed and the CLI file's event
renderer tests 12 passed. Behaviour, not just source shape:
the primary delivery leg is driven end to end (file_send on a flagged file with no
grant) and its entry asserted verbatim, and the helper's two entry shapes are asserted
on the recorded row.

Gates: flake8 and isort clean over every Python file in the change;
scripts/check_black_formatting.py and scripts/check_comment_history.py both pass
over the change scope.

Any other suggestions on the work

The recorded decision, restated: capture only, through the existing audit channel; no
new store, no new route, no card field. The endpoint gate was added on top of that
decision once the premise it rested on turned out to be untrue.

Rejected, and why:

  • A new refused-name store with a response field and card rendering (the issue's
    own three steps). It adds agent-chosen text to the owner's security-decision
    surface, implies a per-file scope the grant does not have, and ships a route that is
    awkward to withdraw.
  • Naming the file only in the error string returned to the agent. The agent passed
    the path in, so it already knows the name; this creates no owner-readable record.
  • Recording the upload gate's refusals through the consent module. It reads
    naturally -- one vocabulary for every refusal -- but it breaks that gate's
    structural guarantee for an audit write needing nothing from the module.
  • Leaving the endpoint ungated and shipping the capture alone. That is the option
    this PR started as, and it is what made the change unsafe rather than neutral.
  • Closing as not worth doing. The delivered-versus-refused asymmetry is a real
    audit gap.

Worth a follow-up, out of scope here: the security event log still has no in-product
reader. A security-event view would make this entry, and every other one already
written, visible to the owner without reading the log file.

Pattern harvest

Rule candidate: review checklist, and a grep-able one for the second half.

Pattern: a change justified by "this channel is already read only by X" without X's
gate being read in code. The capture half of this PR was sound and its premise was
not: the audit log's read route had no identity check at all, so adding a filename to
it widened a cross-principal disclosure instead of informing the owner. The general
form is that an audience claim about an existing surface is a claim about that
surface's authorization code, and is verified there, not from the surface's purpose or
its docstring.

The narrower, mechanical half: a handler under dashboard/handlers that serves
security-audit or credential-adjacent rows and never calls
is_owner_dashboard_request (or the shared owner gate) is worth flagging. Every other
such surface in this tree -- the secrets vault, the delivery-consent endpoints, the
source-provider reads -- routes through that one predicate, which is what made this
endpoint's silence detectable once anyone looked.

Also, but already enforced: adding a call into a function that carries a source-text
structural fence. The existing test caught that within one CI round, so it needs no
new rule.

Closes #9091

@chenmingwei23
chenmingwei23 requested review from a team and pepmach September 24, 2026 08:53
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 7b8310c09a684cf748b612007901d551a15dc5c1 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify no third-party app read GET /api/sel/events under the old app-kit doc's "readable over" advertisement — app-token callers now 403 by design.

[DESIGN-REVIEWED] 7b8310c

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of 7b8310c09a684cf748b612007901d551a15dc5c1 — 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/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The allowed-read audit row rides along with no provenance: the fix is complete without it, and it writes to an append-only log forever.

Not justified as shipped

  • Item 5 — rides along, inherited: its only support is the argued line "a trail carrying only refusals ... never says the log was read" — no linked issue, invariant, or reported defect; the refused-name fix and the owner gate stand without it, and each owner read now permanently appends a sel.events.read: allowed row plus the read-then-audit ordering machinery carried for it.
    Subtraction: delete the log_api_access(outcome="allowed") write and _read_then_audit in handlers/core.py, restoring lambda: _sel().recent(limit=limit).
    Clears when: a linked issue or named incident-review requirement for read-attestation of the security log.
  • Item 8 — rides along: CLI control-byte sanitization; derived harm (agent-chosen names reach the owner's terminal), no premise risk.
  • Item 9 — rides along: forged-row coercion in the CLI renderer; derived (the log is sandbox-writable and recent() validates only dicts).

What this change ships

Inventory (10 items) — 7 justified

Intent: let the owner see which file the credential scanner refused to deliver — a FIX.

  1. A scanner refusal now writes an owner-readable audit entry naming the refused file (seven sites) — justified
  2. GET /api/sel/events now refuses every non-owner caller with 403 (0 frontend consumers counted, grep sel/events in website/) — justified
  3. A pre-owner bootstrap session gets 401 stale_session_reauth instead of a generic 403 — justified
  4. A refused read of the log is itself audited via the shared gate — justified
  5. A successful owner read now writes its own allowed audit row — rides along, inherited requirement (no reported defect)
  6. Download-leg refusal entries say which conjunct refused and name a non-owner caller — justified
  7. kirocrew security events now prints a resources: line naming the refusal subject — justified
  8. CLI event output strips terminal control sequences from every field — rides along; derived terminal-injection harm
  9. CLI survives forged log rows with non-string fields instead of aborting — rides along; derived from sandbox-writable log
  10. sel/app-kit/security-deep-dive docs updated in the same commit — justified

[FIRST-PRINCIPLES-REVIEWED] 7b8310c

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 7b8310c09a684cf748b612007901d551a15dc5c1 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 7b8310c

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 7b8310c09a684cf748b612007901d551a15dc5c1: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 7b8310c09a684cf748b612007901d551a15dc5c1 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 7b8310c

Verdict parsed from the review's SHA-scoped output markers for commit 7b8310c09a684cf748b612007901d551a15dc5c1.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 7b8310c09a684cf748b612007901d551a15dc5c1: <one-sentence reason>

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ⏭️ skipped

Revision 7b8310c09a684cf748b612007901d551a15dc5c1 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 24, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/audit-refused-file-name-9091 branch from 354d440 to 93242bd Compare September 24, 2026 16:03
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 24, 2026
iamwhatever
iamwhatever previously approved these changes Sep 24, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) September 24, 2026 16:57
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Sep 24, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/audit-refused-file-name-9091 branch from 3c84711 to a06fa87 Compare September 24, 2026 18:12
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 24, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/audit-refused-file-name-9091 branch 7 times, most recently from 9010716 to bd8863f Compare September 24, 2026 23:18
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 24, 2026
The credential scanner refuses to deliver a flagged file and records that a
refusal happened, but not WHICH file it held back, so an owner reviewing the
security log can see what left under a grant and not what was stopped. Every
grantable leg now names the refused file in that log through one helper, and the
shared channel-upload gate names it in the tool-invocation entry it already
writes, since its structural guarantee is that it references no consent state.

The download leg's gate has two conjuncts: it honours a grant, but only for the
owner. Its entry now says which one refused and names the requester when another
authenticated principal reached for a file the owner's grant covers, because
audit_decision stamps every refusal "gateway", which is the process and not who
asked. The name composes last: audit_decision clips the detail at 200 characters
and the name is the only field with no length bound, so composed name-first a long
name pushes the reason and the caller off the end.

GET /api/sel/events is now owner-only, and that is the premise of the change
rather than scope growth: the endpoint ran no identity check, so writing refused
filenames into the log would have handed one principal another's audit trail, and
the same hole was already serving main's delivered entries. The denial goes
through _owner_denial_response, the tail every other owner gate shares, so a
session signed before an owner was configured gets 401 stale_session_reauth
instead of a generic 403 -- that caller is the owner, and re-signing in is the
remedy.

Fixes #9091
@chenmingwei23
chenmingwei23 force-pushed the fix/audit-refused-file-name-9091 branch from bd8863f to 7b8310c Compare September 25, 2026 00:26
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 25, 2026
@iamwhatever
iamwhatever merged commit 5555eb3 into main Sep 25, 2026
105 of 151 checks passed
@iamwhatever
iamwhatever deleted the fix/audit-refused-file-name-9091 branch September 25, 2026 05:31
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 25, 2026
wknight1 pushed a commit to wknight1/KiroCrew that referenced this pull request Oct 5, 2026
…irodotdev#13311)

The credential scanner refuses to deliver a flagged file and records that a
refusal happened, but not WHICH file it held back, so an owner reviewing the
security log can see what left under a grant and not what was stopped. Every
grantable leg now names the refused file in that log through one helper, and the
shared channel-upload gate names it in the tool-invocation entry it already
writes, since its structural guarantee is that it references no consent state.

The download leg's gate has two conjuncts: it honours a grant, but only for the
owner. Its entry now says which one refused and names the requester when another
authenticated principal reached for a file the owner's grant covers, because
audit_decision stamps every refusal "gateway", which is the process and not who
asked. The name composes last: audit_decision clips the detail at 200 characters
and the name is the only field with no length bound, so composed name-first a long
name pushes the reason and the caller off the end.

GET /api/sel/events is now owner-only, and that is the premise of the change
rather than scope growth: the endpoint ran no identity check, so writing refused
filenames into the log would have handed one principal another's audit trail, and
the same hole was already serving main's delivered entries. The denial goes
through _owner_denial_response, the tail every other owner gate shares, so a
session signed before an owner was configured gets 401 stale_session_reauth
instead of a generic 403 -- that caller is the owner, and re-signing in is the
remedy.

Fixes kirodotdev#9091
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.

Consent card cannot name the refused file: no owner-readable record exists

2 participants