From 4c0d487a5372b29862186dd0849c31f15750ed9f Mon Sep 17 00:00:00 2001 From: Toni Bergholm Date: Fri, 20 Nov 2026 10:06:52 +0200 Subject: [PATCH 1/4] Reconcile the threat model with the 2026-11-20 security fixes Re-open the TM-001 and TM-002 residual (per-operation authorization, plain rollback without a token), reconcile TM-004, TM-005, TM-007, TM-008, TM-009 and TM-010, and add TM-011 to TM-013. Rows that depend on PRs #151 and #152 say they are not yet merged. Narrative sections are unchanged. --- git.agentic-threat-model.md | 52 ++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/git.agentic-threat-model.md b/git.agentic-threat-model.md index 174c966d..84f3b1bb 100644 --- a/git.agentic-threat-model.md +++ b/git.agentic-threat-model.md @@ -9,6 +9,11 @@ with controls that shipped after this model was written (ADR-0012 `864b5c3`, ADR-0013 `b26777d`, ADR-0014 `beacd65`/#121). Narrative sections (system model, data flows, abuse paths) still describe the 2026-05-21 state and are kept as the original analysis; the table rows and closing notes are the live status. +2026-11-20: reconciled rows TM-001, 002, 004, 005, 007, 008, 009 and 010, the focus-path table and the closing notes with the 2026-11-20 security fixes. +Merged: PRs #145 to #150 (approval-token hardening, strict checkpoint deserialization, prompt write-back hardening, dependency updates, localhost demo binds, pinned CI actions). +Open when written: PR #151 (object address collision, ADR-0018) and PR #152 (sidecar state isolation); rows that depend on them say so. +Added TM-011, TM-012 and TM-013. +TM-001 and TM-002 are reopened for the per-operation authorization residual. The unrevised original is in git history. ## Executive summary @@ -149,16 +154,19 @@ flowchart LR | Threat ID | Threat source | Prerequisites | Threat action | Impact | Impacted assets | Existing controls (evidence) | Gaps | Recommended mitigations | Detection ideas | Likelihood | Impact severity | Priority | |---|---|---|---|---|---|---|---|---|---|---|---|---| -| TM-001 | Sibling worker | Reachable Unix socket; shares UID | `ReadObject` enumeration to dump tuple history | Confidentiality break across tenant tuple state | Tuple snapshots, memory snapshots | `SO_PEERCRED` UID allowlist at accept — `--allowed-uid`, fail-closed startup ([ADR-0012](docs/adr/0012-socket-peer-authentication.md), `864b5c3`, `main.rs`); per-UID connection/rate admission control (issue #118, `limits.rs`); 10 MiB per-response cap (`server.rs`); object-keys are content-addressed | No per-operation authz — an allowlisted UID can call every `Request` variant; `SO_PEERCRED` negative paths are Linux-CI-only (macOS uses `getpeereid`) | ~~Require `SO_PEERCRED`-derived UID match~~ **shipped** (ADR-0012); rate-limit ~~ReadObject~~ **shipped** (#118). Remaining if the worker must be read-limited: per-operation auth-token capability | Audit-log every ReadObject with peer credential; alert on rate spike | high | high | ~~**critical**~~ **closed by ADR-0012** (2026-07-10 reconciliation) | -| TM-002 | Sibling worker | Reachable Unix socket | `Rollback` with `accept_data_loss=true` against IRREVERSIBLE down-migration | Production data loss | Postgres state | Approval gate ([ADR-0014](docs/adr/0014-destructive-rollback-approval-gate.md), `beacd65`/#121): `accept_data_loss=true` rejected unless a signed approval token bound to the requesting peer UID is presented; fail-closed without `--approval-key-file`, no override flag; structured `RollbackForcedDataLoss` audit event; A8 outer-tx atomicity (`migrate::run_reverse`) | Approval-key custody is an operator responsibility outside the daemon | ~~Require an out-of-band operator approval + audit event~~ **shipped** (ADR-0014) | Alert on every `accept_data_loss=true` commit; correlate `RollbackForcedDataLoss` with ADR-0012 peer-UID audit lines | medium | high | ~~**high**~~ **closed by ADR-0014** (2026-07-10 reconciliation) | +| TM-001 | Sibling worker | Reachable Unix socket; shares UID | `ReadObject` enumeration to dump tuple history | Confidentiality break across tenant tuple state | Tuple snapshots, memory snapshots | `SO_PEERCRED` UID allowlist at accept — `--allowed-uid`, fail-closed startup ([ADR-0012](docs/adr/0012-socket-peer-authentication.md), `864b5c3`, `main.rs`); per-UID connection/rate admission control (issue #118, `limits.rs`); 10 MiB per-response cap (`server.rs`); object keys are content-addressed | No per-operation authorization: an allowlisted UID can call every `Request` variant, `ReadObject` included, and in the sidecar shape the worker must be allowlisted to commit, so it can read whatever the daemon can read. `SO_PEERCRED` negative paths are Linux-CI-only (macOS uses `getpeereid`). Per-UID rate limits slow enumeration but do not stop it | ~~Require `SO_PEERCRED`-derived UID match~~ **shipped** (ADR-0012); rate-limit ~~ReadObject~~ **shipped** (#118). **Open, needs a decision (owner not yet assigned):** per-operation authorization, for example a capability token or a separate read-only socket, if the worker must not read history | Audit-log every ReadObject with peer credential; alert on rate spike | high | high | ~~**critical**~~ **residual reopened 2026-11-20:** the peer check and admission control are shipped (ADR-0012, #118); per-operation authorization is open and awaiting an owner decision | +| TM-002 | Sibling worker | Reachable Unix socket | `Rollback` with `accept_data_loss=true` against an IRREVERSIBLE down-migration, or a plain `Rollback` (`accept_data_loss=false`) that needs no token | Production data loss | Postgres state | Approval gate ([ADR-0014](docs/adr/0014-destructive-rollback-approval-gate.md), `beacd65`/#121): `accept_data_loss=true` rejected unless a signed approval token bound to the requesting peer UID is presented; fail-closed without `--approval-key-file`, no override flag; structured `RollbackForcedDataLoss` audit event; A8 outer-tx atomicity (`migrate::run_reverse`). PR #149 (merged): tokens are single-use per daemon process, and a key file readable by group or other aborts startup | The gate covers only `accept_data_loss=true`. A plain rollback (`accept_data_loss=false`) by an allowlisted UID runs reverse migrations not marked IRREVERSIBLE and restores memory without an approval token. The single-use ledger is per process, so a restart or a second daemon accepts a token again until its time window closes. The key-file mode check excludes other UIDs only; a process with the daemon's UID can read a 0600 key. Key custody is an operator responsibility | ~~Require an out-of-band operator approval + audit event~~ **shipped** (ADR-0014, hardened by #149). **Open, needs a decision (owner not yet assigned):** whether plain rollback also needs per-operation authorization, which is the same decision as TM-001 | Alert on every `accept_data_loss=true` commit; correlate `RollbackForcedDataLoss` with ADR-0012 peer-UID audit lines | medium | high | ~~**high**~~ **destructive path closed by ADR-0014 (2026-07-10); residual reopened 2026-11-20:** plain rollback is not gated | | TM-003 | Sibling worker | Reachable Unix socket | Craft `CommitInput` with hostile prompts/tools bytes, no_memory=true | Integrity break: forged tuple recorded as honest snapshot | Tuple snapshots, branch refs | `SO_PEERCRED` allowlist at accept + peer-UID stamped on every Commit (`commit.rs`, threaded from the ADR-0012 dispatch context); frame size cap (16 MiB); commit-lock serializes | No daemon-signed attestation beyond the peer UID; an allowlisted worker can still stage hostile content as its own honest state | ~~Tag commits with peer-UID at the daemon side~~ **shipped** (ADR-0012). Remaining: attestation field signed by the daemon's run identity, if stronger provenance is needed | Diff agent_id field against historical pattern; alert on mismatch | high | medium | ~~**high**~~ **largely closed by ADR-0012** (2026-07-10); residual = attestation depth | -| TM-004 | Sibling worker | Reachable Unix socket | Pipeline `Commit` to hold commit-lock | DoS — worker tickets fail | Daemon availability | Single commit-lock; LocalSet single-threaded | No per-peer rate limit; no max-in-flight | Add per-peer queue depth and a request-rate cap; surface lock-wait metric so saturation is detectable | Lock-wait latency histogram; alert on p99 > N | medium | medium | **medium** | -| TM-005 | Hostile MCP server | Operator-configured URL; HTTPS reachable | `tools/list` returns adversarial canonicalizable payload | Integrity break on tools dimension | Tuple snapshots (tools sub-tree) | Per-call 10 s timeout (`mcp.rs:84`); 8-way concurrency cap | No response body size cap beyond reqwest default; no schema validation of the JSON-RPC result; no allowlist of "trustworthy" MCP servers | Add explicit response-body byte cap (e.g., 1 MiB) before parsing; schema-validate `result.tools` shape; allow operator to mark MCP servers `trusted` vs `untrusted` and behave differently | Log canonical size + JSON depth; alert on outliers | medium | medium | **medium** | +| TM-004 | Sibling worker | Reachable Unix socket | Pipeline `Commit` to hold commit-lock | DoS — worker tickets fail | Daemon availability | Single commit-lock; LocalSet single-threaded; per-UID and global connection caps, per-UID token-bucket request rate, bounded `commit_lock` queue with an observable depth gauge, and read/write idle deadlines (issue #118, `crates/agenticd/src/limits.rs`, defaults validated at startup, enforced in the accept loop after the ADR-0012 UID check) | Limits are static per process and keyed on UID, so a single allowlisted worker UID can still use its whole budget; I found a queue depth gauge but no lock-wait latency histogram | ~~Add per-peer queue depth and a request-rate cap~~ **shipped** (#118). Remaining: surface lock-wait time so saturation is detectable | Lock-wait latency histogram; alert on p99 > N | medium | medium | ~~**medium**~~ **largely mitigated by issue #118** (2026-11-20 reconciliation) | +| TM-005 | Hostile MCP server | Operator-configured URL; HTTPS reachable | `tools/list` returns adversarial canonicalizable payload | Integrity break on tools dimension | Tuple snapshots (tools sub-tree) | Per-call 10 s timeout; 8-way concurrency cap; response body capped at 1 MiB while streaming, JSON depth limit of 32 and a 1 MiB cap on the canonical manifest (`mcp.rs`, PR #117); redirects disabled; https only, with http allowed for loopback hosts, validated at startup ([ADR-0016](docs/adr/0016-mcp-url-policy.md)) | No schema validation of the `result.tools` shape was found; no operator marking of MCP servers as trusted or untrusted. A server can still commit content of its own choosing into the tools dimension, which is the recorded behavior by design | ~~Add explicit response-body byte cap~~ **shipped** (#117). Remaining: schema-validate `result.tools`; optional per-server trust marking | Log canonical size + JSON depth; alert on outliers | medium | medium | ~~**medium**~~ **largely closed by PR #117 and ADR-0016** (2026-11-20 reconciliation); residual = shape validation | | TM-006 | Hostile MCP server | Operator-configured URL | Return slowly, exhaust 10 s; pipeline across all 8 slots | Per-commit latency inflation; cost | Daemon availability | 10 s timeout caps per-call; bounded concurrency | All-malicious server set fully drains the pool every commit | Add per-server failure backoff (skip a failing server for N minutes); make MCP optional on commit if non-blocking is acceptable | Alert on per-server timeout rate | medium | low | **low** | -| TM-007 | Sibling worker (shared UID) | Process can read agenticd's env or config files | Read GCS bearer token, exfiltrate or overwrite bucket | Confidentiality + integrity of all per-tenant GCS data | GCS bearer token, bucket contents | rustls-only; non-root UID 65532; sidecar uses GCS workload identity if configured | If token is in env / file, worker UID can read it | Use GCS workload-identity / metadata-server tokens (short-lived, audience-scoped) rather than static bearer; never write token to disk or env; if static, use Linux capability separation between worker and sidecar | Audit GCS access logs for unexpected source identity | medium | high | **high** | -| TM-008 | Sibling worker | Reachable Unix socket | Stage `Commit` with crafted prompts tree name designed to bypass `validate_tree_entry_name` (Unicode, NFC/NFD normalization) | Arbitrary write inside repo dir as daemon UID | Filesystem outside `prompts/` | `validate_tree_entry_name` rejects non-`Normal` components; `write_blob_safely` symlink-checks (A4) | Validator is `PathBuf::Normal` based; doesn't normalize Unicode; no canonicalize-then-prefix-check | Add canonicalize+prefix-startswith check against the repo's prompts dir; reject any name containing `/`, backslash, NUL, control chars, or non-NFC-normal Unicode | File-system audit log for writes outside `prompts/`; FIM | low | high | **medium** | -| TM-009 | Operator (mistakenly relying on docs) | Operator commits a blob containing a live API token | Secret lands in object store / GCS / Postgres unredacted | Credential leak | Object store, GCS | Scanner enforced at `put_raw` ([ADR-0013](docs/adr/0013-secret-scanner.md), `b26777d`, 2026-05-21): pattern + entropy detectors, typed `SecretDetected` hard-reject, blob-hash allowlist (D4); [ADR-0017](docs/adr/0017-entropy-exemption-for-checkpoint-paths.md) exempts only the entropy heuristic under declared checkpoint prefixes — pattern rules always run | Commit/Tree metadata bypasses the scanner (SEC-002/005, open) | ~~Option A: build the scanner~~ **shipped** (ADR-0013 — Option A was taken). Residual: extend coverage to the metadata path (SEC-002/005) | Log every reject; surface count in `agentic` CLI | high (when operators trust docs) | high | ~~**critical**~~ **closed by ADR-0013** (2026-05-21; reconciled 2026-07-10) | -| TM-010 | Logs handler / panic path | Adapter logs `PgConfig` or panic message; logs ship somewhere less secure | `DATABASE_URL` with password printed | Credential leak | Postgres password | sqlx errors do not by default include the URL | `PgConfig` is `Debug`-derived (`postgres.rs:51`); a `tracing::debug!("{:?}", cfg)` anywhere would print it; no `Redact` on the field | Implement custom `Debug` for `PgConfig` redacting password; add unit test asserting `format!("{cfg:?}")` does not contain password | Static analysis or grep for `{:?}` on PgConfig | low | high | **medium** | +| TM-007 | Sibling worker (shared UID) | Process can read agenticd's env or config files | Read GCS bearer token, exfiltrate or overwrite bucket | Confidentiality + integrity of all per-tenant GCS data | GCS bearer token, bucket contents | rustls-only; non-root UID 65532; `GcsObjectStore` Debug output redacts the token; sidecar uses GCS workload identity if configured ([ADR-0015](docs/adr/0015-gcs-workload-identity.md) is Proposed, not shipped). PR #152 (open) adds `AGENTIC_GCS_TOKEN_FILE` and `--postgres-url-file` so credentials need not sit in env or argv, and redacts Debug output of the memory backend spec | Still open in substance. PR #152 removes env, argv and log exposure only. Containers in one Cloud Run instance share the service identity, so a co-located worker can still obtain bucket access directly. A static token in a file is readable by any process with that UID | Use GCS workload-identity / metadata-server tokens (short-lived, audience-scoped) with a separate identity for the sidecar (ADR-0015); if static, mount the token only into the daemon container (PR #152 documents this) | Audit GCS access logs for unexpected source identity | medium | high | **high** (unchanged 2026-11-20; PR #152 is partial, ADR-0015 Proposed) | +| TM-008 | Sibling worker | Reachable Unix socket | Stage `Commit` with crafted prompts tree name designed to bypass `validate_tree_entry_name` (Unicode, NFC/NFD normalization) | Arbitrary write inside repo dir as daemon UID | Filesystem outside `prompts/` | `validate_tree_entry_name` rejects non-`Normal` components; `write_blob_safely` symlink-checks (A4). PR #150 (merged): prompt preflight runs before any rollback side effect and on dry runs, symlinked directories under the prompts dir are refused, file-versus-directory conflicts are rejected up front, and temp files go in a private (0700) temp directory under the state directory | Unicode normalization equivalence is still open: the validator does not normalize and there is no canonicalize-then-prefix-check. A concurrent swap during a write is a documented residual that relies on the worker not being able to write the repo (see TM-012) | Add canonicalize+prefix-startswith check against the repo's prompts dir; reject any name containing `/`, backslash, NUL, control chars, or non-NFC-normal Unicode | File-system audit log for writes outside `prompts/`; FIM | low | high | **medium** (reduced by PR #150; Unicode normalization open) | +| TM-009 | Operator (mistakenly relying on docs) | Operator commits a blob containing a live API token | Secret lands in object store / GCS / Postgres unredacted | Credential leak | Object store, GCS | Scanner enforced at `put_raw` ([ADR-0013](docs/adr/0013-secret-scanner.md), `b26777d`, 2026-05-21): pattern + entropy detectors, typed `SecretDetected` hard-reject, blob-hash allowlist (D4); [ADR-0017](docs/adr/0017-entropy-exemption-for-checkpoint-paths.md) exempts only the entropy heuristic under declared checkpoint prefixes — pattern rules always run | Commit/Tree metadata bypasses the scanner (SEC-002/005, still open as of 2026-11-20; `store.rs` scans only Blob objects) | ~~Option A: build the scanner~~ **shipped** (ADR-0013 — Option A was taken). Residual: extend coverage to the metadata path (SEC-002/005) | Log every reject; surface count in `agentic` CLI | high (when operators trust docs) | high | ~~**critical**~~ **closed by ADR-0013** (2026-05-21; reconciled 2026-07-10) | +| TM-010 | Logs handler / panic path | Adapter logs `PgConfig` or panic message; logs ship somewhere less secure | `DATABASE_URL` with password printed | Credential leak | Postgres password | sqlx errors do not by default include the URL; `PgConfig` has a manual `Debug` that redacts the password, with a unit test (`postgres.rs`). `MemoryBackendSpec` Debug redaction lands with PR #152 (open) | `MemoryBackendSpec` still derives a Debug that includes the URL until PR #152 merges | ~~Implement custom `Debug` for `PgConfig` redacting password~~ **shipped**; same for `MemoryBackendSpec` in PR #152 | Static analysis or grep for `{:?}` on PgConfig | low | high | **low** (reduced 2026-11-20 reconciliation; closes when PR #152 merges) | +| TM-011 | Sibling worker (controls blob bytes) | Reachable Unix socket; allowlisted UID | Commit content whose object address collides with a raw or typed object, so a later honest write is skipped (or, on GCS, overwritten) | A landed commit that cannot be restored; integrity of stored objects | Tuple snapshots, memory snapshots | Reads are verified against their address, so a wrong occupant fails loudly instead of returning wrong bytes. PR #151 (open) with [ADR-0018](docs/adr/0018-separate-raw-object-namespace.md): separate raw namespace, `AmbiguousBlob` rejection, occupied-address verification, conditional GCS uploads, and rollback refusing legacy ambiguous blobs before any side effect | Not merged yet. Residual after merge: legacy ambiguous blobs in pre-upgrade stores stay readable, a rollback to a commit that references one is refused, and a legacy occupant of another valid kind blocks later puts at its address until an operator removes it (repair is in ADR-0018) | Merge PR #151; check pre-upgrade stores for ambiguous blobs | Alert on `ambiguous_blob` and `address_occupied` wire errors | medium | high | **high** until PR #151 merges; mitigated after it | +| TM-012 | Sibling worker | Worker can write the volume that holds daemon state (the documented sidecar layout put `--repo` on the shared volume) | Alter refs, objects or `schema/*.down.sql`, or rename the repo path, so the daemon acts on worker-chosen state | Integrity break of history; a plain rollback executes the reverse-migration files against Postgres | Tuple snapshots, Postgres state, prompts on disk | PR #152 (open): startup ownership and mode checks on the repo, its ancestors and `.agentic` (tightened to 0700), a daemon-only state volume in `docs/integration/executor-sidecar.md`, and `--trusted-volume-root` for roots only the daemon mounts | Not merged yet. The layout is not verified on Cloud Run. The worker must not share the daemon's primary group. The socket path lives on the shared volume and the worker can replace it | Merge PR #152; test the exact Cloud Run deployment; keep the worker on a different UID and group | Startup refusal logs; FIM on `.agentic` | medium | high | **high** until PR #152 merges and the layout is verified | +| TM-013 | Hostile checkpoint content | Python SDK loads a LangGraph checkpoint an attacker could influence | Checkpoint deserialization reconstructs arbitrary types in the agent process | Code execution in the agent process | Agent process and its credentials | PR #147 (merged): strict msgpack allowlist (`allowed_msgpack_modules=None`), envelope type check, `langgraph-checkpoint>=4.0.1` (`sdk/python/agentic/langgraph.py`, `pyproject.toml`) | `sdk/python/` was out of scope in the original model; added because the fix landed. Strictness depends on the installed `langgraph-checkpoint` meeting the version floor | Keep the version floor; test that unknown types are refused | Log refused types | low | high | ~~**high**~~ **closed by PR #147** (2026-11-20) | ## Criticality calibration @@ -171,18 +179,21 @@ flowchart LR | Path | Why it matters | Related Threat IDs | |---|---|---| -| `crates/agenticd/src/server.rs` (`dispatch`, `DaemonState`) | Single entry point for every adversarial request; no auth/authz layer | TM-001, TM-002, TM-003, TM-004 | -| `crates/agenticd/src/main.rs` (socket bind + accept loop) | The `SO_PEERCRED` / peer-UID check lives here (ADR-0012, shipped) | TM-001, TM-003 | +| `crates/agenticd/src/server.rs` (`dispatch`, `DaemonState`) | Single entry point for every adversarial request; peer auth and admission control sit in front of it, but there is still no per-operation authz layer | TM-001, TM-002, TM-003, TM-004 | +| `crates/agenticd/src/main.rs` (socket bind + accept loop, approval key load) | The `SO_PEERCRED` / peer-UID check lives here (ADR-0012, shipped), as does the approval key-file mode check (PR #149); PR #152 adds state-directory checks here | TM-001, TM-003, TM-002, TM-012 | | `crates/agenticd/src/commit.rs` | `execute` orchestrates the 2PC; peer-UID tagging lives here (ADR-0012, shipped); a signed attestation field would too | TM-003 | -| `crates/agenticd/src/rollback/mod.rs` + `migrate.rs` | `accept_data_loss` flag, reverse migration outer-tx (A8) | TM-002 | -| `crates/agenticd/src/rollback/writeback.rs` | Path-traversal defense surface; Unicode normalization gap | TM-008 | -| `crates/agenticd/src/mcp.rs` (`fingerprint_one`) | Untrusted response parsing; no body-size cap; no schema check | TM-005, TM-006 | -| `crates/agentic-core/src/gcs_store.rs` | Bearer token handling, GCS request authorization | TM-007 | -| `crates/agentic-memory/src/postgres.rs` (`PgConfig` Debug) | Credential-in-logs hygiene | TM-010 | -| `crates/agentic-core/src/store.rs` (`put_raw`) | The secret scanner pre-hook is enforced here (ADR-0013, shipped) | TM-009 | +| `crates/agenticd/src/limits.rs` | Per-UID connection and rate admission control, bounded commit queue (issue #118) | TM-004 | +| `crates/agenticd/src/state_dir.rs` (PR #152, open) and `docs/integration/executor-sidecar.md` | Startup ownership and mode checks on daemon state; sidecar volume layout | TM-012, TM-007 | +| `crates/agenticd/src/rollback/mod.rs` + `migrate.rs` | `approval_gate` (only for `accept_data_loss=true`, single-use tokens), reverse migration outer-tx (A8); plain rollback is ungated | TM-002 | +| `crates/agenticd/src/rollback/writeback.rs` | Path-traversal defense surface: preflight, symlink refusal, private temp directory (PR #150); Unicode normalization gap and write-time swap race remain | TM-008 | +| `crates/agenticd/src/mcp.rs` (`fingerprint_one`) | Untrusted response parsing; body, depth and manifest caps, redirect refusal and URL policy shipped (PR #117, ADR-0016); no `result.tools` shape check | TM-005, TM-006 | +| `crates/agentic-core/src/gcs_store.rs` | Bearer token handling, GCS request authorization; address collision and overwrite behavior (PR #151, ADR-0018) | TM-007, TM-011 | +| `crates/agentic-memory/src/postgres.rs` (`PgConfig` Debug), `crates/agenticd/src/membackend.rs` | Credential-in-logs hygiene; `PgConfig` redacts, `MemoryBackendSpec` redaction is in PR #152 | TM-010 | +| `crates/agentic-core/src/store.rs` (`put_raw`) | The secret scanner pre-hook is enforced here (ADR-0013, shipped); raw-versus-typed address handling (PR #151, ADR-0018) | TM-009, TM-011 | | `CLAUDE.md`, `AGENTS.md`, `docs/architecture/overview.md` §5 | Formerly the source of the unimplemented-scanner claim; the scanner shipped (ADR-0013) and the docs now match the code | TM-009 | | `crates/agentic-proto/src/lib.rs` + `framing.rs` | Wire-protocol schema and frame cap; site for per-Request structural validation | TM-001, TM-003 | -| `crates/agenticd/Dockerfile.sidecar` | Confirms non-root UID; place to assert capability drops, read-only rootfs | TM-007 | +| `sdk/python/agentic/langgraph.py` | Strict checkpoint deserialization (PR #147) | TM-013 | +| `crates/agenticd/Dockerfile.sidecar` | Confirms non-root UID; place to assert capability drops, read-only rootfs; base image is pinned (PR #148) | TM-007, TM-012 | ## Notes on use @@ -191,4 +202,9 @@ flowchart LR **Done** — the scanner shipped 2026-05-21 ([ADR-0013](docs/adr/0013-secret-scanner.md), `b26777d`), Option A taken; residual coverage gap is the Commit/Tree metadata path (SEC-002/005). - The second highest-leverage action was **TM-001 + TM-003**: `SO_PEERCRED` socket auth + peer-UID stamping on Commits. **Done** — shipped 2026-05-21 ([ADR-0012](docs/adr/0012-socket-peer-authentication.md), `864b5c3`), later hardened by issue #118 admission control; residual is per-operation authz and daemon-signed attestation. -- Rows TM-004 (per-peer rate limits — issue #118 shipped queue-depth and rate caps) and TM-005 (MCP body caps + HTTPS-only URL policy — PR #117 and [ADR-0016](docs/adr/0016-mcp-url-policy.md)) also appear partially or fully addressed, but were **not** reconciled in the 2026-07-10 pass; verify and reconcile them in a follow-up. +- Rows TM-004 and TM-005 were reconciled on 2026-11-20: per-UID admission control (issue #118, `limits.rs`) and the MCP response caps, redirect ban and URL policy (PR #117, [ADR-0016](docs/adr/0016-mcp-url-policy.md)) shipped. + Residual for TM-004 is lock-wait visibility; for TM-005 it is `result.tools` shape validation. +- **Open decision (owner not yet assigned):** per-operation authorization on the socket. TM-001 and TM-002 are reopened because an allowlisted UID can call every `Request` variant, and a plain rollback runs without an approval token. +- TM-007 stays open in substance: PR #152 removes env, argv and log exposure of credentials, but containers in one Cloud Run instance share the service identity until [ADR-0015](docs/adr/0015-gcs-workload-identity.md) (Proposed) lands. +- PR #151 (TM-011) and PR #152 (TM-010, TM-012) were open when this was written. Re-check those rows after they merge. +- Supply chain: CI actions and sidecar base images are pinned (PR #148), vulnerable dependencies were updated (PR #145), and demo services bind to localhost (PR #146). From 2bc5942178dda002c6f01c26a2051740fe571854 Mon Sep 17 00:00:00 2001 From: Toni Bergholm Date: Fri, 20 Nov 2026 10:10:51 +0200 Subject: [PATCH 2/4] Correct overclaims in the threat model reconciliation Scope the TM-007 text to what the daemon does: it only consumes a supplied bearer token, ADR-0015 is Proposed and stays inside the shared identity, and PR #152 is an opt-in file path plus Debug redaction. Limit the TM-010 redaction claim to URL userinfo and keep the row open. State the ReadObject payload cap and typed-getter scope in TM-001, and the single-use scope in TM-002. Separate the global commit queue, per-UID rate and accept-time connection caps in TM-004. Narrow the TM-008 preflight claims, the TM-011 verification and ordering claims, the TM-005 priority, and the TM-013 strict-mode behavior. --- git.agentic-threat-model.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/git.agentic-threat-model.md b/git.agentic-threat-model.md index 84f3b1bb..c4d42105 100644 --- a/git.agentic-threat-model.md +++ b/git.agentic-threat-model.md @@ -154,19 +154,19 @@ flowchart LR | Threat ID | Threat source | Prerequisites | Threat action | Impact | Impacted assets | Existing controls (evidence) | Gaps | Recommended mitigations | Detection ideas | Likelihood | Impact severity | Priority | |---|---|---|---|---|---|---|---|---|---|---|---|---| -| TM-001 | Sibling worker | Reachable Unix socket; shares UID | `ReadObject` enumeration to dump tuple history | Confidentiality break across tenant tuple state | Tuple snapshots, memory snapshots | `SO_PEERCRED` UID allowlist at accept — `--allowed-uid`, fail-closed startup ([ADR-0012](docs/adr/0012-socket-peer-authentication.md), `864b5c3`, `main.rs`); per-UID connection/rate admission control (issue #118, `limits.rs`); 10 MiB per-response cap (`server.rs`); object keys are content-addressed | No per-operation authorization: an allowlisted UID can call every `Request` variant, `ReadObject` included, and in the sidecar shape the worker must be allowlisted to commit, so it can read whatever the daemon can read. `SO_PEERCRED` negative paths are Linux-CI-only (macOS uses `getpeereid`). Per-UID rate limits slow enumeration but do not stop it | ~~Require `SO_PEERCRED`-derived UID match~~ **shipped** (ADR-0012); rate-limit ~~ReadObject~~ **shipped** (#118). **Open, needs a decision (owner not yet assigned):** per-operation authorization, for example a capability token or a separate read-only socket, if the worker must not read history | Audit-log every ReadObject with peer credential; alert on rate spike | high | high | ~~**critical**~~ **residual reopened 2026-11-20:** the peer check and admission control are shipped (ADR-0012, #118); per-operation authorization is open and awaiting an owner decision | -| TM-002 | Sibling worker | Reachable Unix socket | `Rollback` with `accept_data_loss=true` against an IRREVERSIBLE down-migration, or a plain `Rollback` (`accept_data_loss=false`) that needs no token | Production data loss | Postgres state | Approval gate ([ADR-0014](docs/adr/0014-destructive-rollback-approval-gate.md), `beacd65`/#121): `accept_data_loss=true` rejected unless a signed approval token bound to the requesting peer UID is presented; fail-closed without `--approval-key-file`, no override flag; structured `RollbackForcedDataLoss` audit event; A8 outer-tx atomicity (`migrate::run_reverse`). PR #149 (merged): tokens are single-use per daemon process, and a key file readable by group or other aborts startup | The gate covers only `accept_data_loss=true`. A plain rollback (`accept_data_loss=false`) by an allowlisted UID runs reverse migrations not marked IRREVERSIBLE and restores memory without an approval token. The single-use ledger is per process, so a restart or a second daemon accepts a token again until its time window closes. The key-file mode check excludes other UIDs only; a process with the daemon's UID can read a 0600 key. Key custody is an operator responsibility | ~~Require an out-of-band operator approval + audit event~~ **shipped** (ADR-0014, hardened by #149). **Open, needs a decision (owner not yet assigned):** whether plain rollback also needs per-operation authorization, which is the same decision as TM-001 | Alert on every `accept_data_loss=true` commit; correlate `RollbackForcedDataLoss` with ADR-0012 peer-UID audit lines | medium | high | ~~**high**~~ **destructive path closed by ADR-0014 (2026-07-10); residual reopened 2026-11-20:** plain rollback is not gated | +| TM-001 | Sibling worker | Reachable Unix socket; shares UID | `ReadObject` enumeration to dump tuple history | Confidentiality break across tenant tuple state | Tuple snapshots, memory snapshots | `SO_PEERCRED` UID allowlist at accept — `--allowed-uid`, fail-closed startup ([ADR-0012](docs/adr/0012-socket-peer-authentication.md), `864b5c3`, `main.rs`); per-UID connection/rate admission control (issue #118, `limits.rs`); 10 MiB cap on the `ReadObject` payload before base64 encoding (`server.rs`); object keys are content-addressed | No per-operation authorization: an allowlisted UID can call every `Request` variant, `ReadObject` included. In the sidecar shape the worker must be allowlisted to commit, so it can read the objects that the typed getter returns (blobs, trees and commits), subject to the 10 MiB payload cap. `SO_PEERCRED` negative paths are Linux-CI-only (macOS uses `getpeereid`). Per-UID rate limits slow enumeration but do not stop it | ~~Require `SO_PEERCRED`-derived UID match~~ **shipped** (ADR-0012); rate-limit ~~ReadObject~~ **shipped** (#118). **Open, needs a decision (owner not yet assigned):** per-operation authorization, for example a capability token or a separate read-only socket, if the worker must not read history | Audit-log every ReadObject with peer credential; alert on rate spike | high | high | ~~**critical**~~ **residual reopened 2026-11-20:** the peer check and admission control are shipped (ADR-0012, #118); per-operation authorization is open and awaiting an owner decision | +| TM-002 | Sibling worker | Reachable Unix socket | `Rollback` with `accept_data_loss=true` against an IRREVERSIBLE down-migration, or a plain `Rollback` (`accept_data_loss=false`) that needs no token | Production data loss | Postgres state | Approval gate ([ADR-0014](docs/adr/0014-destructive-rollback-approval-gate.md), `beacd65`/#121): `accept_data_loss=true` rejected unless a signed approval token bound to the requesting peer UID is presented; fail-closed without `--approval-key-file`, no override flag; structured `RollbackForcedDataLoss` audit event; A8 outer-tx atomicity (`migrate::run_reverse`). PR #149 (merged): tokens are single-use for non-dry-run rollbacks within one daemon process (dry runs verify without consuming), and a key file readable by group or other aborts startup | The gate covers only `accept_data_loss=true`. A plain rollback (`accept_data_loss=false`) by an allowlisted UID runs reverse migrations not marked IRREVERSIBLE and restores memory without an approval token. The single-use ledger is per process, so a restart or a second daemon accepts a token again until its time window closes. The key-file mode check excludes other UIDs only; a process with the daemon's UID can read a 0600 key. Key custody is an operator responsibility | ~~Require an out-of-band operator approval + audit event~~ **shipped** (ADR-0014, hardened by #149). **Open, needs a decision (owner not yet assigned):** whether plain rollback also needs per-operation authorization, which is the same decision as TM-001 | Alert on every `accept_data_loss=true` commit; correlate `RollbackForcedDataLoss` with ADR-0012 peer-UID audit lines | medium | high | ~~**high**~~ **destructive path closed by ADR-0014 (2026-07-10); residual reopened 2026-11-20:** plain rollback is not gated | | TM-003 | Sibling worker | Reachable Unix socket | Craft `CommitInput` with hostile prompts/tools bytes, no_memory=true | Integrity break: forged tuple recorded as honest snapshot | Tuple snapshots, branch refs | `SO_PEERCRED` allowlist at accept + peer-UID stamped on every Commit (`commit.rs`, threaded from the ADR-0012 dispatch context); frame size cap (16 MiB); commit-lock serializes | No daemon-signed attestation beyond the peer UID; an allowlisted worker can still stage hostile content as its own honest state | ~~Tag commits with peer-UID at the daemon side~~ **shipped** (ADR-0012). Remaining: attestation field signed by the daemon's run identity, if stronger provenance is needed | Diff agent_id field against historical pattern; alert on mismatch | high | medium | ~~**high**~~ **largely closed by ADR-0012** (2026-07-10); residual = attestation depth | -| TM-004 | Sibling worker | Reachable Unix socket | Pipeline `Commit` to hold commit-lock | DoS — worker tickets fail | Daemon availability | Single commit-lock; LocalSet single-threaded; per-UID and global connection caps, per-UID token-bucket request rate, bounded `commit_lock` queue with an observable depth gauge, and read/write idle deadlines (issue #118, `crates/agenticd/src/limits.rs`, defaults validated at startup, enforced in the accept loop after the ADR-0012 UID check) | Limits are static per process and keyed on UID, so a single allowlisted worker UID can still use its whole budget; I found a queue depth gauge but no lock-wait latency histogram | ~~Add per-peer queue depth and a request-rate cap~~ **shipped** (#118). Remaining: surface lock-wait time so saturation is detectable | Lock-wait latency histogram; alert on p99 > N | medium | medium | ~~**medium**~~ **largely mitigated by issue #118** (2026-11-20 reconciliation) | -| TM-005 | Hostile MCP server | Operator-configured URL; HTTPS reachable | `tools/list` returns adversarial canonicalizable payload | Integrity break on tools dimension | Tuple snapshots (tools sub-tree) | Per-call 10 s timeout; 8-way concurrency cap; response body capped at 1 MiB while streaming, JSON depth limit of 32 and a 1 MiB cap on the canonical manifest (`mcp.rs`, PR #117); redirects disabled; https only, with http allowed for loopback hosts, validated at startup ([ADR-0016](docs/adr/0016-mcp-url-policy.md)) | No schema validation of the `result.tools` shape was found; no operator marking of MCP servers as trusted or untrusted. A server can still commit content of its own choosing into the tools dimension, which is the recorded behavior by design | ~~Add explicit response-body byte cap~~ **shipped** (#117). Remaining: schema-validate `result.tools`; optional per-server trust marking | Log canonical size + JSON depth; alert on outliers | medium | medium | ~~**medium**~~ **largely closed by PR #117 and ADR-0016** (2026-11-20 reconciliation); residual = shape validation | +| TM-004 | Sibling worker | Reachable Unix socket | Pipeline `Commit` to hold commit-lock | DoS — worker tickets fail | Daemon availability | Single commit-lock; LocalSet single-threaded. Issue #118 (`crates/agenticd/src/limits.rs`), with three separate controls: global and per-UID connection caps checked at accept time after the ADR-0012 UID check; a per-UID token-bucket request rate and read/write idle deadlines checked on the connection after accept; and a global bound on requests queued or executing on `commit_lock`. Limit values are validated at startup | The commit queue bound is global, with no per-peer queue cap, so one allowlisted worker can fill the shared queue and other callers get `commit_queue_full`. Queue depth is an internal counter visible only through debug-level tracing, and there is no lock-wait histogram. Limits are static per process | ~~Add per-peer queue depth and a request-rate cap~~ **partly shipped** (#118): connection caps and a per-UID rate exist. Remaining: per-peer queue share, and an exported queue-depth and lock-wait metric | Lock-wait latency histogram; alert on p99 > N | medium | medium | ~~**medium**~~ **reduced by issue #118** (2026-11-20 reconciliation); residual = shared queue saturation and visibility | +| TM-005 | Hostile MCP server | Operator-configured URL; HTTPS reachable | `tools/list` returns adversarial canonicalizable payload | Integrity break on tools dimension | Tuple snapshots (tools sub-tree) | Transport and resource controls (PR #117, [ADR-0016](docs/adr/0016-mcp-url-policy.md)): per-call 10 s timeout; 8-way concurrency cap; response body capped at 1 MiB while streaming; redirects disabled; https only, with http allowed for loopback hosts, validated at startup. A JSON depth limit of 32 applies to the parsed `result`, and the canonical manifest is capped at 1 MiB (`mcp.rs`) | Manifest integrity is unchanged: no schema validation of the `result.tools` shape was found, so an arbitrary result shape within the caps can be canonicalized and recorded. No operator marking of MCP servers as trusted or untrusted | ~~Add explicit response-body byte cap~~ **shipped** (#117). Remaining: schema-validate `result.tools`; optional per-server trust marking | Log canonical size + JSON depth; alert on outliers | medium | medium | **medium** (unchanged): transport and resource exposure reduced by PR #117 and ADR-0016; the manifest-integrity residual is open | | TM-006 | Hostile MCP server | Operator-configured URL | Return slowly, exhaust 10 s; pipeline across all 8 slots | Per-commit latency inflation; cost | Daemon availability | 10 s timeout caps per-call; bounded concurrency | All-malicious server set fully drains the pool every commit | Add per-server failure backoff (skip a failing server for N minutes); make MCP optional on commit if non-blocking is acceptable | Alert on per-server timeout rate | medium | low | **low** | -| TM-007 | Sibling worker (shared UID) | Process can read agenticd's env or config files | Read GCS bearer token, exfiltrate or overwrite bucket | Confidentiality + integrity of all per-tenant GCS data | GCS bearer token, bucket contents | rustls-only; non-root UID 65532; `GcsObjectStore` Debug output redacts the token; sidecar uses GCS workload identity if configured ([ADR-0015](docs/adr/0015-gcs-workload-identity.md) is Proposed, not shipped). PR #152 (open) adds `AGENTIC_GCS_TOKEN_FILE` and `--postgres-url-file` so credentials need not sit in env or argv, and redacts Debug output of the memory backend spec | Still open in substance. PR #152 removes env, argv and log exposure only. Containers in one Cloud Run instance share the service identity, so a co-located worker can still obtain bucket access directly. A static token in a file is readable by any process with that UID | Use GCS workload-identity / metadata-server tokens (short-lived, audience-scoped) with a separate identity for the sidecar (ADR-0015); if static, mount the token only into the daemon container (PR #152 documents this) | Audit GCS access logs for unexpected source identity | medium | high | **high** (unchanged 2026-11-20; PR #152 is partial, ADR-0015 Proposed) | -| TM-008 | Sibling worker | Reachable Unix socket | Stage `Commit` with crafted prompts tree name designed to bypass `validate_tree_entry_name` (Unicode, NFC/NFD normalization) | Arbitrary write inside repo dir as daemon UID | Filesystem outside `prompts/` | `validate_tree_entry_name` rejects non-`Normal` components; `write_blob_safely` symlink-checks (A4). PR #150 (merged): prompt preflight runs before any rollback side effect and on dry runs, symlinked directories under the prompts dir are refused, file-versus-directory conflicts are rejected up front, and temp files go in a private (0700) temp directory under the state directory | Unicode normalization equivalence is still open: the validator does not normalize and there is no canonicalize-then-prefix-check. A concurrent swap during a write is a documented residual that relies on the worker not being able to write the repo (see TM-012) | Add canonicalize+prefix-startswith check against the repo's prompts dir; reject any name containing `/`, backslash, NUL, control chars, or non-NFC-normal Unicode | File-system audit log for writes outside `prompts/`; FIM | low | high | **medium** (reduced by PR #150; Unicode normalization open) | +| TM-007 | Sibling worker (shared UID) | Process can read agenticd's env or config files | Read GCS bearer token, exfiltrate or overwrite bucket | Confidentiality + integrity of all per-tenant GCS data | GCS bearer token, bucket contents | rustls-only; non-root UID 65532; `GcsObjectStore` Debug output redacts the token. The daemon only consumes a bearer token that is supplied to it and has no workload-identity support. [ADR-0015](docs/adr/0015-gcs-workload-identity.md) is Proposed: it would add token retrieval and refresh, still inside the shared Cloud Run identity. PR #152 (open) adds an opt-in file credential path (`AGENTIC_GCS_TOKEN_FILE`, `--postgres-url-file`) and Debug redaction for the memory backend spec | Still open in substance. PR #152 removes env, argv and log exposure only for deployments that use the file path. Containers in one Cloud Run instance share the service identity, so a co-located worker can still obtain bucket access directly, and identity isolation is not addressed by #152 or by ADR-0015 as proposed. A static token in a file is readable by any process with that UID | Give the sidecar an identity the worker cannot use (not covered by ADR-0015 as proposed); short-lived, audience-scoped tokens; if static, mount the token only into the daemon container (PR #152 documents this) | Audit GCS access logs for unexpected source identity | medium | high | **high** (unchanged 2026-11-20; PR #152 is partial, ADR-0015 Proposed) | +| TM-008 | Sibling worker | Reachable Unix socket | Stage `Commit` with crafted prompts tree name designed to bypass `validate_tree_entry_name` (Unicode, NFC/NFD normalization) | Arbitrary write inside repo dir as daemon UID | Filesystem outside `prompts/` | `validate_tree_entry_name` rejects non-`Normal` components; `write_blob_safely` symlink-checks (A4). PR #150 (merged): before migrations, memory restore and prompt writes (dry runs included), rollback runs a prompt preflight that validates entry names, refuses symlinked directories under the prompts dir, and rejects file-versus-directory conflicts within the incoming tree. Temp files go in a private (0700) temp directory under the state directory, which the preflight can create or chmod | Unicode normalization equivalence is still open: the validator does not normalize and there is no canonicalize-then-prefix-check. The conflict check covers the incoming tree only, so a conflict with an existing entry on disk can still fail during write-back. A concurrent swap during a write is a documented residual that relies on the worker not being able to write the repo (see TM-012) | Add canonicalize+prefix-startswith check against the repo's prompts dir; reject any name containing `/`, backslash, NUL, control chars, or non-NFC-normal Unicode | File-system audit log for writes outside `prompts/`; FIM | low | high | **medium** (reduced by PR #150; Unicode normalization open) | | TM-009 | Operator (mistakenly relying on docs) | Operator commits a blob containing a live API token | Secret lands in object store / GCS / Postgres unredacted | Credential leak | Object store, GCS | Scanner enforced at `put_raw` ([ADR-0013](docs/adr/0013-secret-scanner.md), `b26777d`, 2026-05-21): pattern + entropy detectors, typed `SecretDetected` hard-reject, blob-hash allowlist (D4); [ADR-0017](docs/adr/0017-entropy-exemption-for-checkpoint-paths.md) exempts only the entropy heuristic under declared checkpoint prefixes — pattern rules always run | Commit/Tree metadata bypasses the scanner (SEC-002/005, still open as of 2026-11-20; `store.rs` scans only Blob objects) | ~~Option A: build the scanner~~ **shipped** (ADR-0013 — Option A was taken). Residual: extend coverage to the metadata path (SEC-002/005) | Log every reject; surface count in `agentic` CLI | high (when operators trust docs) | high | ~~**critical**~~ **closed by ADR-0013** (2026-05-21; reconciled 2026-07-10) | -| TM-010 | Logs handler / panic path | Adapter logs `PgConfig` or panic message; logs ship somewhere less secure | `DATABASE_URL` with password printed | Credential leak | Postgres password | sqlx errors do not by default include the URL; `PgConfig` has a manual `Debug` that redacts the password, with a unit test (`postgres.rs`). `MemoryBackendSpec` Debug redaction lands with PR #152 (open) | `MemoryBackendSpec` still derives a Debug that includes the URL until PR #152 merges | ~~Implement custom `Debug` for `PgConfig` redacting password~~ **shipped**; same for `MemoryBackendSpec` in PR #152 | Static analysis or grep for `{:?}` on PgConfig | low | high | **low** (reduced 2026-11-20 reconciliation; closes when PR #152 merges) | -| TM-011 | Sibling worker (controls blob bytes) | Reachable Unix socket; allowlisted UID | Commit content whose object address collides with a raw or typed object, so a later honest write is skipped (or, on GCS, overwritten) | A landed commit that cannot be restored; integrity of stored objects | Tuple snapshots, memory snapshots | Reads are verified against their address, so a wrong occupant fails loudly instead of returning wrong bytes. PR #151 (open) with [ADR-0018](docs/adr/0018-separate-raw-object-namespace.md): separate raw namespace, `AmbiguousBlob` rejection, occupied-address verification, conditional GCS uploads, and rollback refusing legacy ambiguous blobs before any side effect | Not merged yet. Residual after merge: legacy ambiguous blobs in pre-upgrade stores stay readable, a rollback to a commit that references one is refused, and a legacy occupant of another valid kind blocks later puts at its address until an operator removes it (repair is in ADR-0018) | Merge PR #151; check pre-upgrade stores for ambiguous blobs | Alert on `ambiguous_blob` and `address_occupied` wire errors | medium | high | **high** until PR #151 merges; mitigated after it | +| TM-010 | Logs handler / panic path | Adapter logs `PgConfig` or panic message; logs ship somewhere less secure | `DATABASE_URL` with password printed | Credential leak | Postgres password | sqlx errors do not by default include the URL; `PgConfig` has a manual `Debug` that redacts a password in the URL userinfo only, with a unit test (`postgres.rs`). PR #152 (open) redacts the whole URL in the `MemoryBackendSpec` Debug output | The `PgConfig` redaction does not cover a password given in the URL query string, which sqlx also accepts. `MemoryBackendSpec` still derives a Debug that includes the URL until PR #152 merges, and #152 covers that type only | Userinfo redaction in `PgConfig` **shipped**; `MemoryBackendSpec` in PR #152. Remaining: redact or reject a password in the query string; keep a test that no Debug output contains a password | Static analysis or grep for `{:?}` on PgConfig | low | high | **medium** (unchanged 2026-11-20; stays open after PR #152) | +| TM-011 | Sibling worker (controls blob bytes) | Reachable Unix socket; allowlisted UID | Commit content whose object address collides with a raw or typed object, so a later honest write is skipped (or, on GCS, overwritten) | A landed commit that cannot be restored; integrity of stored objects | Tuple snapshots, memory snapshots | Reads are verified against their address, which detects wrong bytes but not the kind of object, so a wrong occupant fails loudly on read instead of returning wrong bytes. PR #151 (open) with [ADR-0018](docs/adr/0018-separate-raw-object-namespace.md): separate raw namespace, `AmbiguousBlob` rejection, conditional GCS uploads, and a put that finds a valid occupant of another kind refuses it as `address_occupied`. Rollback refuses legacy ambiguous blobs before migrations, memory restore and prompt writes (dry runs included) | Not merged yet. Residual after merge: legacy ambiguous blobs in pre-upgrade stores stay readable, a rollback to a commit that references one is refused, and a legacy occupant of another valid kind blocks later puts at its address until an operator removes it (repair is in ADR-0018) | Merge PR #151; check pre-upgrade stores for ambiguous blobs | Alert on `ambiguous_blob` and `address_occupied` wire errors | medium | high | **high** until PR #151 merges; mitigated after it | | TM-012 | Sibling worker | Worker can write the volume that holds daemon state (the documented sidecar layout put `--repo` on the shared volume) | Alter refs, objects or `schema/*.down.sql`, or rename the repo path, so the daemon acts on worker-chosen state | Integrity break of history; a plain rollback executes the reverse-migration files against Postgres | Tuple snapshots, Postgres state, prompts on disk | PR #152 (open): startup ownership and mode checks on the repo, its ancestors and `.agentic` (tightened to 0700), a daemon-only state volume in `docs/integration/executor-sidecar.md`, and `--trusted-volume-root` for roots only the daemon mounts | Not merged yet. The layout is not verified on Cloud Run. The worker must not share the daemon's primary group. The socket path lives on the shared volume and the worker can replace it | Merge PR #152; test the exact Cloud Run deployment; keep the worker on a different UID and group | Startup refusal logs; FIM on `.agentic` | medium | high | **high** until PR #152 merges and the layout is verified | -| TM-013 | Hostile checkpoint content | Python SDK loads a LangGraph checkpoint an attacker could influence | Checkpoint deserialization reconstructs arbitrary types in the agent process | Code execution in the agent process | Agent process and its credentials | PR #147 (merged): strict msgpack allowlist (`allowed_msgpack_modules=None`), envelope type check, `langgraph-checkpoint>=4.0.1` (`sdk/python/agentic/langgraph.py`, `pyproject.toml`) | `sdk/python/` was out of scope in the original model; added because the fix landed. Strictness depends on the installed `langgraph-checkpoint` meeting the version floor | Keep the version floor; test that unknown types are refused | Log refused types | low | high | ~~**high**~~ **closed by PR #147** (2026-11-20) | +| TM-013 | Hostile checkpoint content | Python SDK loads a LangGraph checkpoint an attacker could influence | Checkpoint deserialization reconstructs arbitrary types in the agent process | Code execution in the agent process | Agent process and its credentials | PR #147 (merged): strict msgpack allowlist (`allowed_msgpack_modules=None`), envelope type check, `langgraph-checkpoint>=4.0.1` (`sdk/python/agentic/langgraph.py`, `pyproject.toml`). Strict mode prevents reconstruction of unlisted types and may return the underlying value instead; it does not reject the whole checkpoint. Covered by `test_checkpointer_does_not_reconstruct_unlisted_types` and `test_envelope_rejects_unsafe_serialisation_type` in `sdk/python/tests/test_langgraph.py` | `sdk/python/` was out of scope in the original model; added because the fix landed. Strictness depends on the installed `langgraph-checkpoint` meeting the version floor | Keep the version floor; test that unknown types are refused | Keep the unknown-type test across `langgraph-checkpoint` upgrades; consider logging values that strict mode degrades | A checkpoint that degrades a value is not flagged | high | ~~**high**~~ **closed by PR #147** (2026-11-20) | ## Criticality calibration @@ -202,9 +202,10 @@ flowchart LR **Done** — the scanner shipped 2026-05-21 ([ADR-0013](docs/adr/0013-secret-scanner.md), `b26777d`), Option A taken; residual coverage gap is the Commit/Tree metadata path (SEC-002/005). - The second highest-leverage action was **TM-001 + TM-003**: `SO_PEERCRED` socket auth + peer-UID stamping on Commits. **Done** — shipped 2026-05-21 ([ADR-0012](docs/adr/0012-socket-peer-authentication.md), `864b5c3`), later hardened by issue #118 admission control; residual is per-operation authz and daemon-signed attestation. -- Rows TM-004 and TM-005 were reconciled on 2026-11-20: per-UID admission control (issue #118, `limits.rs`) and the MCP response caps, redirect ban and URL policy (PR #117, [ADR-0016](docs/adr/0016-mcp-url-policy.md)) shipped. - Residual for TM-004 is lock-wait visibility; for TM-005 it is `result.tools` shape validation. +- Rows TM-004 and TM-005 were reconciled on 2026-11-20: per-UID admission control and a global commit queue bound (issue #118, `limits.rs`) and the MCP transport and resource controls (PR #117, [ADR-0016](docs/adr/0016-mcp-url-policy.md)) shipped. + Residual for TM-004 is shared queue saturation and visibility; for TM-005 it is manifest integrity (no `result.tools` shape validation). - **Open decision (owner not yet assigned):** per-operation authorization on the socket. TM-001 and TM-002 are reopened because an allowlisted UID can call every `Request` variant, and a plain rollback runs without an approval token. -- TM-007 stays open in substance: PR #152 removes env, argv and log exposure of credentials, but containers in one Cloud Run instance share the service identity until [ADR-0015](docs/adr/0015-gcs-workload-identity.md) (Proposed) lands. +- TM-007 stays open in substance: PR #152 is an opt-in file credential path plus Debug redaction, which removes env, argv and log exposure only. + The daemon has no workload-identity support, and [ADR-0015](docs/adr/0015-gcs-workload-identity.md) (Proposed) would keep the sidecar inside the shared Cloud Run identity, so identity isolation from a co-located worker remains open. - PR #151 (TM-011) and PR #152 (TM-010, TM-012) were open when this was written. Re-check those rows after they merge. - Supply chain: CI actions and sidecar base images are pinned (PR #148), vulnerable dependencies were updated (PR #145), and demo services bind to localhost (PR #146). From da424b069a923b1c74d17c0dff3853f221842b3d Mon Sep 17 00:00:00 2001 From: Toni Bergholm Date: Fri, 20 Nov 2026 10:13:51 +0200 Subject: [PATCH 3/4] Describe PRs #151 and #152 as merged in the threat model Mark TM-011 mitigated by PR #151 and say plainly that the store verifies the address while the typed loaders enforce the expected kind. Describe PR #152 as merged, and scope its Debug redaction to GcsObjectStore and MemoryBackendSpec. The env and argv claim applies only to credentials supplied through the new file options. GcsObjectStore Debug did not redact the token before #152. Restore the TM-013 mitigation, detection and likelihood cells and drop the claim that unknown types are refused. Update the Revisions header and closing notes. --- git.agentic-threat-model.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/git.agentic-threat-model.md b/git.agentic-threat-model.md index c4d42105..8e146b0a 100644 --- a/git.agentic-threat-model.md +++ b/git.agentic-threat-model.md @@ -11,7 +11,7 @@ Narrative sections (system model, data flows, abuse paths) still describe the 20 the table rows and closing notes are the live status. 2026-11-20: reconciled rows TM-001, 002, 004, 005, 007, 008, 009 and 010, the focus-path table and the closing notes with the 2026-11-20 security fixes. Merged: PRs #145 to #150 (approval-token hardening, strict checkpoint deserialization, prompt write-back hardening, dependency updates, localhost demo binds, pinned CI actions). -Open when written: PR #151 (object address collision, ADR-0018) and PR #152 (sidecar state isolation); rows that depend on them say so. +Also merged: PR #151 (object address collision, ADR-0018, `1e6bd9f`) and PR #152 (sidecar state isolation). Added TM-011, TM-012 and TM-013. TM-001 and TM-002 are reopened for the per-operation authorization residual. The unrevised original is in git history. @@ -160,13 +160,13 @@ flowchart LR | TM-004 | Sibling worker | Reachable Unix socket | Pipeline `Commit` to hold commit-lock | DoS — worker tickets fail | Daemon availability | Single commit-lock; LocalSet single-threaded. Issue #118 (`crates/agenticd/src/limits.rs`), with three separate controls: global and per-UID connection caps checked at accept time after the ADR-0012 UID check; a per-UID token-bucket request rate and read/write idle deadlines checked on the connection after accept; and a global bound on requests queued or executing on `commit_lock`. Limit values are validated at startup | The commit queue bound is global, with no per-peer queue cap, so one allowlisted worker can fill the shared queue and other callers get `commit_queue_full`. Queue depth is an internal counter visible only through debug-level tracing, and there is no lock-wait histogram. Limits are static per process | ~~Add per-peer queue depth and a request-rate cap~~ **partly shipped** (#118): connection caps and a per-UID rate exist. Remaining: per-peer queue share, and an exported queue-depth and lock-wait metric | Lock-wait latency histogram; alert on p99 > N | medium | medium | ~~**medium**~~ **reduced by issue #118** (2026-11-20 reconciliation); residual = shared queue saturation and visibility | | TM-005 | Hostile MCP server | Operator-configured URL; HTTPS reachable | `tools/list` returns adversarial canonicalizable payload | Integrity break on tools dimension | Tuple snapshots (tools sub-tree) | Transport and resource controls (PR #117, [ADR-0016](docs/adr/0016-mcp-url-policy.md)): per-call 10 s timeout; 8-way concurrency cap; response body capped at 1 MiB while streaming; redirects disabled; https only, with http allowed for loopback hosts, validated at startup. A JSON depth limit of 32 applies to the parsed `result`, and the canonical manifest is capped at 1 MiB (`mcp.rs`) | Manifest integrity is unchanged: no schema validation of the `result.tools` shape was found, so an arbitrary result shape within the caps can be canonicalized and recorded. No operator marking of MCP servers as trusted or untrusted | ~~Add explicit response-body byte cap~~ **shipped** (#117). Remaining: schema-validate `result.tools`; optional per-server trust marking | Log canonical size + JSON depth; alert on outliers | medium | medium | **medium** (unchanged): transport and resource exposure reduced by PR #117 and ADR-0016; the manifest-integrity residual is open | | TM-006 | Hostile MCP server | Operator-configured URL | Return slowly, exhaust 10 s; pipeline across all 8 slots | Per-commit latency inflation; cost | Daemon availability | 10 s timeout caps per-call; bounded concurrency | All-malicious server set fully drains the pool every commit | Add per-server failure backoff (skip a failing server for N minutes); make MCP optional on commit if non-blocking is acceptable | Alert on per-server timeout rate | medium | low | **low** | -| TM-007 | Sibling worker (shared UID) | Process can read agenticd's env or config files | Read GCS bearer token, exfiltrate or overwrite bucket | Confidentiality + integrity of all per-tenant GCS data | GCS bearer token, bucket contents | rustls-only; non-root UID 65532; `GcsObjectStore` Debug output redacts the token. The daemon only consumes a bearer token that is supplied to it and has no workload-identity support. [ADR-0015](docs/adr/0015-gcs-workload-identity.md) is Proposed: it would add token retrieval and refresh, still inside the shared Cloud Run identity. PR #152 (open) adds an opt-in file credential path (`AGENTIC_GCS_TOKEN_FILE`, `--postgres-url-file`) and Debug redaction for the memory backend spec | Still open in substance. PR #152 removes env, argv and log exposure only for deployments that use the file path. Containers in one Cloud Run instance share the service identity, so a co-located worker can still obtain bucket access directly, and identity isolation is not addressed by #152 or by ADR-0015 as proposed. A static token in a file is readable by any process with that UID | Give the sidecar an identity the worker cannot use (not covered by ADR-0015 as proposed); short-lived, audience-scoped tokens; if static, mount the token only into the daemon container (PR #152 documents this) | Audit GCS access logs for unexpected source identity | medium | high | **high** (unchanged 2026-11-20; PR #152 is partial, ADR-0015 Proposed) | +| TM-007 | Sibling worker (shared UID) | Process can read agenticd's env or config files | Read GCS bearer token, exfiltrate or overwrite bucket | Confidentiality + integrity of all per-tenant GCS data | GCS bearer token, bucket contents | rustls-only; non-root UID 65532. The daemon only consumes a bearer token that is supplied to it and has no workload-identity support. [ADR-0015](docs/adr/0015-gcs-workload-identity.md) is Proposed: it would add token retrieval and refresh, still inside the shared Cloud Run identity. Merged in PR #152: an opt-in file credential path (`AGENTIC_GCS_TOKEN_FILE`, `--postgres-url-file`), and Debug redaction for `GcsObjectStore` and `MemoryBackendSpec` only | Still open in substance. The env and argv exposure is removed only for credentials supplied through the new file options. Before PR #152 the `GcsObjectStore` Debug output included the token. Containers in one Cloud Run instance share the service identity, so a co-located worker can still obtain bucket access directly, and identity isolation is not addressed by #152 or by ADR-0015 as proposed. A static token in a file is readable by any process with that UID | Give the sidecar an identity the worker cannot use (not covered by ADR-0015 as proposed); short-lived, audience-scoped tokens; if static, mount the token only into the daemon container (documented with PR #152) | Audit GCS access logs for unexpected source identity | medium | high | **high** (unchanged 2026-11-20; PR #152 is partial, ADR-0015 Proposed) | | TM-008 | Sibling worker | Reachable Unix socket | Stage `Commit` with crafted prompts tree name designed to bypass `validate_tree_entry_name` (Unicode, NFC/NFD normalization) | Arbitrary write inside repo dir as daemon UID | Filesystem outside `prompts/` | `validate_tree_entry_name` rejects non-`Normal` components; `write_blob_safely` symlink-checks (A4). PR #150 (merged): before migrations, memory restore and prompt writes (dry runs included), rollback runs a prompt preflight that validates entry names, refuses symlinked directories under the prompts dir, and rejects file-versus-directory conflicts within the incoming tree. Temp files go in a private (0700) temp directory under the state directory, which the preflight can create or chmod | Unicode normalization equivalence is still open: the validator does not normalize and there is no canonicalize-then-prefix-check. The conflict check covers the incoming tree only, so a conflict with an existing entry on disk can still fail during write-back. A concurrent swap during a write is a documented residual that relies on the worker not being able to write the repo (see TM-012) | Add canonicalize+prefix-startswith check against the repo's prompts dir; reject any name containing `/`, backslash, NUL, control chars, or non-NFC-normal Unicode | File-system audit log for writes outside `prompts/`; FIM | low | high | **medium** (reduced by PR #150; Unicode normalization open) | | TM-009 | Operator (mistakenly relying on docs) | Operator commits a blob containing a live API token | Secret lands in object store / GCS / Postgres unredacted | Credential leak | Object store, GCS | Scanner enforced at `put_raw` ([ADR-0013](docs/adr/0013-secret-scanner.md), `b26777d`, 2026-05-21): pattern + entropy detectors, typed `SecretDetected` hard-reject, blob-hash allowlist (D4); [ADR-0017](docs/adr/0017-entropy-exemption-for-checkpoint-paths.md) exempts only the entropy heuristic under declared checkpoint prefixes — pattern rules always run | Commit/Tree metadata bypasses the scanner (SEC-002/005, still open as of 2026-11-20; `store.rs` scans only Blob objects) | ~~Option A: build the scanner~~ **shipped** (ADR-0013 — Option A was taken). Residual: extend coverage to the metadata path (SEC-002/005) | Log every reject; surface count in `agentic` CLI | high (when operators trust docs) | high | ~~**critical**~~ **closed by ADR-0013** (2026-05-21; reconciled 2026-07-10) | -| TM-010 | Logs handler / panic path | Adapter logs `PgConfig` or panic message; logs ship somewhere less secure | `DATABASE_URL` with password printed | Credential leak | Postgres password | sqlx errors do not by default include the URL; `PgConfig` has a manual `Debug` that redacts a password in the URL userinfo only, with a unit test (`postgres.rs`). PR #152 (open) redacts the whole URL in the `MemoryBackendSpec` Debug output | The `PgConfig` redaction does not cover a password given in the URL query string, which sqlx also accepts. `MemoryBackendSpec` still derives a Debug that includes the URL until PR #152 merges, and #152 covers that type only | Userinfo redaction in `PgConfig` **shipped**; `MemoryBackendSpec` in PR #152. Remaining: redact or reject a password in the query string; keep a test that no Debug output contains a password | Static analysis or grep for `{:?}` on PgConfig | low | high | **medium** (unchanged 2026-11-20; stays open after PR #152) | -| TM-011 | Sibling worker (controls blob bytes) | Reachable Unix socket; allowlisted UID | Commit content whose object address collides with a raw or typed object, so a later honest write is skipped (or, on GCS, overwritten) | A landed commit that cannot be restored; integrity of stored objects | Tuple snapshots, memory snapshots | Reads are verified against their address, which detects wrong bytes but not the kind of object, so a wrong occupant fails loudly on read instead of returning wrong bytes. PR #151 (open) with [ADR-0018](docs/adr/0018-separate-raw-object-namespace.md): separate raw namespace, `AmbiguousBlob` rejection, conditional GCS uploads, and a put that finds a valid occupant of another kind refuses it as `address_occupied`. Rollback refuses legacy ambiguous blobs before migrations, memory restore and prompt writes (dry runs included) | Not merged yet. Residual after merge: legacy ambiguous blobs in pre-upgrade stores stay readable, a rollback to a commit that references one is refused, and a legacy occupant of another valid kind blocks later puts at its address until an operator removes it (repair is in ADR-0018) | Merge PR #151; check pre-upgrade stores for ambiguous blobs | Alert on `ambiguous_blob` and `address_occupied` wire errors | medium | high | **high** until PR #151 merges; mitigated after it | -| TM-012 | Sibling worker | Worker can write the volume that holds daemon state (the documented sidecar layout put `--repo` on the shared volume) | Alter refs, objects or `schema/*.down.sql`, or rename the repo path, so the daemon acts on worker-chosen state | Integrity break of history; a plain rollback executes the reverse-migration files against Postgres | Tuple snapshots, Postgres state, prompts on disk | PR #152 (open): startup ownership and mode checks on the repo, its ancestors and `.agentic` (tightened to 0700), a daemon-only state volume in `docs/integration/executor-sidecar.md`, and `--trusted-volume-root` for roots only the daemon mounts | Not merged yet. The layout is not verified on Cloud Run. The worker must not share the daemon's primary group. The socket path lives on the shared volume and the worker can replace it | Merge PR #152; test the exact Cloud Run deployment; keep the worker on a different UID and group | Startup refusal logs; FIM on `.agentic` | medium | high | **high** until PR #152 merges and the layout is verified | -| TM-013 | Hostile checkpoint content | Python SDK loads a LangGraph checkpoint an attacker could influence | Checkpoint deserialization reconstructs arbitrary types in the agent process | Code execution in the agent process | Agent process and its credentials | PR #147 (merged): strict msgpack allowlist (`allowed_msgpack_modules=None`), envelope type check, `langgraph-checkpoint>=4.0.1` (`sdk/python/agentic/langgraph.py`, `pyproject.toml`). Strict mode prevents reconstruction of unlisted types and may return the underlying value instead; it does not reject the whole checkpoint. Covered by `test_checkpointer_does_not_reconstruct_unlisted_types` and `test_envelope_rejects_unsafe_serialisation_type` in `sdk/python/tests/test_langgraph.py` | `sdk/python/` was out of scope in the original model; added because the fix landed. Strictness depends on the installed `langgraph-checkpoint` meeting the version floor | Keep the version floor; test that unknown types are refused | Keep the unknown-type test across `langgraph-checkpoint` upgrades; consider logging values that strict mode degrades | A checkpoint that degrades a value is not flagged | high | ~~**high**~~ **closed by PR #147** (2026-11-20) | +| TM-010 | Logs handler / panic path | Adapter logs `PgConfig` or panic message; logs ship somewhere less secure | `DATABASE_URL` with password printed | Credential leak | Postgres password | sqlx errors do not by default include the URL; `PgConfig` has a manual `Debug` that redacts a password in the URL userinfo only, with a unit test (`postgres.rs`). Merged in PR #152: `MemoryBackendSpec` Debug output redacts the whole URL | The `PgConfig` redaction does not cover a password given in the URL query string, which sqlx also accepts. PR #152 covers `GcsObjectStore` and `MemoryBackendSpec` only | Userinfo redaction in `PgConfig` **shipped**; `MemoryBackendSpec` in PR #152. Remaining: redact or reject a password in the query string; keep a test that no Debug output contains a password | Static analysis or grep for `{:?}` on PgConfig | low | high | **medium** (unchanged 2026-11-20; stays open for the query-string case) | +| TM-011 | Sibling worker (controls blob bytes) | Reachable Unix socket; allowlisted UID | Commit content whose object address collides with a raw or typed object, so a later honest write is skipped (or, on GCS, overwritten) | A landed commit that cannot be restored; integrity of stored objects | Tuple snapshots, memory snapshots | The store verifies that stored bytes match the address (hash), but it can return a valid occupant of a different kind; the caller's typed loaders (for example the rollback loaders `load_commit`, `load_tree` and `load_blob`) enforce the expected kind and fail on a mismatch. PR #151 (merged, `1e6bd9f`) with [ADR-0018](docs/adr/0018-separate-raw-object-namespace.md): separate raw namespace, `AmbiguousBlob` rejection, conditional GCS uploads, and a put that finds a valid occupant of another kind refuses it as `address_occupied`. Rollback refuses legacy ambiguous blobs before migrations, memory restore and prompt writes (dry runs included) | Residual: legacy ambiguous blobs in pre-upgrade stores stay readable, a rollback to a commit that references one is refused, and a legacy occupant of another valid kind blocks later puts at its address until an operator removes it (repair is in ADR-0018) | Check pre-upgrade stores for ambiguous blobs | Alert on `ambiguous_blob` and `address_occupied` wire errors | medium | high | **mitigated by PR #151** (merged); residual = legacy stores | +| TM-012 | Sibling worker | Worker can write the volume that holds daemon state (the documented sidecar layout put `--repo` on the shared volume) | Alter refs, objects or `schema/*.down.sql`, or rename the repo path, so the daemon acts on worker-chosen state | Integrity break of history; a plain rollback executes the reverse-migration files against Postgres | Tuple snapshots, Postgres state, prompts on disk | Merged in PR #152: startup ownership and mode checks on the repo, its ancestors and `.agentic` (tightened to 0700), a daemon-only state volume in `docs/integration/executor-sidecar.md`, and `--trusted-volume-root` for roots only the daemon mounts | The layout is not verified on Cloud Run. The worker must not share the daemon's primary group. The socket path lives on the shared volume and the worker can replace it | Test the exact Cloud Run deployment; keep the worker on a different UID and group | Startup refusal logs; FIM on `.agentic` | medium | high | **mitigated by PR #152** (merged); residual = layout unverified on Cloud Run | +| TM-013 | Hostile checkpoint content | Python SDK loads a LangGraph checkpoint an attacker could influence | Checkpoint deserialization reconstructs arbitrary types in the agent process | Code execution in the agent process | Agent process and its credentials | PR #147 (merged): strict msgpack allowlist (`allowed_msgpack_modules=None`), envelope type check, `langgraph-checkpoint>=4.0.1` (`sdk/python/agentic/langgraph.py`, `pyproject.toml`). Strict mode prevents reconstruction of unlisted types and may return the underlying value instead; it does not reject the whole checkpoint | `sdk/python/` was out of scope in the original model; added because the fix landed. Strictness depends on the installed `langgraph-checkpoint` meeting the version floor | Keep the version floor; keep `test_checkpointer_does_not_reconstruct_unlisted_types` and `test_envelope_rejects_unsafe_serialisation_type` (`sdk/python/tests/test_langgraph.py`) passing across `langgraph-checkpoint` upgrades | Consider logging values that strict mode degrades; a degraded value is not flagged today | low | high | ~~**high**~~ **closed by PR #147** (2026-11-20) | ## Criticality calibration @@ -180,16 +180,16 @@ flowchart LR | Path | Why it matters | Related Threat IDs | |---|---|---| | `crates/agenticd/src/server.rs` (`dispatch`, `DaemonState`) | Single entry point for every adversarial request; peer auth and admission control sit in front of it, but there is still no per-operation authz layer | TM-001, TM-002, TM-003, TM-004 | -| `crates/agenticd/src/main.rs` (socket bind + accept loop, approval key load) | The `SO_PEERCRED` / peer-UID check lives here (ADR-0012, shipped), as does the approval key-file mode check (PR #149); PR #152 adds state-directory checks here | TM-001, TM-003, TM-002, TM-012 | +| `crates/agenticd/src/main.rs` (socket bind + accept loop, approval key load) | The `SO_PEERCRED` / peer-UID check lives here (ADR-0012, shipped), as does the approval key-file mode check (PR #149); PR #152 added state-directory checks here | TM-001, TM-003, TM-002, TM-012 | | `crates/agenticd/src/commit.rs` | `execute` orchestrates the 2PC; peer-UID tagging lives here (ADR-0012, shipped); a signed attestation field would too | TM-003 | | `crates/agenticd/src/limits.rs` | Per-UID connection and rate admission control, bounded commit queue (issue #118) | TM-004 | -| `crates/agenticd/src/state_dir.rs` (PR #152, open) and `docs/integration/executor-sidecar.md` | Startup ownership and mode checks on daemon state; sidecar volume layout | TM-012, TM-007 | +| `crates/agenticd/src/state_dir.rs` (PR #152, merged) and `docs/integration/executor-sidecar.md` | Startup ownership and mode checks on daemon state; sidecar volume layout | TM-012, TM-007 | | `crates/agenticd/src/rollback/mod.rs` + `migrate.rs` | `approval_gate` (only for `accept_data_loss=true`, single-use tokens), reverse migration outer-tx (A8); plain rollback is ungated | TM-002 | | `crates/agenticd/src/rollback/writeback.rs` | Path-traversal defense surface: preflight, symlink refusal, private temp directory (PR #150); Unicode normalization gap and write-time swap race remain | TM-008 | | `crates/agenticd/src/mcp.rs` (`fingerprint_one`) | Untrusted response parsing; body, depth and manifest caps, redirect refusal and URL policy shipped (PR #117, ADR-0016); no `result.tools` shape check | TM-005, TM-006 | -| `crates/agentic-core/src/gcs_store.rs` | Bearer token handling, GCS request authorization; address collision and overwrite behavior (PR #151, ADR-0018) | TM-007, TM-011 | -| `crates/agentic-memory/src/postgres.rs` (`PgConfig` Debug), `crates/agenticd/src/membackend.rs` | Credential-in-logs hygiene; `PgConfig` redacts, `MemoryBackendSpec` redaction is in PR #152 | TM-010 | -| `crates/agentic-core/src/store.rs` (`put_raw`) | The secret scanner pre-hook is enforced here (ADR-0013, shipped); raw-versus-typed address handling (PR #151, ADR-0018) | TM-009, TM-011 | +| `crates/agentic-core/src/gcs_store.rs` | Bearer token handling, GCS request authorization; address collision and overwrite behavior (PR #151 merged, ADR-0018) | TM-007, TM-011 | +| `crates/agentic-memory/src/postgres.rs` (`PgConfig` Debug), `crates/agenticd/src/membackend.rs` | Credential-in-logs hygiene; `PgConfig` redacts, `MemoryBackendSpec` redaction is in PR #152; the query-string password case is not covered | TM-010 | +| `crates/agentic-core/src/store.rs` (`put_raw`) | The secret scanner pre-hook is enforced here (ADR-0013, shipped); raw-versus-typed address handling (PR #151 merged, ADR-0018) | TM-009, TM-011 | | `CLAUDE.md`, `AGENTS.md`, `docs/architecture/overview.md` §5 | Formerly the source of the unimplemented-scanner claim; the scanner shipped (ADR-0013) and the docs now match the code | TM-009 | | `crates/agentic-proto/src/lib.rs` + `framing.rs` | Wire-protocol schema and frame cap; site for per-Request structural validation | TM-001, TM-003 | | `sdk/python/agentic/langgraph.py` | Strict checkpoint deserialization (PR #147) | TM-013 | @@ -205,7 +205,9 @@ flowchart LR - Rows TM-004 and TM-005 were reconciled on 2026-11-20: per-UID admission control and a global commit queue bound (issue #118, `limits.rs`) and the MCP transport and resource controls (PR #117, [ADR-0016](docs/adr/0016-mcp-url-policy.md)) shipped. Residual for TM-004 is shared queue saturation and visibility; for TM-005 it is manifest integrity (no `result.tools` shape validation). - **Open decision (owner not yet assigned):** per-operation authorization on the socket. TM-001 and TM-002 are reopened because an allowlisted UID can call every `Request` variant, and a plain rollback runs without an approval token. -- TM-007 stays open in substance: PR #152 is an opt-in file credential path plus Debug redaction, which removes env, argv and log exposure only. +- TM-007 stays open in substance: PR #152 added an opt-in file credential path (`AGENTIC_GCS_TOKEN_FILE`, `--postgres-url-file`) and Debug redaction for `GcsObjectStore` and `MemoryBackendSpec` only. + The env and argv exposure is removed only for credentials supplied through those file options. The daemon has no workload-identity support, and [ADR-0015](docs/adr/0015-gcs-workload-identity.md) (Proposed) would keep the sidecar inside the shared Cloud Run identity, so identity isolation from a co-located worker remains open. -- PR #151 (TM-011) and PR #152 (TM-010, TM-012) were open when this was written. Re-check those rows after they merge. +- PR #151 (TM-011, merged) leaves one residual: legacy ambiguous blobs in pre-upgrade stores. +- PR #152 (TM-007, TM-010, TM-012, merged) leaves the Cloud Run layout unverified (TM-012) and the `PgConfig` query-string password case (TM-010). - Supply chain: CI actions and sidecar base images are pinned (PR #148), vulnerable dependencies were updated (PR #145), and demo services bind to localhost (PR #146). From 387ccc1031215bb8bb1b8312319bb15b11b3e9bf Mon Sep 17 00:00:00 2001 From: Toni Bergholm Date: Fri, 20 Nov 2026 10:15:22 +0200 Subject: [PATCH 4/4] Point TM-013 at the upstream warning and keep both legacy outcomes --- git.agentic-threat-model.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git.agentic-threat-model.md b/git.agentic-threat-model.md index 8e146b0a..6aa789f3 100644 --- a/git.agentic-threat-model.md +++ b/git.agentic-threat-model.md @@ -166,7 +166,7 @@ flowchart LR | TM-010 | Logs handler / panic path | Adapter logs `PgConfig` or panic message; logs ship somewhere less secure | `DATABASE_URL` with password printed | Credential leak | Postgres password | sqlx errors do not by default include the URL; `PgConfig` has a manual `Debug` that redacts a password in the URL userinfo only, with a unit test (`postgres.rs`). Merged in PR #152: `MemoryBackendSpec` Debug output redacts the whole URL | The `PgConfig` redaction does not cover a password given in the URL query string, which sqlx also accepts. PR #152 covers `GcsObjectStore` and `MemoryBackendSpec` only | Userinfo redaction in `PgConfig` **shipped**; `MemoryBackendSpec` in PR #152. Remaining: redact or reject a password in the query string; keep a test that no Debug output contains a password | Static analysis or grep for `{:?}` on PgConfig | low | high | **medium** (unchanged 2026-11-20; stays open for the query-string case) | | TM-011 | Sibling worker (controls blob bytes) | Reachable Unix socket; allowlisted UID | Commit content whose object address collides with a raw or typed object, so a later honest write is skipped (or, on GCS, overwritten) | A landed commit that cannot be restored; integrity of stored objects | Tuple snapshots, memory snapshots | The store verifies that stored bytes match the address (hash), but it can return a valid occupant of a different kind; the caller's typed loaders (for example the rollback loaders `load_commit`, `load_tree` and `load_blob`) enforce the expected kind and fail on a mismatch. PR #151 (merged, `1e6bd9f`) with [ADR-0018](docs/adr/0018-separate-raw-object-namespace.md): separate raw namespace, `AmbiguousBlob` rejection, conditional GCS uploads, and a put that finds a valid occupant of another kind refuses it as `address_occupied`. Rollback refuses legacy ambiguous blobs before migrations, memory restore and prompt writes (dry runs included) | Residual: legacy ambiguous blobs in pre-upgrade stores stay readable, a rollback to a commit that references one is refused, and a legacy occupant of another valid kind blocks later puts at its address until an operator removes it (repair is in ADR-0018) | Check pre-upgrade stores for ambiguous blobs | Alert on `ambiguous_blob` and `address_occupied` wire errors | medium | high | **mitigated by PR #151** (merged); residual = legacy stores | | TM-012 | Sibling worker | Worker can write the volume that holds daemon state (the documented sidecar layout put `--repo` on the shared volume) | Alter refs, objects or `schema/*.down.sql`, or rename the repo path, so the daemon acts on worker-chosen state | Integrity break of history; a plain rollback executes the reverse-migration files against Postgres | Tuple snapshots, Postgres state, prompts on disk | Merged in PR #152: startup ownership and mode checks on the repo, its ancestors and `.agentic` (tightened to 0700), a daemon-only state volume in `docs/integration/executor-sidecar.md`, and `--trusted-volume-root` for roots only the daemon mounts | The layout is not verified on Cloud Run. The worker must not share the daemon's primary group. The socket path lives on the shared volume and the worker can replace it | Test the exact Cloud Run deployment; keep the worker on a different UID and group | Startup refusal logs; FIM on `.agentic` | medium | high | **mitigated by PR #152** (merged); residual = layout unverified on Cloud Run | -| TM-013 | Hostile checkpoint content | Python SDK loads a LangGraph checkpoint an attacker could influence | Checkpoint deserialization reconstructs arbitrary types in the agent process | Code execution in the agent process | Agent process and its credentials | PR #147 (merged): strict msgpack allowlist (`allowed_msgpack_modules=None`), envelope type check, `langgraph-checkpoint>=4.0.1` (`sdk/python/agentic/langgraph.py`, `pyproject.toml`). Strict mode prevents reconstruction of unlisted types and may return the underlying value instead; it does not reject the whole checkpoint | `sdk/python/` was out of scope in the original model; added because the fix landed. Strictness depends on the installed `langgraph-checkpoint` meeting the version floor | Keep the version floor; keep `test_checkpointer_does_not_reconstruct_unlisted_types` and `test_envelope_rejects_unsafe_serialisation_type` (`sdk/python/tests/test_langgraph.py`) passing across `langgraph-checkpoint` upgrades | Consider logging values that strict mode degrades; a degraded value is not flagged today | low | high | ~~**high**~~ **closed by PR #147** (2026-11-20) | +| TM-013 | Hostile checkpoint content | Python SDK loads a LangGraph checkpoint an attacker could influence | Checkpoint deserialization reconstructs arbitrary types in the agent process | Code execution in the agent process | Agent process and its credentials | PR #147 (merged): strict msgpack allowlist (`allowed_msgpack_modules=None`), envelope type check, `langgraph-checkpoint>=4.0.1` (`sdk/python/agentic/langgraph.py`, `pyproject.toml`). Strict mode prevents reconstruction of unlisted types and may return the underlying value instead; it does not reject the whole checkpoint | `sdk/python/` was out of scope in the original model; added because the fix landed. Strictness depends on the installed `langgraph-checkpoint` meeting the version floor | Keep the version floor; keep `test_checkpointer_does_not_reconstruct_unlisted_types` and `test_envelope_rejects_unsafe_serialisation_type` (`sdk/python/tests/test_langgraph.py`) passing across `langgraph-checkpoint` upgrades | `langgraph-checkpoint` logs a warning and emits a `msgpack_blocked` serde event before returning the underlying value; alert on either | low | high | ~~**high**~~ **closed by PR #147** (2026-11-20) | ## Criticality calibration @@ -208,6 +208,6 @@ flowchart LR - TM-007 stays open in substance: PR #152 added an opt-in file credential path (`AGENTIC_GCS_TOKEN_FILE`, `--postgres-url-file`) and Debug redaction for `GcsObjectStore` and `MemoryBackendSpec` only. The env and argv exposure is removed only for credentials supplied through those file options. The daemon has no workload-identity support, and [ADR-0015](docs/adr/0015-gcs-workload-identity.md) (Proposed) would keep the sidecar inside the shared Cloud Run identity, so identity isolation from a co-located worker remains open. -- PR #151 (TM-011, merged) leaves one residual: legacy ambiguous blobs in pre-upgrade stores. +- PR #151 (TM-011, merged) leaves one residual in pre-upgrade stores: a legacy blob that is the canonical JSON of a Tree or Commit makes a rollback to a commit that references it refuse before any side effect, and a valid legacy occupant of another kind makes a later put at its address fail with `address_occupied` (repair step in ADR-0018). - PR #152 (TM-007, TM-010, TM-012, merged) leaves the Cloud Run layout unverified (TM-012) and the `PgConfig` query-string password case (TM-010). - Supply chain: CI actions and sidecar base images are pinned (PR #148), vulnerable dependencies were updated (PR #145), and demo services bind to localhost (PR #146).