Skip to content

docs: consolidate security model with threat analysis - #77

Merged
max-sixty merged 2 commits into
mainfrom
lazy-attacker
Mar 26, 2026
Merged

max-sixty merged 2 commits into
mainfrom
lazy-attacker

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Restructures docs/security-model.md from a flat reference into a narrative threat model. Merges security content that was split across DESIGN.md and security-model.md into one canonical location, with DESIGN.md pointing to it.

The new structure: what attackers want (ranked), what we do about each threat, what's still open, and what we've considered but deferred — with tradeoff analysis for each deferred option. Also documents what claude-code-action restores from the base branch vs what we pin ourselves (and why CLAUDE.md isn't covered upstream).

This was written by Claude Code on behalf of @max-sixty

max-sixty and others added 2 commits March 26, 2026 12:46
… assessment

Restructures docs/security-model.md from a flat reference into a narrative
threat model: what attackers want, what we do about it, what's still open,
and what we've considered but deferred. Merges content that was split across
DESIGN.md and security-model.md into one place.

Key additions:
- Explicit threat ranking (merge to main > exfiltrate tokens > hijack session)
- Per-file explanation of why config pinning matters (hooks, MCP, .gitmodules,
  .ripgreprc --pre flag)
- "Remaining risks" section acknowledging attacker-controlled code execution
  as the biggest open gap
- "What we could do but don't" with tradeoff analysis (GitHub App, Haiku
  pre-screening, read-only fork mode, env scrubbing, dispatch isolation)
- Comment in action.yaml documenting what claude-code-action restores vs what
  we pin ourselves

Co-Authored-By: Claude <[email protected]>
Incorporates protected_branches detail from main into the new
"Merge restriction" narrative paragraph.

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 1b4a547 into main Mar 26, 2026
3 checks passed
@max-sixty
max-sixty deleted the lazy-attacker branch March 26, 2026 19:50
max-sixty pushed a commit that referenced this pull request Aug 11, 2026
…g output accepted (#864)

## Problem

Step 2 asks the survey subagent whether each run's output was "accepted
or rejected" but never says who has to do the accepting. Nothing in the
prompt distinguishes a human merging a PR from the bot replying to its
own review thread, so the subagent fills the gap with the most natural
reading — a reply arrived, therefore someone accepted it — and reports a
self-conversation as human acceptance.

That is the worst-shaped failure this skill has: it produces a **false
all-clear**. A survey that credits the bot's own reply to a human
doesn't add noise a later gate can filter, it removes the signal that
would have sent the leg to Step 3.

## Evidence

This leg ([run
31081926964](https://github.com/max-sixty/tend/actions/runs/31081926964),
target `max-sixty/cargo-affected`). The survey subagent reported PR
[#77](max-sixty/cargo-affected#77) twice under
"Runs with accepted output":

> Outcome: ACCEPTED - human developer responded positively to feedback
> Outcome: ACCEPTED - human developer incorporated feedback

and concluded `PR 77: Developer accepted and incorporated bot feedback
(2 cycles of acceptance)`. There is no developer. The PR is bot-authored
and every actor on it is the bot:

```
$ gh api "repos/max-sixty/cargo-affected/pulls/77/comments?per_page=100" --jq '[.[].user.login] | unique'
["cargo-affected-bot"]
```

The same report also listed the PR author as `cargo-affected-bot`, so
the contradiction was internal to the summary — the acceptance claim was
reached without ever comparing the replying login against the bot's.

This is the fourth cheap-subagent mis-attribution recorded in the
[evidence
gist](https://gist.github.com/dca23a6e6a0d8cae2665944ba31676fb), and the
second of this specific sub-class (bot activity attributed to a human):

| Occurrence | Shape |
| --- | --- |
| gist "Analysis-side", leg ending 07:5x | inline replies + commit
`551e059` credited to "human applied suggested changes" |
| gist "Analysis-side", following leg | PR #54 bodies credited to a run
that had not yet started |
| gist "Analysis-side", streak-break leg | fabricated no-op causes;
window boundary ignored |
| **this leg** | **bot's own reply chain on PR #77 reported as human
acceptance** |

Prior legs' response was to stop delegating — ten consecutive legs
record "this leg used **no** survey subagent". That is a per-leg
workaround for a defect in the shared prompt, and it leaves the skill's
stated default (`Delegate all broad exploration to a cheap subagent`)
pointing at a step that mis-reports actors.

## Fix

Three small changes to Step 2, all inside the prompt template:

- Require the subagent to **name the login** behind every
acceptance/rejection signal, sourced from a single `gh pr view --json
number,state,author,mergedBy,reviews,comments,commits` that covers all
five actor surfaces — merge actor, reviews (with state), inline
comments, conversation comments, and commits. A comments-only check
can't source it: neither comments endpoint carries review records or the
merge actor, so a maintainer merging a bot PR without commenting would
come back as bot-only. Inline commenters need no separate call — every
inline comment, including a standalone reply, belongs to a review record
that `reviews` returns. The block notes that `commits` truncates at 100
(oldest-first) while `comments` and `reviews` paginate in full.
- Give bot-only threads their own report bucket (`bot-only — no human
signal`) so they can't be silently filed under "accepted".
- Tell the main agent to verify actor attribution before it enters a
finding, and to judge bot-only threads on content rather than treating
the bucket as either outcome.

The rule is stated so it stays correct when the bot legitimately works
on its own PR: bot-only is *not* a defect (a self-review followed by the
author's fix is designed behavior), it just isn't **acceptance**.
Nothing here discourages delegation — it fixes the instruction the
delegation was missing.

## Gate assessment

- **Evidence level**: High — consistent pattern across multiple
sessions. 4 occurrences total, 2 in the human/bot sub-class this change
addresses. High needs 2–3.
- **Structural or stochastic**: structural in the prompt. The subagent
is never asked for actor identity, so no wording of the reply can be
relied on to supply it; which specific claim it invents is stochastic,
the omission is not.
- **Change type**: targeted fix — a missing requirement in an existing
prompt, plus a report bucket. Normal bar, met.
- **Passes both gates.**

Second finding this leg did **not** pass and is recorded in the gist
instead: the three-hop `tend-mention` chain on the same PR #77. That one
is already fixed by open PR #849, and I've added this window's evidence
there rather than opening a duplicate.

---------

Co-authored-by: tend-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 11, 2026
…ting run's log (#869)

A `review-reviewers` leg named the wrong run as the author of a public
comment, and that run ID then shipped in a public comment on an open PR
([#849](#849 (comment))).
The mis-attribution came from mapping outputs to runs by wall-clock
inclusion — the comment's timestamp fell inside that run's span, so it
was credited to it. Several runs are live at once on a busy PR, so the
span proves nothing.

## What actually happened

On `max-sixty/cargo-affected` PR #77, four bot sessions overlapped
between 07:21Z and 07:41Z. Attribution read from each session's own log
(the tool call that posted):

| Output | Credited in #849 to | Actually posted by (session log) |
| --- | --- | --- |
| commit `56406d76` + inline reply `3726782508` | mention handle
`31081009768` | `tend-nightly` `31080083613` — the run that opened the
PR, still running |
| inline reply `3726818957` | mention handle `31081269852` | mention
handle `31081009768` |

`31081269852` and `31081591885` — the two hops triggered by the
synthetic reply containers that #849 exists to suppress — each ran a
read-only sweep and posted nothing. Their logs contain no posting call
and both end with an explicit silent-exit decision.

This matters for #849: its comment escalates the case to "an unguarded
container caused the bot to post additional public output." That did not
happen in this window. Both public replies came from a hop that #849's
own predicate keeps firing (the genuine self-review) and from a racing
sibling session outside the chain entirely. The guard's real value —
suppressing two no-op agent runs and their queue slots — is unchanged.
Correction posted on the PR.

## Root cause

Step 2's run→output mapping is branch- and time-based, which is the
right cheap first pass. Nothing then tells the analyst that the mapping
is provisional. Step 3 escalates to session logs only on "negative
outcome signals (or suspicious lack of output)", so a finding whose
*claim* is an attribution — this run did that — never triggers the one
check that could confirm it. The leg that produced the error recorded
"session-log inspection: not needed — the mention chain's decisions are
fully determined by the review records", which is true of the decisions
and false of the authorship.

## Change

One paragraph in Step 3 adding a third escalation trigger: when a
finding will name which run produced an output, confirm it from that
run's log, with the `jq | grep` for the posting call. Ten lines, at the
point where the escalation decision is made.

## Gate assessment

- **Evidence level**: High. Direct occurrence this window, confirmed
against four session logs. The class — attribution errors reaching a
finding — stands at 5 across recorded legs: three cheap-subagent
mis-attributions, the human-vs-bot actor case now addressed by
[#864](#864), and this run-vs-run
case. The evidence log's standing carry pre-registered exactly this
("verify any subagent claim before it enters a finding, especially actor
attribution **and run→output mapping**"); it has now fired for the
second half.
- **Occurrences**: 1 direct + 4 historical in class, against a High
threshold of 2–3.
- **Structural**: yes. Overlapping runs make wall-clock attribution
ambiguous every time; the skill offers no other attribution method, so
the same reasoning reproduces the same error.
- **Change type**: targeted fix (one paragraph + a recipe at an existing
decision point), Normal bar.
- **Relation to #864**: complementary and non-overlapping. #864 fixes
*actor* attribution (which login) in Step 2; this fixes *run*
attribution (which session) in Step 3. Textually adjacent, so whichever
lands second wants a trivial rebase.

Evidence log: https://gist.github.com/dca23a6e6a0d8cae2665944ba31676fb

---------

Co-authored-by: tend-agent <[email protected]>
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.

2 participants