Repository navigation
✨ Session taint: observe-only recorder for what a session has read - #19099
Conversation
Adds the smallest observe-only slice of the session taint design: a config-gated, bounded, in-memory recorder (crux/sessiontaint) that keeps coarse per-session labels and logs the would-be verdict of a fixed rule table for later relay writes. Off by default; it never blocks, holds, restricts or changes any request or action, and stores labels, counts and ids only. Refs #18987 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. @clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. Review follow-ups: 1 open of 1 (below
|
… settings parity allowlist Refs #18987 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Mutation testinggremlins found 4 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.
31 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the
Verdict: |
There was a problem hiding this comment.
Style review at d83be9f: conventions and readability look good (nil-safe observer, named bounds, settings-parity allowlist and golden updated, changelog fragment present). One advisory, not blocking:
src/cmd/hive/session_taint_wire_test.go:46:TestSessionTaintConfigDefaultsonly testsconfig.SessionTaintConfig, so it fits better inpkg/config/session_taint_test.go. Keep the cross-package drift guard (...DefaultsMatchObserver) in cmd/hive, since only there are both packages imported.
-- hive: agent=adjudicator-4 backend=claude model=claude-sonnet-5-5 claude=2.1.327
| } | ||
| } | ||
|
|
||
| func TestSessionTaintConfigDefaults(t *testing.T) { |
There was a problem hiding this comment.
Style (low): this test only covers config.SessionTaintConfig; move it to src/pkg/config/session_taint_test.go beside the type. The cross-package drift guard below can stay here.
…tests and a config example Refs #18987 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
There was a problem hiding this comment.
Intent alignment (head 3902c0d): the diff matches the stated contract, an off-by-default, observe-only recorder. The observer is nil unless session_taint.enabled. Source S3 is wired through handleCanaryLeak (cmd/hive/github_client_config.go), and the sink hooks fire once per completed write in the issue, comment, PR and review watchers, after the existing gates. I found no scope creep: S0/S1/S2, the proxy and enforcement are explicitly deferred.
Advisory, non-blocking:
- The header comment in
src/pkg/github/session_taint.gosays the call runs "immediately before the hive acts on it". The call sites run after the write completed (for exampleissue_request_watcher.go!resp.AlreadyExisted), and the PR body says the same. Reword the comment to "after the write completed". - The PR says it never blocks or changes a request. A labelled session does one synchronous
Repositories.Getof up to 5s (taintAudienceLookupTimeout) inside the relay handler, and the response is written afterwards. That could delay the relay response, though not alter it. Consider noting this in the docs or running the lookup asynchronously.
-- hive: agent=adjudicator backend=claude model=claude-sonnet-5-5 claude=2.1.327
What this is
The smallest OBSERVE-ONLY slice of session taint from
src/docs/design/session-taint.md. Off by default (session_taint.enabled), it keeps a bounded in-memory record of coarse labels per agent session and logs and audits the would-be verdict of the fixed rule table for later relay writes. It never blocks, holds, restricts or changes any request or action, and stores labels, counts and ids only (no credential or content).Refs #18987 (the RFC stays open until the enforcement phases are decided).
What changed
src/crux/sessiontaint(new, stdlib only): label and sink types, the pureEvaluaterule table (the four v1 rules), a bounded LRU session store, and theObserver. The observer entry points return nothing, there is no deny verdict in the type, panics inside them are absorbed, and an unattributed or malformed agent is not recorded. Origins are shape-checked per label (category slug, owner/repo, host), so free text or a credential-shaped string is stored asinvalid.pkg/config/session_taint.goplus one field inconfig.go:session_taint.enabled(default false),max_sessions,max_labels_per_session,max_decisions.secretlabel (originhive-canary) viarecordCanaryTaintincmd/hive. No proxy file is touched.observeSessionTaintonce per relay write that completed, after every existing gate, retry and dedupe step (a reused issue, comment or PR is skipped), so the data never describes an action the hive refused or retried. The enforcement phases move the check before the write. A clean session costs a map lookup; a labelled one triggers one cached destination visibility lookup (a failed lookup counts as public and is not cached).security-model.md(control entry plus a "does not do yet" line). Changelog fragment added.Not in this PR
S0, S1 and S2 sources; the proxy and push-broker sinks (waiting on the proxy PRs in flight, none of which this PR touches); the sandbox PR step; the read-only API and
hivectlview; operator release and clear; persistence; any hold or deny behaviour.Decision record for the 12 open questions
Each row is the recommended answer with one line of reasoning grounded in the code. Overrule any row at review; rows marked "affects code" would change this PR.
translateAnthropicMessage,translatorAgentName), so S1 is partial by construction; which backends reroute depends on per-hive config and stays unverified until phase 2b measures itNeedsMITMreturns true only for the forge API host and the tracker host, so git smart-HTTP to the main forge host is tunnelled opaquelyPrivatefield (sentinelRepoPrivate); teams and forks are not modelled anywhereunknown-tainted; a pruned file copy is phase 5pkg/ioscan/canary.go), so copying its pattern would grow without bound; one process owns the proxy, relays and executor, so memory needs no consistency layerunknownlabeltranslateAnthropicToOpenAI), so naive scanning is quadratic; dedupe by block id and a byte cap are needed before any synchronous useCanaryRegistryhas no removal path and grows per kick; taint adds a second per-kick store and must not copy that shapetunnelDirectcarries builds and package fetches to many hosts; a destination list would be wrong more often than right, and the existing destination-class guard already covers the dangerous classesoutgoingDiffrunsgit difforgit show --format=only, so message and branch text never reachFindSecretReview notes
ObserveSinkis the only place a destination lookup can happen, and only for a session that already holds a label, so a hive with the feature on but no labels makes no extra API calls.