From 0c1450c25024091a2ba9ba2982c7bfbfe310c3b8 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Thu, 19 Nov 2026 01:23:56 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20fail-closed=20fault=20inj?= =?UTF-8?q?ection=20for=20proxy=20policy=20seams?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The review-thread ownership seams (OwnPR, HiveLogins), the GitHub lookup behind the reference-repo and review-thread gates, and the canary scanner were called bare on the proxy request path. A panic in any of them crashed the whole proxy and a hang held the request open. They now run through the same guard as the Set*Func predicates (#18994), generalised to callPolicySeam, and a failure takes the gate's deny branch. A canary scan that cannot finish refuses even in advisory canary mode, matching an unreadable body. TestPolicySeamFaultInjectionDenies drives each seam with error, panic and deadline faults and asserts a deny, with a healthy control per seam. The audit result for #18986 item 5 and the accepted risks are recorded in security-model.md section 5 and security-threat-model.md. Closes #19224 Co-Authored-By: Claude Opus 5.5 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .../fixed-19224-proxy-seam-fail-closed.md | 1 + src/crux/proxy/github_proxy_policy.go | 18 +- src/crux/proxy/policy_callback_guard.go | 53 ++++- src/crux/proxy/policy_seam_fault_test.go | 188 ++++++++++++++++++ src/crux/proxy/reference_repos.go | 28 ++- src/crux/proxy/review_thread.go | 55 ++++- src/docs/security-model.md | 49 +++++ src/docs/security-threat-model.md | 7 + 8 files changed, 383 insertions(+), 16 deletions(-) create mode 100644 changelog.d/fixed-19224-proxy-seam-fail-closed.md create mode 100644 src/crux/proxy/policy_seam_fault_test.go diff --git a/changelog.d/fixed-19224-proxy-seam-fail-closed.md b/changelog.d/fixed-19224-proxy-seam-fail-closed.md new file mode 100644 index 0000000000..98677cf1c4 --- /dev/null +++ b/changelog.d/fixed-19224-proxy-seam-fail-closed.md @@ -0,0 +1 @@ +- **More proxy checks fail closed when they cannot run.** If the review-thread ownership check, the GitHub lookup behind the reference-repo and review-thread gates, or the canary scan panics or hangs, the proxy now refuses that one request with a 403 instead of crashing the whole proxy or holding the request open. A canary scan that cannot finish refuses the write even in advisory canary mode. The results of the egress audit's error-path review, and the accepted risks, are recorded in the security model ([#19224](https://github.com/hivecommons/hive/issues/19224)). diff --git a/src/crux/proxy/github_proxy_policy.go b/src/crux/proxy/github_proxy_policy.go index ecbe86cd2e..85b3855e9e 100644 --- a/src/crux/proxy/github_proxy_policy.go +++ b/src/crux/proxy/github_proxy_policy.go @@ -7,6 +7,7 @@ import ( "net/http" "strings" + "github.com/hivecommons/hive/crux" "github.com/hivecommons/hive/crux/agent" ) @@ -370,7 +371,22 @@ func (p *GitHubProxy) inspectCanaryEgress(agentName string, req *http.Request) ( } req.Body = io.NopCloser(bytes.NewReader(body)) req.ContentLength = int64(len(body)) - if leak, ok := p.canaryRegistry.Scan(agentName, string(body), "github:"+req.Method+" "+req.URL.Path); ok { + type scanResult struct { + leak crux.CanaryLeak + found bool + } + scanner, text, source := p.canaryRegistry, string(body), "github:"+req.Method+" "+req.URL.Path + res, scanned := callPolicySeam(p, "ioscan canary scan", canaryScanTimeout, func() scanResult { + leak, found := scanner.Scan(agentName, text, source) + return scanResult{leak, found} + }) + if !scanned { + // Fail closed (#19224), whatever canaryFailClosed says: a scan that + // panicked or did not finish is a body we could not scan, the same + // answer as a body we could not read. + return "ioscan canary scan failed", true, true + } + if leak, ok := res.leak, res.found; ok { if p.canaryLeakFunc != nil { p.canaryLeakFunc(leak) } diff --git a/src/crux/proxy/policy_callback_guard.go b/src/crux/proxy/policy_callback_guard.go index 4f0cde5b8e..f40e0cdaf0 100644 --- a/src/crux/proxy/policy_callback_guard.go +++ b/src/crux/proxy/policy_callback_guard.go @@ -24,6 +24,19 @@ import ( // off, lane enforced. Fail closed, same direction as the dial-time // classifier in plain_forward_guard.go refusing an address it cannot parse. // +// The same guard (callPolicySeam) covers the seams on the decision path that +// are not Set*Func predicates (#19224): +// +// - ReviewThreadGuard.OwnPR and HiveLogins (review-thread gate): a failure +// refuses the reply or delete. +// - referenceLookup, the GitHub GET behind the reference-repo own-item and +// default-branch checks and the review-thread comment lookup: it already +// refused on an error; a panic or a call past referenceLookupTimeout is +// now reported as that error. +// - CanaryScanner.Scan: a scan that panics or does not finish within +// canaryScanTimeout refuses the write, the same answer as a body the scan +// could not read. +// // Intentional exceptions, not routed through this guard: // // - githubBudgetCap / githubReserveFloor / githubReserveSnapshot are rate @@ -31,7 +44,10 @@ import ( // and a wrong answer costs quota, not a policy bypass. // - agentTokenSource / linearCredential supply credentials rather than // decide; a missing credential already makes the upstream refuse. -// - writeRefusedAudit and canaryLeakFunc are sinks called after a decision +// - ReferenceRepoPolicy.Token supplies a credential; "" sends the lookup +// unauthenticated and GitHub then answers 404 for a private repo, which +// refuses. +// - writeRefusedAudit, canaryLeakFunc and ReviewThreadGuard.OnRefused are sinks called after a decision // has been made; they cannot turn a deny into an allow. // policyCallbackTimeout bounds one policy predicate call. The predicates read @@ -39,6 +55,17 @@ import ( // the fault-injection test can shorten it. var policyCallbackTimeout = 2 * time.Second +// canaryScanTimeout bounds one canary scan of a write body. The scan is +// in-process but works over up to maxGitHubWriteBodyScan bytes and their +// decoded variants, so it gets more room than a config predicate. A var only +// so the fault-injection test can shorten it. +var canaryScanTimeout = 10 * time.Second + +// referenceLookupTimeout bounds one referenceLookup call. The default lookup +// carries its own 10s client timeout; this is the backstop for a lookup that +// ignores it. A var only so the fault-injection test can shorten it. +var referenceLookupTimeout = 15 * time.Second + // policyCallbackFailedReason is the agent-facing 403 body when a gate could // not be evaluated. It deliberately does not reuse the gate's own directive // ("repository X is PAUSED by the operator"), which would assert an operator @@ -49,12 +76,19 @@ func policyCallbackFailedReason(gate string) string { // callPolicyPredicate runs fn with panic recovery and policyCallbackTimeout. // ok is false when fn panicked or did not return in time; the caller must -// then take its deny branch. On timeout the goroutine running fn is left to -// finish on its own (Go cannot cancel it); the buffered channel lets it exit -// without a reader. +// then take its deny branch. func (p *GitHubProxy) callPolicyPredicate(gate string, fn func() bool) (result, ok bool) { + return callPolicySeam(p, gate, policyCallbackTimeout, fn) +} + +// callPolicySeam is callPolicyPredicate for a seam of any result type and its +// own deadline (#19224). ok is false when fn panicked or did not return within +// timeout; the zero T is returned and the caller must take its deny branch. +// On timeout the goroutine running fn is left to finish on its own (Go cannot +// cancel it); the buffered channel lets it exit without a reader. +func callPolicySeam[T any](p *GitHubProxy, gate string, timeout time.Duration, fn func() T) (result T, ok bool) { type outcome struct { - value bool + value T panicked bool cause any } @@ -67,18 +101,19 @@ func (p *GitHubProxy) callPolicyPredicate(gate string, fn func() bool) (result, }() done <- outcome{value: fn()} }() - timer := time.NewTimer(policyCallbackTimeout) + timer := time.NewTimer(timeout) defer timer.Stop() + var zero T select { case o := <-done: if o.panicked { p.logPolicyCallbackFailure(gate, fmt.Sprintf("panic: %v", o.cause)) - return false, false + return zero, false } return o.value, true case <-timer.C: - p.logPolicyCallbackFailure(gate, "timed out after "+policyCallbackTimeout.String()) - return false, false + p.logPolicyCallbackFailure(gate, "timed out after "+timeout.String()) + return zero, false } } diff --git a/src/crux/proxy/policy_seam_fault_test.go b/src/crux/proxy/policy_seam_fault_test.go new file mode 100644 index 0000000000..81dcf30d83 --- /dev/null +++ b/src/crux/proxy/policy_seam_fault_test.go @@ -0,0 +1,188 @@ +package proxy + +import ( + "errors" + "io" + "log/slog" + "net/http" + "strings" + "testing" + "time" + + "github.com/hivecommons/hive/crux" +) + +// seamFaultScanner is a CanaryScanner whose Scan raises the row's fault +// first. A nil fault is a healthy scanner that finds nothing. +type seamFaultScanner struct{ f *seamFault } + +func (s seamFaultScanner) Scan(string, string, string) (crux.CanaryLeak, bool) { + s.f.raise() + return crux.CanaryLeak{}, false +} + +// seamFaultBody is a request body whose Read fails. +type seamFaultBody struct{} + +func (seamFaultBody) Read([]byte) (int, error) { return 0, errors.New("injected body read fault") } + +var errSeamFault = errors.New("injected seam error") + +// seamFault is one injected failure: an error, a panic, or a call that does +// not return before the seam's deadline. A nil *seamFault is healthy. +type seamFault struct { + kind string // "error", "panic" or "timeout" + release <-chan struct{} +} + +// raise performs the fault. It returns errSeamFault for the error kind, nil +// when healthy, and never returns normally for panic (or until release closes +// for timeout). +func (f *seamFault) raise() error { + if f == nil { + return nil + } + switch f.kind { + case "error": + return errSeamFault + case "panic": + panic("injected policy seam fault") + case "timeout": + <-f.release + } + return nil +} + +// TestPolicySeamFaultInjectionDenies covers the decision-path seams that are +// not Set*Func predicates (#19224; TestPolicyCallbackFailureDenies covers +// those). Every seam is driven with each fault it can raise (an error, a +// panic, a call past its deadline) and the gate must refuse. Each seam also +// runs healthy first and must allow the same request, so a refusal is the +// fault's doing and not a blanket deny. Before the guard, the panic rows +// crashed the test binary and the timeout rows blocked until the test +// timeout. +func TestPolicySeamFaultInjectionDenies(t *testing.T) { + prevPolicy, prevScan, prevLookup := policyCallbackTimeout, canaryScanTimeout, referenceLookupTimeout + policyCallbackTimeout, canaryScanTimeout, referenceLookupTimeout = 50*time.Millisecond, 50*time.Millisecond, 50*time.Millisecond + release := make(chan struct{}) + t.Cleanup(func() { + close(release) + policyCallbackTimeout, canaryScanTimeout, referenceLookupTimeout = prevPolicy, prevScan, prevLookup + }) + errKind := &seamFault{kind: "error"} + panicKind := &seamFault{kind: "panic"} + timeoutKind := &seamFault{kind: "timeout", release: release} + + replyPath := "/repos/cncf/techdocs/pulls/comments/" + rtReplyID + "/replies" + deleteOwnPath := "/repos/cncf/techdocs/issues/comments/" + rtCommentA + refPol := ReferenceRepoPolicy{Repo: "hivecommons/docs", Issues: true, Login: "hivecommons-hive[bot]", Token: func() (string, bool) { return "ref-tok", true }} + + seams := []struct { + name string + faults []*seamFault + // check evaluates the gate with the seam raising f (nil = healthy) + // and reports the refusal reason and whether it refused. + check func(t *testing.T, f *seamFault) (string, bool) + // failReason, when set, is the exact reason a faulted call must give. + failReason string + }{ + { + name: "review-thread OwnPR", + faults: []*seamFault{panicKind, timeoutKind}, + check: func(t *testing.T, f *seamFault) (string, bool) { + p := newRTProxy(t, newRTFixture(time.Now()), nil) + g := p.reviewThreadGuard() + g.OwnPR = func(repo string, n int) (string, bool) { + _ = f.raise() + return rtOwnPR(repo, n) + } + p.SetReviewThreadGuard(g) + return p.reviewThreadRefusal(rtReq("POST", replyPath, `{"body":"x"}`), rtOwner) + }, + failReason: policyCallbackFailedReason(reviewOwnershipGate), + }, + { + name: "review-thread HiveLogins", + faults: []*seamFault{panicKind, timeoutKind}, + check: func(t *testing.T, f *seamFault) (string, bool) { + p := newRTProxy(t, newRTFixture(time.Now()), nil) + g := p.reviewThreadGuard() + g.HiveLogins = func() []string { + _ = f.raise() + return []string{rtHiveBot} + } + p.SetReviewThreadGuard(g) + return p.reviewThreadRefusal(rtReq("DELETE", deleteOwnPath, ""), rtOwner) + }, + failReason: policyCallbackFailedReason(reviewOwnershipGate), + }, + { + name: "review-thread comment lookup", + faults: []*seamFault{errKind, panicKind, timeoutKind}, + check: func(t *testing.T, f *seamFault) (string, bool) { + fx := newRTFixture(time.Now()) + p := newRTProxy(t, fx, nil) + p.referenceLookup = func(url, token string) ([]byte, error) { + if err := f.raise(); err != nil { + return nil, err + } + return fx.lookup(url, token) + } + return p.reviewThreadRefusal(rtReq("POST", replyPath, `{"body":"x"}`), rtOwner) + }, + }, + { + name: "reference repo own-item lookup", + faults: []*seamFault{errKind, panicKind, timeoutKind}, + check: func(t *testing.T, f *seamFault) (string, bool) { + p := newReferenceTestProxy(t, refPol, func(string, string) ([]byte, error) { + if err := f.raise(); err != nil { + return nil, err + } + return []byte(`{"user":{"login":"hivecommons-hive[bot]"}}`), nil + }) + return p.referenceRepoRefusal(refReq("POST", "/repos/hivecommons/docs/issues/12/comments", "", nil)) + }, + }, + { + // Advisory canary mode (failClosed=false) still refuses a scan + // that could not run: advisory governs what a found leak does, + // and an unscanned body has not been found clean. + name: "canary scan", + faults: []*seamFault{errKind, panicKind, timeoutKind}, + check: func(t *testing.T, f *seamFault) (string, bool) { + p := &GitHubProxy{logger: slog.New(slog.NewTextHandler(io.Discard, nil))} + req, _ := http.NewRequest(http.MethodPost, "https://api.github.com/repos/org/repo/issues/1/comments", strings.NewReader(`{"body":"hello"}`)) + scanFault := f + if f != nil && f.kind == "error" { + // Scan has no error return; this seam's error branch is + // the body it would scan being unreadable. + req.Body = io.NopCloser(seamFaultBody{}) + scanFault = nil + } + p.SetCanaryScanner(true, false, seamFaultScanner{f: scanFault}, nil) + reason, deny, _ := p.inspectCanaryEgress("scanner", req) + return reason, deny + }, + }, + } + + for _, s := range seams { + t.Run(s.name+"/healthy", func(t *testing.T) { + if reason, denied := s.check(t, nil); denied { + t.Fatalf("healthy %s refused: %q", s.name, reason) + } + }) + for _, f := range s.faults { + t.Run(s.name+"/"+f.kind, func(t *testing.T) { + reason, denied := s.check(t, f) + if !denied { + t.Fatalf("%s %s: gate allowed the request; want deny", s.name, f.kind) + } + if s.failReason != "" && reason != s.failReason { + t.Fatalf("%s %s: reason = %q; want %q", s.name, f.kind, reason, s.failReason) + } + }) + } + } +} diff --git a/src/crux/proxy/reference_repos.go b/src/crux/proxy/reference_repos.go index ad3df50d67..57706c724f 100644 --- a/src/crux/proxy/reference_repos.go +++ b/src/crux/proxy/reference_repos.go @@ -5,6 +5,7 @@ import ( "bytes" "encoding/hex" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -355,13 +356,34 @@ func defaultReferenceLookup(url, token string) ([]byte, error) { return body, nil } +// referenceLookupOrDefault returns the lookup wrapped in the policy-seam +// guard (#19224): a lookup that panics or outlives referenceLookupTimeout +// answers an error, which every caller already turns into a refusal. func (p *GitHubProxy) referenceLookupOrDefault() referenceLookupFunc { - if p.referenceLookup != nil { - return p.referenceLookup + lookup := p.referenceLookup + if lookup == nil { + lookup = defaultReferenceLookup + } + return func(url, token string) ([]byte, error) { + type answer struct { + body []byte + err error + } + a, ok := callPolicySeam(p, "reference lookup", referenceLookupTimeout, func() answer { + body, err := lookup(url, token) + return answer{body, err} + }) + if !ok { + return nil, errReferenceLookupFailed + } + return a.body, a.err } - return defaultReferenceLookup } +// errReferenceLookupFailed is the error a guarded lookup answers when the +// lookup itself panicked or timed out. +var errReferenceLookupFailed = errors.New("the GitHub lookup failed or timed out") + func (p *GitHubProxy) referenceToken(pol ReferenceRepoPolicy) string { if pol.Token == nil { return "" diff --git a/src/crux/proxy/review_thread.go b/src/crux/proxy/review_thread.go index 49593c4e07..eee9b0db02 100644 --- a/src/crux/proxy/review_thread.go +++ b/src/crux/proxy/review_thread.go @@ -174,6 +174,45 @@ func (p *GitHubProxy) reviewThreadGuard() ReviewThreadGuard { return p.reviewGuard.guard } +// reviewOwnershipGate names the review-thread seams in a fail-closed refusal. +const reviewOwnershipGate = "review-thread ownership" + +// guardedReviewThreadGuard is the installed guard with OwnPR and HiveLogins +// routed through the policy-seam guard (#19224). A call that panics or times +// out sets *failed and answers the deny value: not owned, no hive logins. +// Nil seams stay nil so the "no guard installed" refusals are unchanged. +func (p *GitHubProxy) guardedReviewThreadGuard(failed *bool) ReviewThreadGuard { + g := p.reviewThreadGuard() + if own := g.OwnPR; own != nil { + g.OwnPR = func(repo string, number int) (string, bool) { + type answer struct { + agent string + ok bool + } + a, ok := callPolicySeam(p, reviewOwnershipGate, policyCallbackTimeout, func() answer { + owner, owned := own(repo, number) + return answer{owner, owned} + }) + if !ok { + *failed = true + return "", false + } + return a.agent, a.ok + } + } + if logins := g.HiveLogins; logins != nil { + g.HiveLogins = func() []string { + out, ok := callPolicySeam(p, reviewOwnershipGate, policyCallbackTimeout, logins) + if !ok { + *failed = true + return nil + } + return out + } + } + return g +} + func (g ReviewThreadGuard) now() time.Time { if g.Now != nil { return g.Now() @@ -193,11 +232,20 @@ func reviewThreadRefusalText(why string) string { // request must be blocked; a request that is not a guarded route returns // false and is left to the rest of the chain (mode table, repo filter). func (p *GitHubProxy) reviewThreadRefusal(req *http.Request, agentName string) (string, bool) { + var failed bool + reason, refused := p.reviewThreadDecision(req, agentName, &failed) + if failed { + return policyCallbackFailedReason(reviewOwnershipGate), true + } + return reason, refused +} + +func (p *GitHubProxy) reviewThreadDecision(req *http.Request, agentName string, failed *bool) (string, bool) { w, ok := classifyReviewThreadWrite(req.Method, req.URL.Path) if !ok { return "", false } - g := p.reviewThreadGuard() + g := p.guardedReviewThreadGuard(failed) if agentName == "" { return reviewThreadRefusalText("the calling agent could not be identified"), true } @@ -243,7 +291,8 @@ func (p *GitHubProxy) noteRefusedReviewReply(req *http.Request, agentName, reaso if !ok || w.kind == reviewWriteDelete { return } - g := p.reviewThreadGuard() + var failed bool + g := p.guardedReviewThreadGuard(&failed) if g.OnRefused == nil || g.OwnPR == nil { return } @@ -255,7 +304,7 @@ func (p *GitHubProxy) noteRefusedReviewReply(req *http.Request, agentName, reaso } number = n } - if _, owned := g.OwnPR(w.repo, number); !owned { + if _, owned := g.OwnPR(w.repo, number); !owned || failed { return } body, inReplyTo := peekReviewDraft(req) diff --git a/src/docs/security-model.md b/src/docs/security-model.md index 76974e5448..4f73cc4a27 100644 --- a/src/docs/security-model.md +++ b/src/docs/security-model.md @@ -419,6 +419,55 @@ there. Operator-configured gateway endpoints and the fixed-host `/api/style` fetch are not pinned: a gateway may legitimately sit on a private address, and redirects off either are still checked. +**Proxy decisions fail closed.** The egress audit +([#18986](https://github.com/hivecommons/hive/issues/18986), item 5) walked +every branch of the proxy's per-request decision path that can fail and +checked what each does. The rule is that a check the proxy cannot evaluate +refuses the request. Each branch below has a test that injects the failure. + +| Failure | Outcome | +|---|---| +| Body read error or body over the scan limit, canary scan | Refused, `403`. | +| Body read error or body over the limit, Linear | Refused, `403`. | +| Body read error, GitHub GraphQL | The connection is closed and nothing is forwarded. | +| GraphQL or Linear document that does not parse | Refused by the mutation classifier. | +| REST method and path with no matching rule | Refused at every mode. | +| Repo pause, agent repo scope, auto-merge or `write_surface.enforce` predicate panics or hangs | That gate refuses, `403` naming the failed check ([#18994](https://github.com/hivecommons/hive/issues/18994)). | +| Review-thread ownership seams (which agent opened a PR, the hive's own logins) panic or hang | Refused, `403` naming the failed check ([#19224](https://github.com/hivecommons/hive/issues/19224)). | +| GitHub lookup behind the reference-repo and review-thread gates errors, panics or hangs | Refused, naming the lookup failure. | +| Canary scanner panics or hangs | Refused, also in advisory canary mode ([#19224](https://github.com/hivecommons/hive/issues/19224)). | +| No review-thread guard installed | Every guarded reply and delete is refused. | +| Caller cannot be identified (`/proc/net/tcp` read fails) | Treated as advisory: writes refused, reads allowed. | +| Plain-HTTP or uninspected tunnel address that cannot be parsed | Refused at dial time. | + +The panic and timeout cases share one guard. A panic is recovered and a hang +is cut off at a deadline (two seconds for a config predicate, ten for a +canary scan, fifteen for a GitHub lookup), and either answer is that gate's +deny. Before the guard, a panic in any of these took down the whole proxy and +with it every agent's egress, and a hang held the request open with no +answer. + +Accepted risks, written down rather than fixed: + +- **Unidentified reads are allowed.** An agent the proxy cannot attribute is + given advisory mode, which allows GitHub reads. Denying them would break + every agent on a host where `/proc/net/tcp` cannot be read, and reads carry + the agent's own scoped token. Writes from such a caller are refused and + logged as a UID attribution failure. +- **Budget, credential and audit seams are not guarded.** The GitHub budget + cap and reserve floor are rate limits: they fall back to config values, and + a wrong answer costs quota, not a policy bypass. The agent token source, + the Linear credential and the reference-repo token supply credentials; a + missing one makes GitHub refuse the request. The refused-write audit, the + canary leak handler and the review-reply handoff run after the decision + is made and cannot turn a deny into an allow. +- **A timed-out check keeps running.** Go cannot cancel a goroutine, so a + hung predicate finishes in the background after the request is refused. + It holds no lock the request path needs. +- **The canary scan is off when not configured.** With `ioscan` or canaries + disabled, no scan runs and nothing is refused on its account. That is the + operator's choice, not a failure of the check. + **Hub-to-spoke channel.** Heartbeats carry a per-hive bearer key derived from the hub master secret and are compared in constant time. The payload is telemetry only: health, version, agent and governor summaries and 24-hour diff --git a/src/docs/security-threat-model.md b/src/docs/security-threat-model.md index 8b170d950c..73183e749f 100644 --- a/src/docs/security-threat-model.md +++ b/src/docs/security-threat-model.md @@ -80,6 +80,7 @@ Read each control's exceptions and the residual risks, not just its name. | `ioscan` | Cleans and matches untrusted text, withholds matches, plants canaries and scans agent output for them. See [ioscan.md](ioscan.md). | Prompt injection and secret leakage before and after the agent. | | Trajectory review | A second model compares each agent's assigned intent with its recent transcript and pauses it on drift. Fails open if the reviewer is down. | Multi-step goal drift. | | Token budget | A seven-day budget warns at 90% and stops new tasks when exhausted. | Runaway cost. | +| Fail-closed proxy decisions | Every check on the proxy's request path that cannot be evaluated refuses the request: an unreadable or oversized body, an unparseable GraphQL or Linear document, a policy callback or ownership lookup that errors, panics or times out, and a canary scan that cannot finish. Fault-injection tests cover each seam. See [security-model.md](security-model.md#5-network-and-credentials). | A crash or stall in one check opening a write path, or taking down egress for every agent. | | Shared address classifier | One classifier, `pkg/netguard`, decides which destinations a server-side fetch of a user-supplied URL may reach. It refuses loopback, private, link-local, carrier-grade NAT, multicast, reserved and documentation ranges, IPv6 unique-local and site-local, Teredo and discard-only space, and malformed all-numeric hosts, and it judges IPv4-mapped, NAT64 and 6to4 addresses by the IPv4 address they carry. The full range list is in [security-model.md](security-model.md). | SSRF to cloud metadata and internal services through alternate address spellings. | | Per-user-ID isolation | Each agent has its own Unix user, terminal socket and token file; the proxy attributes connections by user ID. `su-exec` is the only setuid binary, mode 4750. | Cross-agent file access; unattributed network decisions. | | Single sign-on and terminal authorization | Ed25519-signed sessions, short-lived signed terminal assertions, per-hive authorization. | Forged hub or terminal access. | @@ -103,6 +104,12 @@ Read each control's exceptions and the residual risks, not just its name. fails closed at L5–L6. The deterministic rules, canaries and proxy denials are the floor; the language-model classifier adds coverage above it. * **Trajectory review reads transcripts, not reasoning**, and fails open. +* **Unidentified callers can read.** When the proxy cannot attribute a + connection to an agent, it applies advisory mode: GitHub reads are allowed + and writes are refused. Budget limits, credential suppliers and audit sinks + on the proxy path are not fault-guarded, because none of them can turn a + refusal into an allow. See + [security-model.md](security-model.md#5-network-and-credentials). * **Hub compromise is high impact.** The hub still coordinates callbacks, registry data, terminal authorization and fleet visibility.