Skip to content

v4.0.3

Latest

Choose a tag to compare

@github-actions github-actions released this 02 Dec 19:51
9dfe6ea

A patch release on top of v4.0.2 covering multi-tenant route and stream scope isolation, MCP URL path containment and authenticated task actor binding, runtime role-adapter policy enforcement, ACP v1 JSON-RPC support and session journal descriptor containment, task artifact descriptor binding, EdDSA agent identity JWTs, webhook trigger governance, and workflow/CLI lifecycle fixes. Review the upgrade notes below before upgrading if you use authenticated task-server clients, persisted .sdd/security/role_adapter_policy.json files, or .sdd/config/triggers.yaml.

Tenant scope, authenticated actors, and identity signing

  • Principal-bound tenant scope across routes and streams: Session-to-tenant and A2A-task-to-tenant ownership are indexed across registries and enforced across session, approval, A2A, task, cost, identity, plan, mission, team, SCIM, and dashboard route handlers as well as SSE and WebSocket subscriber and publisher gates (#8272).
  • MCP URL path-segment containment and authenticated actor binding: MCP client calls validate administrative run_id values (^admin-[a-f0-9]{32}$ with control-character rejection), MCP Tasks taskId handles (tasks/get, tasks/result, tasks/cancel), and tool-level path segments (rejecting . and .. dot-segments, query/fragment server_url bases, and verifying canonical httpx.URL paths) before issuing authenticated requests (#8273). POST /tasks/{task_id}/artifacts resolves claim-holder authorization and audit attribution strictly from SSOAuthMiddleware-bound credentials, forwarding x-bernstein-agent-id from bernstein_post_artifact only when no bearer credential is configured for local auth-disabled development. Breaking / migration: On authenticated servers, claimer_id on POST /tasks/claim-receipt, poster on POST /tasks/{task_id}/artifacts, and sender on POST /tasks/{task_id}/messages must match the caller's authenticated principal (agent_identity.id/session_id, SSO user.id/email, JWT agent_id/sub, or "operator" for the legacy static bearer token), and fleet-shared cluster credentials are refused with HTTP 403 on per-agent claim-receipt and mailbox endpoints (#8273).
  • Runtime role-adapter policy enforcement: AgentSpawner loads <workdir>/.sdd/security/role_adapter_policy.json on runtime dispatch and enforces per-role adapter allow-lists across cached adapter lookups, initial spawns, provider failovers, isolation/bridge/in-process backends, and crash-resume sessions (#6648, #8258, #8271). Behavior change on upgrade: Persisted .sdd/security/role_adapter_policy.json files written in earlier releases now take effect immediately at runtime (including "*": [] default-deny rules), and unreadable, symlinked, non-regular, duplicate-key, deeply nested, invalid JSON/UTF-8, or mistyped policy files fail closed with RolePolicyConfigError until fixed or removed. Operator-configured directory symlinks at <workdir>/.sdd remain supported while symlinks beneath .sdd (security/, role_adapter_policy.json) are refused via anchored O_NOFOLLOW descriptor walks on POSIX and path-level symlink checks on Windows; bernstein security role-adapter-policy show|set|test shares the same loader and alias checks, SpawnAnalyzer treats RoleAdapterDenied as non-transient, router availability is restored on failed spawns, and pre-claimed warm-pool slots are released on SamplingParamsRefusal and non-fallback BridgeError denials.
  • EdDSA (Ed25519) agent identity JWTs: AgentIdentityStore.create_identity signs agent identity tokens with asymmetric EdDSA (Ed25519) instead of symmetric HS256, using an out-of-workdir KMSAdapter signing key (0600 mode enforced; keys under .sdd/ refused) and publishing the public key at /.well-known/agent.json/keys under its matching kid (#8193, #8197). _authenticate_jwt binds verification to each MAC-authenticated credential record's stored algorithm, refusing header mismatches; existing unexpired HS256 tokens continue verifying until expiry while BERNSTEIN_AUTH_JWT_SECRET logs a deprecation warning and will be removed one minor release later.
  • Loopback host allowlist and token-file hardening: Non-loopback Host rejections on loopback servers name BERNSTEIN_ALLOWED_HOSTS (exact lowercase hostnames, without port or wildcards) in the HTTP 403 detail payload and CLI reference, .sdd/runtime/auth.token reuse verifies via lstat/fstat that the file is regular, owner-only, and UID-matched before reuse (rotating unsafe files), and shadowed /agents/{session_id}/* handlers in task_crud are removed (#8189, #8195).

Descriptor containment for ACP journals, task artifacts, and file locks

  • ACP session journal containment, read bounds, and binary appends: EventJournal, resolve_session_journal_path, and project_journal_to_acp_updates pin canonical .sdd/runs/<run_id> directory names, traverse .sdd -> runs -> <run_id> -> journal.jsonl via O_DIRECTORY | O_NOFOLLOW-anchored descriptors on POSIX, and refuse symlinks, Windows directory junctions, FILE_ATTRIBUTE_REPARSE_POINT entries (including OneDrive or storage-deduplication reparse points under .sdd/runs/), hardlinks (st_nlink != 1), and non-regular files with UnsafeJournalError (#8231, #8274). ACP session/load projection (RESOURCE_NOT_FOUND when exceeded) and strict EventJournal.resume enforce a streaming 64 MiB read ceiling (MAX_JOURNAL_READ_BYTES) while leaving non-ACP EventJournal.resume unbounded unless max_bytes is supplied, and journal appends write unbuffered binary rows (0600 mode on open) with canonical LF (\n) line endings across platforms (#8274).
  • Task artifact descriptor binding: load_artifact() opens .sdd/outbox/<task-id>/artifact (or the task's declared relative output_path) through a step-by-step O_NOFOLLOW / O_DIRECTORY descriptor walk rooted at an O_NOFOLLOW-anchored workdir descriptor, refusing symlinked workdir roots, escaping symlinks, walks exceeding hop/depth/step ceilings, cross-device targets, FIFOs/devices (O_NONBLOCK + fstat), oversized artifacts (max_bytes), mid-read file mutations, and st_nlink > 1 hardlinks while preserving within-workdir symlinks and raising ArtifactCompletionError without leaking target bytes (#8275).
  • POSIX filelock 4.2.1 regression coverage: Added tests/unit/security/test_filelock_posix_regression.py guarding the transitive filelock >= 4.2.1 upgrade (#6788) against CVE-2026-112940 / GHSA-v4x8-3wr5-3wq8 (symlink lock refusal, planted SQLite -wal/-journal isolation, and WAL-mode lock database rejection) while keeping Windows advisories CVE-2026-112907 and CVE-2026-112913 covered by the >= 4.2.1 pin (#6759, #8228).

ACP v1 bridge, webhook governance, and receipt verification

  • ACP v1 JSON-RPC bridge and embedded session runner: bernstein acp serve supports ACP v1 (protocolVersion: 1) over line-delimited JSON-RPC 2.0 on stdio (diagnostics routed to stderr) and loopback HTTP/SSE (POST /acp), alongside the legacy "2025-04-01" dialect (#8211, #8212, #8213). Implements initialize, authenticate, session/new, session/load, session/set_mode, blocking session/prompt, session/cancel, bidirectional session/update and session/request_permission multiplexing, embedded runner execution (--allow-embedded-http required on loopback --http; auto mode and require_auth=True fail closed; per-IP HTTP session ownership with documented limits), persisted .bernstein/always_allow.yaml rules pinned by .sdd/config/always_allow.manifest.json, session/load replay starting in manual mode (capped at 2,000 updates / 16 MiB), bernstein acp serve --setup, CI ACP v1 conformance gating, and packaging/acp-registry/bernstein/ assets.
  • Trigger governance for Slack Events API and GitHub workflow_run: POST /webhooks/slack/events and GitHub workflow_run/completed deliveries on POST /webhooks/github pass through .sdd/config/triggers.yaml via TriggerManager.gate_direct_task before creating tasks (#4545, #8233). Matching slack and github_workflow_run rules enforce filters, tenant-scoped cooldown, and per-delivery deduplication (including built-in bot senders bernstein[bot] and github-actions[bot]) prior to CI log downloads or git blame/diff; absent, triggers: [], or unmatched configs remain pass-throughs, while corrupt, unreadable, quarantined, or 0-byte triggers.yaml files fail closed with HTTP 503 (keeping Slack url_verification at 200; repair triggers.yaml within Slack's retry window or redeliver missed GitHub webhook events from Recent Deliveries).
  • Offline tool-call effect and retry receipt verification: verify-audit-receipt and standalone bernstein-verify-receipt validate toolcall.attestation -> toolcall.enforced_dispatch -> toolcall.effect triples and ToolCallIntent.retry_of x402 retry links without importing bernstein.*, stream-hashing <intent_sha256>.effect payloads (16 MiB cap) when --effects-dir is passed and reporting effect unobserved when no effect row was recorded (#6270, #8227).

Workflows, runtime lifecycle, CLI, and CI hygiene

  • Workflow command tree reaping and pipe draining: WorkflowRunner._execute_command runs command nodes in isolated POSIX process groups or supervised Windows Job Objects, drains stdout/stderr via non-blocking cancellable readers (4 MiB per-stream cap) before reaping the leader, escalates SIGTERM to SIGKILL / TerminateJobObject with ESRCH / ActiveProcesses == 0 confirmation, validates cleanup_confirmed and reap_receipt fail-closed across .node.json/.loop.json checkpoints, skips downstream always_run nodes, and refuses bernstein workflow resume when cleanup was unconfirmed (#8256, #8257).
  • Workflow checkpoints, goal binding, UTF-8 errors, and task replay: Command workflows checkpoint each loop iteration while keeping the original iteration limit and halting recovery on uncertain post-dispatch state (#7855, #7882); workflow runs bind their initial goal to the run ID and refuse resume on goal mismatch (#7856, #7883); invalid UTF-8 workflow manifests raise WorkflowSpecError naming the file and byte offset across validate, run --dry-run, and list --dir (#7869, #8119); bernstein resume and bernstein ledger resume issue deterministic request_id values tracked in .sdd/runtime/resume/<task-id>.requests.json with worker-confirmed runtime_acknowledged status (#7854, #8196); and TaskStore persists and fail-closed replays approval_spec (#7028, #8199).
  • Run finalization wait and PID teardown guards: bernstein run --wait (and --quiet) waits for run_completed and run-bound .finalizing -> .finalized completion (30s post-quiescence grace window, dead-PID short-circuit, EXIT_RUN_UNHEALTHY on unfinalized quiescence) before signalling POST /shutdown (#6089, #7705). PreviewManager records process start identity via lazy psutil and Linux /proc/<pid>/stat starttime ticks and fails closed before sending SIGTERM on missing psutil, invalid/group/own PIDs, or mismatched reused PIDs while auditing preview.stop and cleaning persisted state (#8235), and bernstein gui _stop_tunnel guards against signaling pid <= 1 (#8218).
  • CLI, verification types, benchmarks, and CI isolation: bernstein worktrees gc reports worktree.gc hook success only when directory removal succeeds (#7963); bernstein plan ls and bernstein plan show ignore directories named *.yaml (#7943, #8113); bernstein doctor passes --no-sync to uv run version probes (#8243); canonical ReceiptVerification, CheckOutcome, and FailuresResult dataclasses consolidate 11 non-security verification result shapes (#5099, #7689); self-conformance-bench-v1 adds five bounded benchmark-envelope verifier probes (#5451, #7714); tests/fixtures/scanners/.gitignore excludes vulnerable scanner fixture targets from OSSF Scorecard (#6068, #8226); and PR comment/autosync writes are isolated in .github/workflows/pr-publish.yml under environment: automation (operator action: move BERNSTEIN_AUTOSYNC_TOKEN from repository secrets to the automation environment before enabling the publisher) (#7940).

Upgrading

pipx upgrade bernstein     # or: uv tool upgrade bernstein

Before upgrading:

  • On authenticated task servers, ensure clients calling POST /tasks/claim-receipt, POST /tasks/{task_id}/artifacts, and POST /tasks/{task_id}/messages send claimer_id, poster, and sender matching their authenticated principal and use per-agent credentials rather than fleet-shared cluster credentials (#8273).
  • Inspect or remove any legacy .sdd/security/role_adapter_policy.json file that should not be enforced at runtime (#6648), and verify any .sdd/config/triggers.yaml file is valid YAML with a triggers key (#4545).

What's Changed

  • fix(security,gui): harden loopback host guard, token reuse, and OpenAPI schema by @chernistry in #8189
  • docs(gui): document loopback API bearer reuse, SSE auth, and host guard by @chernistry in #8182
  • docs: point the security review and DAG alias at commands that exist by @vaibhav8a in #7061
  • fix(routes,docs): remove shadowed task_crud agent routes and document BERNSTEIN_ALLOWED_HOSTS syntax by @chernistry in #8195
  • ci(digest): add allowlisted weekly code quality summary section by @chernistry in #8190
  • feat(#8193): sign agent identity tokens with EdDSA instead of HS256 by @chernistry in #8197
  • fix(resume): deterministic request ids and real runtime acknowledgement by @chernistry in #8196
  • fix(tasks): persist and safely replay approval_spec (#7028) by @chernistry in #8199
  • fix(planning): plan queries ignore directories named *.yaml (#7943) by @vaibhav8a in #8113
  • fix(workflows): report a manifest that is not valid UTF-8 (#7869) by @vaibhav8a in #8119
  • docs: point nine source references at the files that exist by @vaibhav8a in #7066
  • chore(deps): update gitea/gitea docker tag to v28.4 by @renovate[bot] in #8185
  • chore(deps): update dependency vitest to v5.1.1 by @renovate[bot] in #8174
  • feat(acp): ACP v1 wire schema, bidirectional transport, and handshake by @chernistry in #8211
  • docs: add enforced invariants page by @chernistry in #8214
  • chore(deps): hold agent-manifest at 0.12.x in Renovate and Dependabot by @chernistry in #8220
  • chore(ci): label crate-ci/typos SHA pins with exact v1.52.0 tag by @chernistry in #8221
  • feat(acp): embedded session runner, journal updates, approvals, and session/load by @chernistry in #8213
  • docs(ci): document manual merge-queue enqueue for Dependabot PRs (#6845) by @chernistry in #8224
  • chore(ci): update reviewed crate-ci/typos pin to v1.52.2 by @chernistry in #8223
  • fix(ci): pin Node 24 in self-hosted VPS workflows and cap Renovate by @chernistry in #8219
  • fix(ci): ignore scanner fixture targets for Scorecard vulnerabilities scan by @chernistry in #8226
  • test(security): add POSIX regression suite and release note for filelock 4.2.1 by @chernistry in #8228
  • fix(gui): guard _stop_tunnel against signaling non-process PIDs by @chernistry in #8218
  • chore(deps): update dependency pymdown-extensions to v13.1.2 by @renovate[bot] in #8229
  • chore(deps): update dependency mkdocs-material to v9.8.2 by @renovate[bot] in #8217
  • chore(deps): update dependency backrefs to v8.3.1 by @renovate[bot] in #8216
  • docs: regenerate adapter last-green table from canary receipts by @chernistry in #8240
  • chore(deps): update dependency pyyaml to v6.0.4 by @renovate[bot] in #8244
  • Isolate PR observability and autosync write credentials by @chernistry in #7940
  • ci: add verify-cli test suite and standalone wheel smoke job by @chernistry in #8241
  • fix(preview): fail-closed PID identity guard using process start time by @chernistry in #8235
  • Report worktree removal outcomes to the GC hook by @chernistry in #7963
  • fix(acp): refuse hardlinked and non-regular session journals by @chernistry in #8231
  • fix(doctor): pass --no-sync to uv run tool version probes by @chernistry in #8243
  • feat(security): verify toolcall effect triples and retry_of linkage in offline receipt verifiers by @chernistry in #8227
  • fix(security): measure benchmark envelope conformance (#5451) by @chernistry in #7714
  • fix(tests): isolate working directory with monkeypatch.chdir by @chernistry in #8236
  • docs: regenerate adapter last-green table from canary receipts by @chernistry in #8249
  • docs(acp): ACP v1 bridge docs, CI conformance gate, and registry assets by @chernistry in #8212
  • Consolidate non-security duplicate verification result shapes by @chernistry in #7689
  • fix(tests): wait for initial poll worker in cluster view panel test by @chernistry in #8252
  • Preserve command-loop progress when resuming an interrupted workflow by @chernistry in #7882
  • fix(cli): wait for journal finalization before completion verdict by @chernistry in #7705
  • Keep an interrupted workflow bound to its original goal by @chernistry in #7883
  • fix(tests): stop periodic dashboard polls during manual cluster frame tests by @chernistry in #8254
  • chore(deps): update dependency watchdog to v7.1.1 by @renovate[bot] in #8247
  • chore(deps-dev): bump types-croniter from 6.2.4.20261006 to 6.2.4.20261118 by @dependabot[bot] in #8234
  • fix(workflows): reap owned process trees and drain pipes on command timeout (#8256) by @chernistry in #8257
  • docs(readme): link Leonard Bernstein recordings on Patefona in epigraph by @chernistry in #8259
  • docs(brand): add runs-on-bernstein light/dark badges by @chernistry in #8263
  • ci: stop hosted macOS arm64 pool starvation on main CI and nightly by @chernistry in #8266
  • fix(ci): resolve main test failures in orphan ratchet, z3 fallback, and trace follow by @chernistry in #8270
  • fix(security): enforce persisted role-adapter policy across runtime dispatch (#6648) by @chernistry in #8258
  • fix(webhooks): govern Slack events and GitHub workflow_run via triggers.yaml by @chernistry in #8233
  • fix(security): honor symlinked .sdd anchor and unify CLI role-adapter policy checks (#6648) by @chernistry in #8271
  • fix(security): enforce principal tenant scope across routes and SSE/WS streams by @chernistry in #8272
  • fix(mcp,routes): enforce URL segment containment and authenticated actor binding by @chernistry in #8273
  • fix(artifacts): bind artifact ingestion to contained file descriptors by @chernistry in #8275
  • fix(acp,replay): verify journal descriptors on write and bind run/leaf identity by @chernistry in #8274
  • fix(ci): override transitive tar to 8.0.5 in adapter-clis lockfile by @chernistry in #8277
  • chore(release): v4.0.3 by @chernistry in #8276

Full Changelog: v4.0.2...v4.0.3