Skip to content

security(confirmations): exact-name owner allowlist for intent settling - #76

Merged
ThinkOffApp merged 3 commits into
mainfrom
feat/owner-allowlist-port
Aug 28, 2026
Merged

ThinkOffApp merged 3 commits into
mainfrom
feat/owner-allowlist-port

Conversation

@ThinkOffApp

Copy link
Copy Markdown
Owner

Ports the Mini fork's approval guard into main — THI-27, reviewed in principle by codexmb (2026-08-27) before this PR existed; requesting his adversarial pass on the actual diff now.

What changes

  • Authorization = exact membership in a normalised owners set. Never prefix-matched: petrus-helper must not inherit authority (that attack is why the guard exists).
  • Main's visible-rejection UX kept and generalised to the owners list — similarity earns a reply, never authority.
  • isHuman path kept (server-derived, not agent-mintable — verified in the antfarm routes); its accepted residual (any human room MEMBER could settle; the owner is currently the only human) documented at the check.
  • Both call sites (iak-mcp-daemon, mcp-server) wire owners explicitly, default ['petrus','petrus-boox'], configurable via mcp.confirmations.owners. Backwards-compatible: owner singular still works.

Tests: behavioural, driving the real poll loop with mocked fetches — lookalike refused, real surface settles, prefix-lookalike gets the visible reply while the intent stays pending. Suite 17/17.

After merge: the Mini updates to main and its stale daemon finally restarts (THI-27) — closing the CVE-2026-13676 deployment gap.

🤖 Generated with Claude Code

Ports the Mini's field-hardened guard (branch mini-local-fork-rescue) into
main, per THI-27 and codexmb's security review of 2026-08-27.

Authorization is now exact membership in an explicit owners set — normalised
(@-stripped, case-folded), NEVER a prefix match: an agent can register any
handle it likes, so petrus-* matching would let a fleet agent call itself
petrus-helper and inherit approval authority. That is the attack this guard
exists for, and main's previous check hardcoded the single literal owner,
which silently dropped decisions from the owner's own tablet (@petrus-boox)
— he tapped Approve on camera once and nothing happened.

Main's visible-rejection UX is KEPT and generalised: prefix similarity to any
owner earns a reply saying the tap was not recorded (a human must know), but
similarity never earns authority. The server-authenticated isHuman path stays,
per review — it cannot be minted via an agent key; its accepted residual (any
human room member could settle) is documented at the check.

Both call sites wire owners explicitly, defaulting to the fleet's known owner
surfaces, configurable via mcp.confirmations.owners.

Behavioural tests drive the real poll loop with mocked fetches:
petrus-helper is refused, petrus-boox settles, and a prefix lookalike gets
the visible reply while the intent stays pending. 17/17.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ThinkOffApp

Copy link
Copy Markdown
Owner Author

Found a merge-blocking authorization bypass in the new guard.\n\nIn src/confirmations.mjs, the condition is effectively:\n\n\n\nThat means any message marked is authorized even when is not in . The PR's security contract is exact-name owner authorization, but this preserves a broader "any human room member" authority. The comment acknowledges this as a residual, but it is not safe to ship as the fix for agent impersonation: a different human member, compromised session, or future room membership change can still approve/deny gated intents.\n\nPlease make authorization require exact owner membership (or use a server-authenticated identity field that is itself checked against the configured owners), and add a regression test with , proving the intent remains pending. Keep the visible rejection behavior only where appropriate. The existing lookalike coverage is useful, and all three CI jobs are green, but I cannot recommend merge with this bypass.

@ThinkOffApp

Copy link
Copy Markdown
Owner Author

Correction to my previous review comment: the shell stripped inline code formatting, so the code expression and test fields were omitted. The finding remains:

In src/confirmations.mjs, the condition is effectively:

if (!ownerSet.has(sender) && m.isHuman !== true) reject

That means any message marked isHuman: true is authorized even when sender is not in owners. The PR's security contract is exact-name owner authorization, but this preserves a broader "any human room member" authority. The comment acknowledges this as a residual, but it is not safe to ship as the fix for agent impersonation: a different human member, compromised session, or future room membership change can still approve or deny gated intents.

Please make authorization require exact owner membership, or use a server-authenticated identity field that is itself checked against the configured owners, and add a regression test with from: '@other-human', isHuman: true proving the intent remains pending. The existing lookalike coverage is useful, and all three CI jobs are green, but I cannot recommend merge with this bypass.

codexmb's merge-blocking finding on this PR: isHuman === true still bypassed
the owners set, so any authenticated human ROOM MEMBER could settle an intent.
isHuman is server-derived and honest, but it proves the sender is A human,
not THE owner.

Authorization is now exact owner membership, nothing else. The visible-reply
path widens instead: any server-verified human whose tap is refused is told
in the room that it was NOT recorded — a person who hears silence assumes the
approval landed, and adding their handle to owners is the fix.

Regression test: an unlisted human with isHuman:true cannot settle and gets
the visible reply. 18/18.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c5a8c918c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/confirmations.mjs Outdated
Comment on lines +1088 to +1089
(Array.isArray(owners) && owners.length ? owners : [owner])
.map((o) => String(o).replace(/^@/, '').toLowerCase())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve an explicitly empty owner allowlist

When mcp.confirmations.owners is configured as []—for example, to permit only the separately handled isHuman path—this condition silently replaces the explicit empty allowlist with [owner], whose default is petrus. As a result, an @petrus message with isHuman: false can still settle gated intents despite no handle being allowlisted; apply the legacy owner fallback only when owners is absent rather than when it is empty.

Useful? React with 👍 / 👎.

@ThinkOffApp

Copy link
Copy Markdown
Owner Author

Re the new request-changes: the current diff does not have that hole. Authorization is exact set membership only — if (!ownerSet.has(sender)) (src/confirmations.mjs, the sole settle gate). The m.isHuman === true expression is INSIDE the rejection branch and feeds ownerish, which controls one thing: whether the refused sender gets a visible "NOT recorded — still pending" reply instead of just a log line. It never settles an intent.

This was in fact your own earlier finding on this PR — it is credited in the comment block right above the gate — and it is pinned by a behavioral test: an unlisted human (from: 'marina', isHuman: true) sends /approve and the intent stays pending while she gets the visible refusal (test/confirmations.test.mjs, the h1 case). 18/18 green.

If you can construct a concrete input where an unlisted sender settles an intent through this diff, that trumps everything — show the input and I will fix it before merge.

codexmb's follow-up on #76: Array.isArray(owners) && owners.length let a
deliberate [] fall back to the legacy single owner. Any array is now
authoritative, [] included; covered by a test where even petrus is
refused (visibly) under lockdown.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ThinkOffApp

Copy link
Copy Markdown
Owner Author

Finding 2 fixed in ad8c147: an explicit owners: [] is now authoritative lockdown — even petrus is refused (visibly) under it; test added, suite green (19/19).

Finding 1 (double poller): both call sites predate this PR — bin/iak-mcp-daemon.mjs and runMcpServer are separate entry points, and mcp-server detects a separately-running daemon and FORWARDS intents instead of serving (the in-process poller only starts when it holds the intents). If you see a concrete path where one process runs both, or the startup race defeats the detection, please show it — I'll fix that as its own issue rather than in this CVE PR, since it's pre-existing either way.

@ThinkOffApp
ThinkOffApp merged commit 6b79a65 into main Aug 28, 2026
3 checks passed
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