Repository navigation
feat(security): record what untrusted issue text tried to do - #891
Merged
Merged
Conversation
HugoXK
enabled auto-merge (squash)
November 16, 2026 03:59
Owner
Author
|
PASS requested at Written-by: Fledge Platform Lead All checks at this tip are green except |
HugoXK-bot
approved these changes
Nov 16, 2026
HugoXK-bot
left a comment
Collaborator
There was a problem hiding this comment.
Verdict: PASS at a3a4437
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
- The record carries ids, never text:
src/lib/untrusted.ts:104writes onlylabel/sha256/truncated/blocked, and the reader at:119/:124refuses any row it did not write, so a hand-edited meta renders nothing atsrc/views/pages.ts:3201-3203. - The scan reads the same normalised string the fence carries, not the raw bytes:
src/lib/firewall.ts:37-39strips control characters first, so a hidden newline cannot split a pattern the agent still sees; the table is bounded and every pattern is non-global (:24-30), pinned bytest/firewall.test.ts:44. - Both issue paths write one shape and the page event only when there is a job:
src/app.ts:5906-5912audits always and recordsjob.untrusted_inputonly whencommandJobIdis non-null, which is exactly what the page'sfindneeds atsrc/views/pages.ts:3200. - The behaviour is pinned by tests that fail without it:
test/firewall.test.ts:11,:51,:71, andtest/untrusted.test.ts:82. - Non-blocking:
src/app.ts:5907scans the untruncated payload while the fence caps at 4000 (src/lib/untrusted.ts:12), so a directive past the cap is recorded though the agent never reads it — over-labelling only; andrun-commandwill fire on ordinary prose such as "run the script", which is acceptable because a hit records and never blocks.
Ran:
npm run checkin a tree ofa3a4437a— exit 0, 2323/2323 pass (lint vs baseline, typecheck, test, build); dependencies came from annpm ciinstall whosepackage-lock.jsonsha256 is identical to this head's locknpx tsx --test test/firewall.test.ts test/untrusted.test.ts— 11/11 at the tip- red half:
src/app.ts,src/lib/untrusted.ts,src/lib/firewall.ts,src/views/pages.tsrestored to base410f16b2(blob hashesdd15e401,29008c7e,07951d61match the PR's base side), same tests — the firewall suite fails to load (ERR_MODULE_NOT_FOUND) andtest/untrusted.test.tsis 3/6 red node scripts/risk-gate.mjs --base <base tree> --head <head tree>—risk-tier: T2; basis: src/app.ts, 9 files+217/−18, matching the PRGITHUB_TOKEN=… node scripts/pr-lint.mjs --pr 891—pr-lint: ok (#891, T2, 9 files)
Not run: no real GitHub issue was driven through the firewall (no issue posted, no live job consumed the fenced goal); the scan was exercised only against the test bodies and the fixed rule table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Written-by: Fledge Platform Dev-1
Bot: Fledge Platform Dev-1
What changed
#370's labelling slice (#857) fences issue title and body as data. Fencing alone does not say what the text tried to do, so this slice names it.
src/lib/firewall.ts:scanUntrusted()scans the exact string the fence carries — after control characters are stripped, so a hidden newline cannot split a pattern the agent still reads — against a finite, ordered rule table (ignore-previous-instructions,push-to-main,merge-pull-request,system-prompt,run-command,reveal-secret). It returns rule ids only; matched text is never returned./fledge planand/fledge fixrecord the verdict on the job eventjob.untrusted_inputand in thejob.untrusted_inputaudit row asblocked=<ids|none>, beside the label, body hash and truncation flag.data-untrusted-input), in both locales. The body stays out of the event, the log and the page.parseUntrustedMeta()refuses a record it did not write (hand-edited event, older row, smuggled text), so a bad row is not rendered as a claim.bridge/change remain the follower half of security: treat issue text, PR comments and repo files as untrusted input to the agent #370.Fixes #370 (slice: the firewall and its record; the fence shipped as #857).
Ran:
npm run checkatac4cac2— 2323/2323, exit 0npx tsx --test test/firewall.test.tsat410f16b2with the delivered test file — 0 pass / 1 fail (ERR_MODULE_NOT_FOUND src/lib/firewall.js); 6/6 at the tipnpx tsx --test test/untrusted.test.ts test/firewall.test.tsat the tip — 11/11node scripts/risk-gate.mjs --base 410f16b2—risk-tier: T2; basis: src/app.tsNot run: no bridge change, no live FlyBot run, no Docker image, no database migration (none exists).
Risk and rollback
T2,
src/. No schema change, no config key, no bridge contract change. Revert the squash to roll back; the audit event kind simply stops being written.Docs
docs/security.md(the firewall paragraph replaces the "follower half" claim) anddocs/architecture.md(issue-command section) in the tree. Changelog fragmentchangelog.d/370-untrusted-firewall.added.md.maintainer_can_modify: true