Skip to content

fix(security): allowed link hosts take DNS names only and audit their use - #18180

Closed
Pearcekieser wants to merge 1 commit into
kirodotdev:mainfrom
Pearcekieser:feat/exfil-operator-trusted-hosts
Closed

Pearcekieser wants to merge 1 commit into
kirodotdev:mainfrom
Pearcekieser:feat/exfil-operator-trusted-hosts

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The allowed link host list holds DNS names only, and every time an allowed host lets a blocked link back on screen the security audit log records it.

The allowed-host list from #12684 accepts IPv4 and bracketed IPv6 literals. The blocked-link card offers "Allow for this host" on a link to 10.0.0.5, and one click relaxes the query-length and base64 checks for that address. The add and revoke routes write SEL events, but nothing records when an allowed host actually restores a link.

Why it matters

An IP literal names one machine, often a loopback or private one where the reader's own control planes run, and an injected reply can aim a long-query link there. The OAuth endpoint extension, the other operator-trusted host list in exfil.py, already refuses IP literals. Without a use event, an operator reviewing the audit log can see that a host was allowed but not whether the allowance ever let a link through.

Not a goal

  • Adding hosts from Settings, or one list for the whole deployment. Those are a separate follow-up.
  • Applying the list outside the dashboard. Slack and other channels unfurl links with no click, and the list only allows a link to be opened on a click.
  • Checking what a host name resolves to. A DNS name that resolves to loopback or a private address, such as 127.0.0.1.nip.io, still passes the shape check. The card shows that name to the reader before they allow it, but nothing here refuses it on the address.
  • Changing which checks an allowed host skips. Credential, encoded-credential, decode-saturation and percent-encoding checks still run for every host.

What changed (motivation → approach → change)

_HOST_RE in redaction_allow.py matched IP literals and accepted any run of [a-z0-9._-]. It is now _OAUTH_EXTENSION_HOST_RE itself, which lives in exfil_oauth.py since the exfil split in #22158, the regex the OAuth endpoint extension already validates its hosts with, so the two operator-trusted host lists share one definition. The OAuth regex itself is unchanged. valid_host also refuses a name whose last label is localhost, because browsers send every *.localhost name to loopback without a lookup (RFC 6761 section 6.3); the refusal sits beside the shared regex, not in it, so the OAuth list's shape does not change. Beside it too, valid_host keeps main's 63-letter cap on the top-level label (MAX_TLD_LEN), because the shared regex leaves that label open-ended. allow_host refuses anything else. An off-shape entry already in hosts.json is dropped on load, so the file can never widen trust past what allow_host writes. The first load of a file in a process that drops entries logs one warning and writes one redaction.allowed_hosts.dropped_invalid SEL event with the exact count and up to 50 {workspace, host, reason} entries, so a narrowed list shows in the audit log.

RedactionCards.tsx carries a copy of that regex and of the .localhost refusal to hide "Allow for this host" when the server would refuse the host, and test_redaction_mirror_parity.py derives the expected copy from the backend regex and checks the suffix against redaction_allow.LOOPBACK_SUFFIX, so the two cannot drift. In Allow's place the card says "Only a host name like example.com can be allowed. Use “Open once” instead." The wording covers every host the list refuses, an underscore name as well as an IP literal. Before this change the button was offered for an IP-literal host.

restore_allowed_links in exfil.py now writes one redaction_allowed_host_used SEL event per workspace and host per process when it puts a link back. It and the OAuth extension's use event write through one shared helper, _log_operator_list_use in exfil_oauth.py, and _PACKAGE_LINE_BUDGET in test_security_gate_liveness.py rises by 197 lines over main's value to record the growth, from 32,616 to 32,813 on head 1415978. The event names the workspace, the host and the rules relaxed. The workspace comes from the render's scoped_exempt_hosts scope, which the three render paths now open with the slot's stored workspace key, and a revoke forgets the host and bumps an epoch that wire_render._context_digest hashes with the scoped workspace, so a memoized history render misses once and the host's next use after a re-allow is audited again. One lock, _ALLOWED_HOST_AUDIT_LOCK, guards the memo and the epoch, so a revoke iterating the memo cannot race a render adding to it. Each render path reads allowed_host_audit_epoch() before allowed_hosts_for and passes it to scoped_exempt_hosts. If a revoke lands between that read and the audit, the epoch no longer matches under the lock, so the render's use is audited but not remembered, and the first use after a re-allow is still audited. The render memo key hashes the same scoped epoch. The save-time display-verdict projection in display_verdicts.project renders every saved row in the background to store its verdicts, and it runs under allowed_host_use_unaudited, so a render nobody reads writes no event and leaves the memo free for the reader's first real view. It follows _emit_oauth_extension_used_event: deduped per process, best-effort, and a failed write never blocks the restore. The dedupe memo holds at most _ALLOWED_HOST_AUDITED_MAX = 1024 workspace and host pairs. Past that, a new pair is audited on every restore and not remembered, so revoked hosts cannot grow it; test_the_audit_memo_stops_growing_at_its_ceiling covers both sides.

The security argument is that this change only narrows what the list accepts and only adds audit records. No URL that was blocked before is let through. docs/system-specs/modules/security.md documents the host shape and the new event.

Backwards compatibility

Breaking: an IP-literal, underscore or *.localhost host saved in <config>/redaction-allow/hosts.json is no longer honoured, so links on it show as blocked again. Writer sweep on origin/main @ 8625baa: allow_host is the only writer, reached only from api_redaction_allow_host, which validates with the same valid_host. A dropped entry is never honoured and Settings does not list it, and the load that drops it writes the redaction.allowed_hosts.dropped_invalid SEL event and a warning. revoke_host cannot target it, because it works from the filtered snapshot and returns False for a host that is not there. The entry stays as dead bytes in hosts.json until the next allow or revoke in any workspace, which rewrites the file from the filtered snapshot and removes it.

Release notes should say that a link host saved as an IP address, with _ in its name, or under .localhost is no longer allowed, and that the reader can use "Open once" or allow a DNS name for that machine instead.

Reader: src/kiro_crew/security/redaction_allow.py:allowed_hosts_for -- chat -- returns only valid hosts; test_a_dropped_entry_left_in_the_file_is_logged_and_audited_once
Reader: src/kiro_crew/security/redaction_allow.py:list_allowed -- crew page -- Settings list shows only kept hosts; same test
Reader: src/kiro_crew/dashboard/handlers/redaction.py:api_redaction_allow_host -- crew page -- returns 400 invalid_host for an IP literal; test_ip_literals_ports_and_wildcards_are_refused

Tests

  • test_ip_literals_ports_and_wildcards_are_refused covers 13 off-shape hosts: IPv4, IPv6, IPv4-mapped IPv6, a port, a wildcard, leading and trailing hyphens, an underscore, an empty label, a bare name and two *.localhost names. Each is refused by valid_host and allow_host.
  • test_a_dropped_entry_left_in_the_file_is_logged_and_audited_once checks that a hand-edited file with an IP literal, a .localhost name and a number keeps only its DNS entry, and that the load writes one warning and one SEL event naming all three with their reasons, not repeated when a write re-reads the file.
  • test_restoring_an_allowed_link_is_audited_once_per_host checks that an unlisted host logs nothing, that three restores in one workspace log one event with the workspace, host and rule, that the same host in a second workspace logs its own event, and that a revoke makes the next use log again.
  • test_a_re_allow_after_a_revoke_misses_the_memo_and_audits_again renders through wire_render.prepare_messages_json and checks one event per workspace, a memo hit on the second render, and a fresh event after a revoke. It fails on the previous head.
  • test_a_save_projection_audits_no_allowed_host_use runs display_verdicts.project on a row with an allowed link and checks it writes no event, then that the reader's render writes one. It fails without allowed_host_use_unaudited.
  • test_a_render_whose_snapshot_predates_a_revoke_is_not_remembered takes the epoch and hosts, revokes, then restores under that stale scope. It checks the link is shown and audited with the memo left empty, and that the first view after a re-allow is audited and remembered. It fails without the epoch check.
  • test_a_failing_audit_does_not_stop_the_restore checks that a raising audit log still restores the link.
  • MarkdownRenderer.blockedLink.test.tsx checks that cards for 10.0.0.5, [::1], my_box.corp.example and api.localhost render no Allow button and show the host-name hint, and that a DNS-host card shows no hint.
  • test_blocked_link_card_offers_allow_only_for_hosts_the_server_accepts pins the frontend regex and .localhost suffix to the backend ones.

Manual verification

website/scripts/capture-blocked-link-allow-host.mjs drives the built SPA with fixtures: one reply holds a blocked link on reviews.corp.example and one on 10.0.0.5. On main both cards had one Allow button. On this branch the DNS card has one, and the IP card has none and shows the host-name hint instead, in dark and light themes.

Screenshots / video

On main, the IP-host card offers Allow:

before, IP host

On this branch, the IP-host card has no Allow and says why:

after, IP host

after, IP host, light

On this branch, the DNS-host card keeps Allow:

after, DNS host

after, DNS host, light

Related Issues

Follows #12684.

Follow-up: Pearcekieser/KiroCrew#52 tracks a Settings note when a load drops saved hosts. Pearcekieser/KiroCrew#53 tracks writing the use audit when a background-filled fragment is first served rather than when it is rendered, from the GPT 6.1 finding on bc6fe06. Upstream issues here open together with their PR, so the upstream issue opens with that PR.

Pattern harvest

Rule candidate: review-prompt
Pattern: an operator-trusted host list whose host regex accepts IP literals or loose character runs instead of the shared DNS-name shape

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • 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

Fixes #18179

@Pearcekieser
Pearcekieser requested review from a team and KiroCrewCaptain as code owners October 8, 2026 16:41
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of eb3dd59ead53e8b950c7f4a7a3259b9a19594a2f via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. The change only narrows what the allowed-host list accepts and only adds audit records. Every reader of valid_host outside the patch still works, and the patch includes committed screenshots of the card.

Notes

  • The revoke route at dashboard/handlers/redaction.py:102 now returns 400 invalid_host for an IP literal. Nothing breaks, because a dropped entry never reaches the Settings list. Still, the Reader: list could name this route.
  • The use audit adds a revoke epoch, a context flag, a memo ceiling and a lock, all to dedupe a best-effort event. That is about 200 lines of extra code in the security package. A simpler option is to drop the epoch and accept one missed re-audit when a revoke races a render. If more bookkeeping is ever needed, that option should be weighed first.

[DESIGN-REVIEWED] eb3dd59

Description read

[DESCRIPTION-READ] 56f4b5aee5adcaf2cf2331580da5bffdbc92f745b798acbc62259da298182967

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

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of eb3dd59ead53e8b950c7f4a7a3259b9a19594a2f via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The committed screenshots show the new "Only a host name like example.com can be allowed" line in light and dark, and the before and after states. No blind reader has read them, because this is the fork lane.

Notes

  • If someone already allowed an IP or *.localhost host, it now drops out of Settings without a word, and only the warning log and the audit log record it. Their links go back to blocked, and they only find out why when they open a link's card. The card's line is a good place to say what changed: "IP addresses and .localhost names can no longer be allowed. Use “Open once” instead."

[UX-REVIEWED] eb3dd59

Description read

[DESCRIPTION-READ] 823275d5a42f55f6ebfc2031447ece66cf05cff0995daea0e25d0dfb5bf857fa

That sha256 names everything this verdict read: the PR description, plus the 8 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

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings (all downgraded on adjudication)

Reviewed eb3dd59ead53e8b950c7f4a7a3259b9a19594a2f via the fork AI-review pipeline; updated in place on each push.

Opus 5.5 adjudication downgraded every blocking finding. Downgraded: the remedy each one needs is disproportionate to the harm it prevents. Adjudication downgraded all 1 blocking finding(s): the remedy each one requires is disproportionate to the harm it prevents.

Review details

BLOCKING -- src/kiro_crew/security/exfil.py:1040 -- Background memo fills audit links never displayed (origin: validation)

_emit_allowed_host_used_event(domain, records)
Trigger: After restart, open a transcript containing an allowed host’s blocked link while the host list is loading. The first response shows the placeholder; once loading completes, api_chat_slot_detail → wire_render.schedule_fill → prepare_messages_json → restore_allowed_links restores it in a background render whose result is discarded.
Outcome: SEL records an allowance use that never reached the reader and fills the dedupe memo, suppressing the event when the restored link is first actually served.
Anchor: defect
Fix: Exclude rows requiring allowed-link restoration, including variants, from background memo fills so restoration and its audit occur on an actual serve.
[BLOCK-MERGE-DOWNGRADED] eb3dd59
[GPT-REVIEWED] eb3dd59

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 — LOW. The conditions all check out in the code. The allow list is empty until it loads (src/kiro_crew/security/redaction_allow.py:111-116). The fill re-renders the same rows about a second later with its result thrown away (src/kiro_crew/dashboard/wire_render.py:361-403, called at src/kiro_crew/dashboard/chat_api/slot_detail.py:1423-1426). That render calls restore_allowed_links, which writes the event and records the (workspace, host) pair (diff exfil.py:1038-1040, :1255-1265). The next real serve then reuses the cached row, so it restores nothing and writes no event (wire_render.py:320-323).

The use is still audited: one redaction_allowed_host_used event exists for that workspace and host, and it arrives one fill delay before the link actually appears. Writing an event slightly early is the safe direction, nothing a reader sees goes unaudited, and the record stays correct on the next revoke and re-allow. The real fix would add a mechanism just for this path: a per-row "needs restoration" check inside the fill, or a flag carried through the cached render, on a path every history load uses. That costs more than a slightly early audit timestamp.

[ADJUDICATION] eb3dd59ead53e8b950c7f4a7a3259b9a19594a2f total=1 uphold=0 downgrade=1
DOWNGRADE F1 src/kiro_crew/security/exfil.py:1040 reason=disproportionate-remedy
[GPT-ADJUDICATED] eb3dd59ead53e8b950c7f4a7a3259b9a19594a2f

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of eb3dd59ead53e8b950c7f4a7a3259b9a19594a2f via the fork AI-review pipeline — 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

Every item answers part of the frozen Goal. Two pieces of the use-audit dedupe go further than the Goal needs.

Notes

  • Item 6 — oversized: three render paths now read the epoch before the hosts, and the render memo key gains a workspace and an epoch. All of it closes a race the Goal never names ("a render in flight across a revoke"), and the race costs at most one missed dedupe entry on a host that was re-allowed. Subtraction: delete _SCOPED_AUDIT_EPOCH, current_scoped_audit_epoch, the epoch parameter of scoped_exempt_hosts and the fresh check in _emit_allowed_host_used_event. Keep forget_allowed_host_use as a plain discard. Clears when: the mechanism is removed, or a human amends the Goal.
  • Item 7 — oversized: _ALLOWED_HOST_AUDITED_MAX = 1024 exists "so revoked hosts cannot grow it". But revoke_host already calls forget_allowed_host_use, so a revoked host leaves the memo. Every entry is a stored (workspace, host) pair, already capped by MAX_HOSTS_PER_WORKSPACE × MAX_WORKSPACES. Subtraction: delete the ceiling, its branch and test_the_audit_memo_stops_growing_at_its_ceiling.

What this change ships

Inventory (10 items) — 8 justified

Intent: stop an operator from allowing a link host that names one machine, such as an IP or loopback address, and record in the audit log each time an allowed host puts a blocked link back on screen. This is a FIX (narrowing) plus an ADDITION (the audit).

  1. "Allow for this host" refuses IP literals, ports, underscores and *.localhost names — justified
  2. Off-shape hosts already saved in hosts.json stop being honoured on load — justified
  3. A load that drops entries logs a warning and writes a dropped_invalid SEL event — justified
  4. The card hides Allow for a refused host and shows the "Only a host name…" line (14 locales) — justified
  5. A new redaction_allowed_host_used SEL event fires on the first restore per workspace and host — justified
  6. Revoke epoch, staleness check on old snapshots, and workspace and epoch in the render memo key — oversized: closes a race outside the Goal
  7. 1024-entry ceiling on the use-audit memo — oversized: the store caps and the forget-on-revoke already bound it
  8. The save-time verdict projection writes no use event — justified
  9. The OAuth extension's use event moves onto the shared _log_operator_list_use — justified
  10. Package line budget raised; screenshots and capture script added — justified

[FIRST-PRINCIPLES-REVIEWED] eb3dd59

Description read

[DESCRIPTION-READ] ca2f96dadd3717a29223bc1f3e49eb0746d6bf89827bafc3b589c86d50e91bd4

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

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed eb3dd59ead53e8b950c7f4a7a3259b9a19594a2f via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] eb3dd59

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review (fork) — ✅ PASS

Which legitimate operations does eb3dd59ead53e8b950c7f4a7a3259b9a19594a2f newly refuse? Model proposes, scripts/deny_diff.py decides — updated in place on each push. A script-confirmed regression blocks PR readiness.

adjudicated, zero confirmed regressions

Scope-Verdict: PASS

Reason: The change tightens the dashboard's allowed-host validator, which the shell deny composite never reads, so none of the 14 shell candidates should flip. No script verdict is attached to this review, so this does not claim any were measured. The validator now refuses IP literals, ports, underscores, overlong top-level labels and *.localhost names, and drops stored entries of those shapes on load. No verdict is available for that guard, so it is named under UNADJUDICATED. Nothing here shows the refusal goes beyond its stated threat.

TIGHTENING: the redaction allow-list host validator (redaction_allow._HOST_RE / _refusal) -- refuses an allowed host that names one machine, often the reader's loopback or a private address, rather than a site: -_HOST_RE = re.compile(r"^(?:[a-z0-9._-]{1,253}\.[a-z]{2,63}|\d{1,3}(?:\.\d{1,3}){3}|\[[0-9a-f:.]{1,45}\])$") → +_HOST_RE = _OAUTH_EXTENSION_HOST_RE plus + if host.endswith(LOOPBACK_SUFFIX): return "loopback_name", applied on add and on _load (entries are dropped and audited as redaction.allowed_hosts.dropped_invalid).

ADJUDICATED: 14 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: posix and windows rows. The diff changes no shell-side path, separator, executable or environment assumption. Its only platform-relevant code is in Python and TS and does not depend on the host OS. The rows probe the shell exfil tier: posix curl against IP, *.localhost and DNS hosts with queries, and windows curl.exe and Invoke-WebRequest. Further rows cover maintainer test runs in both .venv/bin/python and .venv\Scripts\python.exe form, kirocrew manifest --url / kirocrew.exe manifest --url, and the SEL log read. No row is any, because every row names an executable or path. No assumed platform was left unprobed.

UNADJUDICATED: Guard: redaction_allow._refusal (through valid_host, allow_host and _load), mirrored in the browser by RedactionCards.tsx isAllowableHost. Call path: the dashboard card's Allow for this host → POST /api/redaction/allowed-hosts {slot, host} (require_owner_dashboard_request) → redaction_allow.allow_host → valid_host → 400 invalid_host. Separately, on any read, list_allowed / allowed_hosts_for → _load silently drops non-matching stored entries, so links on those hosts show as blocked again. Legitimate inputs I would have submitted but could not get a verdict for:

  • 10.0.0.5 and 192.168.1.20: a lab or internal server reached by IP. Previously accepted; now refused, and dropped from existing lists on load.
  • git.example.com:8443: already refused at base by the old regex.
  • build_box.corp.example: an internal host with an underscore. Previously accepted; now refused.
  • api.dev.localhost: a local dev service. Previously accepted; now refused.
  • A single-label intranet name such as wiki: refused at base and at head.

In each newly refused case the reader still has Open once, which the new link_allow_unsupported text points to. Only the persistent per-workspace relaxation is lost. That is the threat the change names (a loopback or private machine), not an operation beyond it. One narrowing note, not a confirmed regression: underscore hostnames (non-RFC 1123 but seen on some corporate DNS) are caught by the shared regex, although they are not a loopback or IP shape. Existing stored entries of that shape will be dropped on upgrade, with the dropped_invalid SEL event as the only record. Also not adjudicable: the new allowed_host_use_unaudited / epoch context vars and the _context_digest memo-key change. These alter audit and caching only, not any redaction verdict.

[SCOPE-REVIEWED] eb3dd59

Security scope review -- adjudicated candidates

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

No candidate flipped from allowed to refused.

@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 Oct 8, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

issue (fixed): one regex now defines the operator-trusted DNS-host shape

Fixed in 0b7beb5. redaction_allow._HOST_RE is now exfil._OAUTH_EXTENSION_HOST_RE itself, imported rather than copied, and the second definition is gone. The 63-character label cap moved into that one regex, so OAuth extension hosts get it as well. exfil.py does not import redaction_allow, so the import adds no cycle. The 1364 tests in test_security.py, test_redaction_allow.py and test_redaction_mirror_parity.py pass on the new head.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

suggestion (fixed): the card's host regex is pinned to the backend one

Fixed in 0b7beb5. test_blocked_link_card_offers_allow_only_for_hosts_the_server_accepts in test/test_redaction_mirror_parity.py builds the expected JavaScript literal from redaction_allow._HOST_RE.pattern at run time and compares it with ALLOWABLE_HOST_RE in RedactionCards.tsx. A change to either copy alone now fails the test.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

issue (fixed): the IP-host card now explains the missing Allow

Fixed in 0b7beb5. A card whose host the list refuses shows "Only a host name can be allowed, not an IP address. Use Open once." in the place where Allow would sit, translated into all 12 locales. This also covers a reader whose saved IP host was dropped on load, because their next blocked link on that host shows the same line. The updated light and dark stills are in the PR body.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

suggestion (fixed): one line under the buttons says what happened and what to do

Fixed in 0b7beb5 with the wording the review suggested, adjusted to name the rule: "Only a host name can be allowed, not an IP address. Use Open once." MarkdownRenderer.blockedLink.test.tsx checks that the line appears on 10.0.0.5 and [::1] cards and not on a DNS-host card.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note: Sensitive Change Review needs a maintainer takeover

This PR changes src/kiro_crew/security/exfil.py and src/kiro_crew/security/redaction_allow.py, and the gate reports that a fork PR cannot pass it. The change only narrows what the allowed-host list accepts and adds audit events, so no link that was blocked before is let through. Could a maintainer take it over on a branch of this repository, as the gate describes? The current head is 0b7beb5, and it answers the First Principles, UX and Design findings from the previous round.

@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 Oct 8, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note: the two Integration (in-process gateway) failures on 0b7beb5 are outside this diff

The diff touches the redaction allow list, exfil.py, the blocked-link card, locales and docs. Neither failing test reaches those files.

  1. test_owner_only_boot.py::test_a_fresh_boot_leaves_nothing_readable_by_others reported an autonudge outbound spool file at mode 0644. Run locally against a detached origin/main worktree at 72b8d28, the same test fails the same way, this time on gateway.log at 0644. It is inherited from main and does not come from this PR.
  2. test_script_cron_sessions.py::test_a_cron_key_cannot_seed_the_owners_slot failed because a boot task _eager_spawn did not end within 10 s of cancellation. That is a teardown timing failure in cron session boot. It passes locally on this head.

No code change is needed for either. The maintainer takeover requested above will rerun CI on the repository branch.

@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 Oct 8, 2026
@Pearcekieser
Pearcekieser force-pushed the feat/exfil-operator-trusted-hosts branch from 0b7beb5 to 63d2160 Compare October 9, 2026 01:30
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

issue (fixed): the hint now gives a reason that is true for every refused host

Fixed in 63d2160. The old line said "not an IP address", which was wrong for a refused name such as my_host.corp.example. It now reads "Only a host name like example.com can be allowed. Use "Open once" instead." in all 12 locales. MarkdownRenderer.blockedLink.test.tsx checks the line on 10.0.0.5, [::1] and my_host.corp.example cards and its absence on a DNS-host card. The light and dark stills in the PR body show the new text.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

suggestion (fixed): the hint quotes the button name

Fixed in 63d2160. The hint names the button as "Open once" in quotes, so it reads as the label on the card rather than an instruction. Each locale quotes its own translated button label with that locale's quote marks, and the i18n strings and key-ref checks pass.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

nitpick (fixed): isAllowableHost is no longer exported

Fixed in 63d2160. The function is only called inside RedactionCards.tsx, so the export is gone. The parity test reads ALLOWABLE_HOST_RE from the source text and does not import the function, and tsc passes.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

thought (non-blocking): the hint text is staying as it is in this PR

This is the third round of wording changes to the same line, so I am stopping here instead of patching it again. The current line, "Only a host name like example.com can be allowed. Use "Open once" instead.", is true for every host the list refuses, and the Inspect panel above it shows the host. A name containing _ is not a valid DNS host name, so "a host name like example.com" excludes it. Naming each refused shape (IP literal, port, wildcard, _) would need a longer line in 12 locales. If a reader study shows the line confuses people, a follow-up can split it per shape.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

thought (non-blocking): rewriting hosts.json on the first load that drops an entry; folded into Pearcekieser#52

Design Review passed on 6e2cf6d and noted that a dropped IP-literal entry stays as bytes in hosts.json until the next allow or revoke rewrites the file. The Backwards compatibility section states this: the entry is never honoured, Settings does not list it, and the load that drops it writes the redaction.allowed_hosts.dropped_invalid SEL event. Rewriting on load would turn a read path into a write path, which is a bigger change than this PR. #52 already handles dropped entries in Settings, so I added the load-time rewrite there as an option. No push for this note.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as 561d209, no behaviour change

The only conflict was _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py again. Main's budget is 32,613 as of 2356a1b, and this PR adds 197 lines, so the merged value is 32,810 with both comments kept. The package counts exactly 32,810 lines on this head. git range-diff against 6e2cf6d shows only that line, and 205 tests across the PR's test files and the test_exfil* files pass locally. The PR body gives the same figures.

@cruisercohen

Copy link
Copy Markdown
Contributor

@iamwhatever could you re-review 561d209 and clear the 10-21 change request?

Your r124 hold on db84a34 (10-24) found the r117 points handled. Since then the head has only been rebased onto main. I checked git range-diff of db84a34 against 561d209: the only changed hunk is the _PACKAGE_LINE_BUDGET pin in test/test_security_gate_liveness.py (main's newer budget plus this PR's 197 lines, now 32,810). No code or test logic changed.

After that, what is left is your r124 items 1 and 2, which only a maintainer can do: a human security review, and carrying the change on a repository branch so Sensitive Change Review can pass.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): Security Scope Review red on 561d209 is the lane's own failure, not a finding

The check run reads [scope-floor:unsettled] ... no leg reported, and this was not the nothing-to-adjudicate short circuit, and says no leg produced confirmed rows. The same lane failed the same way on 093c64d and passed on its same-tree retrigger ba05164 with Scope-Verdict: PASS, 0 confirmed regressions. This head differs from that one only by the _PACKAGE_LINE_BUDGET pin. I am not pushing a retrigger now, because cruisercohen has asked for a re-review of this exact head, and a maintainer carry would replace it anyway.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): Backend Tests (3.12, 4) red on 561d209 does not reproduce on main merged with this PR

The two failures are test/test_telegram_dispatcher.py::TestABusyReplyCarriesItsContext cases expecting one telegram_reply_parent audit (assert [] == ['telegram_reply_parent']). That class is new on main and not in this head, so CI ran it on the merge commit. Locally all 7 tests in the class pass on current main 5285bc2 alone and on the merge of 5285bc2 with 561d209. This PR changes no telegram code. No push for it.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as 7c293e3, no behaviour change

The only conflict was _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py again. Main's budget is 32,616 as of 561b345, and this PR adds 197 lines, so the merged value is 32,813 with both comments kept. The package counts exactly 32,813 lines on this head. git range-diff against 561d209 shows only that line, and 205 tests across the PR's test files and the test_exfil* files pass locally. The PR body gives the same figures.

@iamwhatever this replaces 561d209, the head cruisercohen asked you to re-review. The patch is unchanged apart from that budget line.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): Backend Lint & Type Check red on 7c293e3 is a main defect already fixed on main

The one error is src/kiro_crew/publish_governance.py:299:57: F821 undefined name 'lists_checked_by_caller'. This PR does not touch that file; CI ran lint on the merge with main at a point where main itself had the undefined name. Main's #24767 (2349543, "pass lists_checked_by_caller to session check") fixed it, and flake8 --select=F821 is clean on that file at current main aeb5c02. Coverage Gate fails only because lint did. GPT 6.1 Review found nothing on this head. No push for it alone.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as 1415978 to pick up #24767, no behaviour change

Backend Lint & Type Check failed on 7c293e3 on publish_governance.py:299:57: F821 undefined name 'lists_checked_by_caller', a main defect that main's #24767 (2349543) fixed. This head sits on main aeb5c02, which includes that fix. The rebase applied with no conflict, git range-diff against 7c293e3 shows no change to this PR's patch, the line budget stays 32,813, flake8 is clean on publish_governance.py and the PR's security files, and 205 tests across the PR's test files and the test_exfil* files pass locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): Backend Tests (3.12, 2) red on 1415978 is a main defect

The one failure is test/test_crew_log_fullscan_guard.py::test_a_warm_session_read_that_earns_a_savepoint_reads_only_the_gap, reported as [XPASS(strict)]: the test is marked strict xfail for a savepoint-write bug in crew_log/projection_session_memo.py, and it now passes. This PR touches neither file. The same test fails the same way locally on a clean checkout of main 2ec42c9 and of this PR's base aeb5c02, so the fix that landed on main left the strict marker in place. Shard 2 otherwise ran 31,412 passed. No push from this side; a rebase will pick up whichever main commit drops the marker.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as fa32b2b, no behaviour change

Main raised _PACKAGE_LINE_BUDGET to 32,635 for the rm floor's segment walk, which conflicted with this PR's budget line. The resolution keeps main's comment and adds this PR's unchanged 197, giving 32,832. git range-diff against 1415978 shows only that context line. The new base also drops the strict xfail behind the shard 2 red noted above, and 215 tests across this PR's test files, the test_exfil* files and test_crew_log_fullscan_guard.py pass locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as d5d2e63, no behaviour change

Main raised _PACKAGE_LINE_BUDGET to 32,643, which conflicted with this PR's budget line. The resolution keeps main's comment and adds this PR's unchanged 197, giving 32,840. git range-diff against fa32b2b shows only that budget line, and 205 tests across this PR's test files and the test_exfil* files pass locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as c59ea20, audit emit moved into #20487's restore loop

Main's #20487 rewrote restore_allowed_links so a host's placeholders pair with its records by order and are read back until every restored address is exactly the link that starts where it lands. This PR's only change to that function is the redaction_allowed_host_used emit behind _AUDIT_ALLOWED_HOST_USE. The resolution keeps main's loop unchanged and emits once per restored host on its success return, over domains, in place of the old address map. A host that fails the read-back is dropped before that return, so it writes no use event.

The spec line keeps main's new restore wording and adds this PR's host-shape sentence unchanged. The line budget becomes main's 32,668 plus this PR's 197, giving 32,865. git range-diff against d5d2e63 shows those three changes and nothing else. Flake8 is clean on exfil.py, and 696 tests pass locally across this PR's test files, the test_exfil* files and the test files #20487 touched.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as 5a4ed26, no behaviour change

Main raised _PACKAGE_LINE_BUDGET to 32,793, which conflicted with this PR's budget line. The resolution keeps main's comment and adds this PR's unchanged 197, giving 32,990. git range-diff against c59ea20 shows only that budget line, and 292 tests across this PR's test files, the test_exfil* files and test_redaction_blocked_links.py pass locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

thought (non-blocking): the exfil.py size note and the GPT background-fill finding on 5a4ed26 both go to fork #53

The Opus note is right that this PR grows src/kiro_crew/security/exfil.py by 111 net lines, to 1,966. Most of that growth is the allowed-host use-audit memo, its revoke epoch and the lock it shares with a revoke. Fork #53 moves that audit from render time to the delivery point. Once the audit happens at delivery, the memo, epoch and lock no longer belong in exfil.py, so the split lands there instead of being moved twice.

The GPT 6.1 finding, a background fill after restart recording a link nobody viewed, is the same path answered in 6364571821 and tracked in #53. Adjudication downgraded it again on this head.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): Security Scope Review on 5a4ed26 failed with no verdict, not a regression

The check reports [scope-floor:unsettled] no leg reported, so the review lane never produced a verdict, and GitHub refuses a retry of run 40729155982. The same lane passed with zero confirmed regressions on d5d2e63. Since then this PR's patch has changed in two places: c59ea20 moved the redaction_allowed_host_used emit into #20487's read-back loop, which the GPT and Opus lanes passed, and 5a4ed26 changed only _PACKAGE_LINE_BUDGET. Neither touches a deny path. Backend Lint & Type Check and Frontend Lint & Type Check were cancelled at their 25 and 20 minute job caps, Coverage Gate failed closed behind them, and I have re-run those jobs.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as 6ce301a, no behaviour change

Main raised _PACKAGE_LINE_BUDGET to 32,798, which conflicted with this PR's budget line. The resolution keeps main's comment and adds this PR's unchanged 197, giving 32,995. git range-diff against 5a4ed26 shows only that budget line, and 292 tests across this PR's test files, the test_exfil* files and test_redaction_blocked_links.py pass locally.

@bolichen97

Copy link
Copy Markdown
Contributor

@iamwhatever the first two points of your change request look addressed at the current head 6ce301a. The in flight render race is fixed in this PR: a render now carries the revoke epoch it read, a stale scope is audited but not remembered, and a new test covers it. The Settings note for dropped hosts is tracked in a separate issue linked in the description. That leaves your third point, the manual security review of the redaction exemption change, since the fork cannot pass that check on its own. Could you do that review now, or say how you would like it carried?

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as e0e0198, no behaviour change

Main raised _PACKAGE_LINE_BUDGET to 32,799, which conflicted with this PR's budget line. The resolution keeps main's comment and adds this PR's unchanged 197, giving 32,996. git range-diff against 6ce301a shows only that budget line, and 292 tests across this PR's test files, the test_exfil* files and test_redaction_blocked_links.py pass locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): Security Scope Review on e0e0198 has no verdict, not a regression

The check reports [scope-floor:unsettled]: the fork lane's generate job did not finish, so no leg ran. The same lane passed with zero confirmed regressions on 6ce301a, and e0e0198 differs from it only in _PACKAGE_LINE_BUDGET, so there is nothing new for it to judge. Same case as the earlier note on 5a4ed26.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as 953790e, no behaviour change

Main raised _PACKAGE_LINE_BUDGET to 32,802, which conflicted with this PR's budget line. The resolution keeps main's comment and adds this PR's unchanged 197, giving 32,999. git range-diff against e0e0198 shows only that budget line, and 292 tests across this PR's test files, the test_exfil* files and test_redaction_blocked_links.py pass locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as 635749d, no behaviour change

Main raised _PACKAGE_LINE_BUDGET to 32,909, which conflicted with this PR's budget line. The resolution keeps main's comment and adds this PR's unchanged 197, giving 33,106. git range-diff against 953790e, the last pushed head, shows only that budget line, and 292 tests across this PR's test files, the test_exfil* files and test_redaction_blocked_links.py pass locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): Security Scope Review on 635749d has no verdict, not a regression

The check reports [scope-floor:unsettled]: the fork lane's generate job did not finish, so no leg ran. This is the same lane failure as on 5a4ed26 and e0e0198. The lane last reached a verdict on 6ce301a, a pass with zero confirmed regressions. Since then this PR's patch has changed only _PACKAGE_LINE_BUDGET. Internal Content Scan, re-run after a runner timeout, is now clean on this head.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as b7bde95, no behaviour change

Main raised _PACKAGE_LINE_BUDGET to 32,970, which conflicted with this PR's budget line. The resolution keeps main's comment and adds this PR's unchanged 197, giving 33,167. git range-diff against 635749d shows only that budget line, and 292 tests across this PR's test files, the test_exfil* files and test_redaction_blocked_links.py pass locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): Opus 5.5 Review and Internal Content Scan on b7bde95 have no verdict, not findings

Opus 5.5 Review reports "review incomplete" and Internal Content Scan reports "NO VERDICT, the scan did not run to completion", so neither lane judged this head. On 635749d both reached a verdict: Opus found nothing and the content scan was clean. b7bde95 differs from that head only in _PACKAGE_LINE_BUDGET. I am not pushing a retrigger, since this PR is waiting on the manual security review and a carry, and a carry runs every lane again.

… use

The allowed-host list accepted IPv4 and bracketed IPv6 literals and
underscores. An address names one machine, often a loopback or private
one, rather than a site the reader vouches for. The host check now takes
lowercase DNS names with a letter TLD only; an off-shape entry already in
the file is dropped on load, and the blocked-link card offers no Allow for
such a host.

Adds and revokes were audited, use was not. restore_allowed_links now
writes one redaction_allowed_host_used SEL event per host per process
when an allowed host puts a blocked link back on screen.

Also: one DNS-host regex for both operator lists; explain a missing Allow.

The allowed-link-host list now validates against exfil._OAUTH_EXTENSION_HOST_RE,
unchanged from main, instead of its own copy, and also refuses *.localhost
names, which browsers send to loopback without a lookup (RFC 6761 6.3). The
refusal sits in valid_host and the card's isAllowableHost, so the OAuth list's
shape is unchanged. A parity test pins the card's copy of both. A card whose
host the list refuses says why where Allow would sit.

A load that drops saved entries now logs one warning and writes one
redaction.allowed_hosts.dropped_invalid SEL event per file per process. The
use event names the render scope's workspace and its memo is keyed by
(workspace, host); a revoke forgets the host and bumps an epoch the
render memo keys on, so a re-allowed host is audited again. One lock guards
that memo, so a revoke and a render cannot race on it. Both operator-list events share
one SEL helper, the per-process audit memo has a count ceiling, and the
security package line budget records the growth.

After the exfil split in kirodotdev#22158, the shared SEL helper _log_operator_list_use
lives in exfil_oauth beside the OAuth use event, and the facade imports it.

The save-time display-verdict projection restores links under
allowed_host_use_unaudited, so a render nobody reads writes no use event
and leaves the memo for the reader's first real view.

Allowed link hosts keep the 63-letter cap on the top-level label, beside
the shared regex, as the list did before it shared that regex.
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): rebased on main as eb3dd59, no behaviour change

Main raised _PACKAGE_LINE_BUDGET to 33,147, which conflicted with this PR's budget line. The resolution keeps main's comment and adds this PR's unchanged 197, giving 33,344. git range-diff against b7bde95 shows only that budget line, and 292 tests across this PR's test files, the test_exfil* files and test_redaction_blocked_links.py pass locally.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed head eb3dd59 against b7bde95 with range-diff. This is a rebase only:

  • _PACKAGE_LINE_BUDGET is 33,344, which is main's 33,147 plus this PR's unchanged 197.
  • The exfil.py import hunk only differs in context, because main now imports Any beside TYPE_CHECKING.
  • No other hunk of this PR changed, and I found no new issue in the delta.

Status of the open request for changes:

  • Point 3 still applies on this head and cannot be cleared by a push from the fork. The PR changes which hosts are exempt from redaction, and Sensitive Change Review still fails because a fork PR cannot pass it. This needs a maintainer decision on carrying it on a repository branch, plus a human security approval.
  • The merge conflict label is stale: GitHub reports this head as mergeable.

No approval from me, because of point 3.

@bolichen97

Copy link
Copy Markdown
Contributor

This change is now carried on a repository branch in #26736, so the required Sensitive Change Review check can run there. Thank you @Pearcekieser: the commit is your head eb3dd59 cherry-picked onto current main, with you as Co-authored-by:. The only conflict was the _PACKAGE_LINE_BUDGET line, which keeps main's comment and adds your unchanged 197 lines.

@iamwhatever, could you review #26736? Point 1 of your request is fixed in the carried code, point 2 is linked under Related Issues, and point 3 is why the new PR exists. It still needs a second maintainer approval and a human security review.

This PR stays open until #26736 lands.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): closing in favour of #26736, which merged this change

#26736 merged on 2026-10-31 as 817316f. git range-diff against this PR's head eb3dd59 shows the same patch, apart from the _PACKAGE_LINE_BUDGET line, which carries this PR's unchanged 197 on main's newer value. Thank you @bolichen97 for the carry and @iamwhatever for the review. The two follow-ups linked in the description, the Settings note for dropped hosts and the audit at the delivery point, will come as their own PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allowed link hosts accept IP literals, and their use is never audited

4 participants