Repository navigation
feat(cage): add bot taint kind and untrusted botInput wrapper - #134
Conversation
dbejarano820
left a comment
There was a problem hiding this comment.
Thanks, Santino. This is a good start and it follows #85 closely. The copy matches the issue's table word for word in both locales, OTHERS_WORDS stays messages and mail, every wording table falls back to inbound_message, and the hard-limit tests run against an allow-all rule set in every mode, which is the evidence we ask for near the cage. A bot taint is exactly as strict as the existing kinds, and no mode is loosened, so no RFC is needed. I ran every gate locally on 874c00e and they all pass.
Since it's a draft, here's what it needs before it's ready:
- Eval numbers. This touches
packages/agent, so the issue's Done when needs the first-win set and the VA set, before and after, with the same model file and settings (the twomac-eval.tscommands in the issue). Thanks for saying plainly they weren't run. If you can't getllama-serverand Node 24 running, say so in the issue and a maintainer can run them. - The "I read and ran everything in this pull request, and I can explain it" box needs checking once that's true, as with #133.
Notes, not blocking:
packages/cage/test/modes.test.ts:221,:260andpackages/cage/test/policy.test.ts:67: good tests to keep. With the source reverted they still pass at runtime and fail only at typecheck, becausedecide()treats any taint the same way whatever its kind. That's the behavior we want, so they're regression guards against a future kind-specific exception rather than tests that fail first. A line in the PR body saying so would be enough.- Nothing notices a missing
HM-APPR-01.taintFrom.bot: the copy test passes without it. A small test that everyTaintSource["kind"]has ataintFromkey in both locales would catch the next new kind too. packages/agent/src/untrusted.ts:22:botInput(botId, text, id, at)takes three strings in a row, which are easy to swap. An options object ({ botId, text, seal, at }) would make future bus code harder to get wrong. Your call.packages/agent/src/untrusted.ts:26: the wrapper uses the cleanedsafeIdwhilerefkeeps the rawbotId. That looks intended; a short comment would stop someone from "fixing" it.
I also checked that this merges cleanly with #133. Thanks!
|
I'm running the before and after evals for this on the Mac lab now, as #85 asks: the first-win set and the VA set, with the shipped profile |
|
Before and after on the Mac lab (docs/evals.md), as #85 asks: same model file, same server, and this pull request's commit applied on the same main.
The same two VA cases miss in both runs ( |
…dingLabs#85) Signed-off-by: Santino Fuentes <santinofuentesAI@users.noreply.github.com>
874c00e to
aca734a
Compare
|
Merged. One note so nothing surprises you: #135 had changed |
|
Thanks for the detailed review @dbejarano820 and for running the Mac lab evals @juancguerrerodev! I followed up on your review notes in two small PRs:
|
What and why
Closes #85
Adds
"bot"toTaintSource["kind"]and implementsbotInput(botId, text, id, at)so messages from another bot enter turns as untrusted<untrusted source="bot:..." seal="...">data and taint the session in the cage.packages/core/src/types.ts: adds"bot"toTaintSource["kind"].packages/agent/src/untrusted.ts&packages/agent/test/untrusted.test.ts: addsbotInput(), sanitizingbotIdagainstsource="..."attribute breakout and verifying closing/opening tag forgery fails.packages/agent/src/loop.ts,packages/runtime/src/hermit.ts,packages/night/src/act.ts: adds"bot"wording toTAINT_WORDS,SCREEN_TAINT_WARNING, andTAINT_WARNING, leavingOTHERS_WORDSunchanged (["messages_read", "mail_read"]).packages/copy/locales/en.json&es-419.json: addsHM-APPR-01.taintFrom.botin both locales.packages/cage/test/modes.test.ts&policy.test.ts: verifies a"bot"-tainted session never treats links or searches from another bot as the user's own words, and deniesspend/credentialin every mode even with configurable rules opened (allowAll).Vision fit
Serves Principle 3 ("The model proposes. Code decides": another bot's text is untrusted data, never the user's words) and Principle 5 ("Spanish and English, first-class": adds matching approval-sheet copy in both
es-419anden).Non-negotiables
Checklist
acceptedproposal.pnpm check:privacy,pnpm typecheck,pnpm lint,pnpm testandnode scripts/guard/check.mjs --patterns scripts/guard/patterns.txt.packages/copy, in es-419 and en, with matching keys and placeholders, and no em or en dashes.Model path
packages/model,agent,skillsoreval, the prompt, the router, tool descriptions, normalizers, examples or the model file.This touches
packages/agent(loop.tsanduntrusted.ts), though no prompt, router, tool description, normalizer, or model file changed.mac-eval.tsandmac-eval.ts --set vawere NOT run locally becausellama-serverand Node 24 are not installed on this machine; opened as a draft until those before/after eval numbers are attached.Screenshots
Note:
apps/mobile/src/approval-view.tsalready resolvesHM-APPR-01.taintFrom.<kind>dynamically, andapps/mobile/src/approval-view.test.tspasses with"bot".New dependencies and network calls
n/a
AI agents
origin/main(4ed90aa), and drafted this PR description.