Task 18 Execution Packet: Workbench Auth Hardening + Governance Export (Aligned to 2026-01-25 Plan)

This packet replaces the old Task 18 notes. It is aligned to Phase 16 / Task 18 in docs/plans/2026-01-25-end-state.md and the current repo structure.

Use this as the exact execution guide for an agent implementing Task 18.


Objective

Harden Workbench authentication and authorization and deliver real governance export output (signed, content-addressed bundles).


Non-negotiables


Step 0 — Ground the current code reality (must confirm before editing)

Verify current auth and policy export locations:

If any of these differ, update this packet before coding.


Step 1 — Implement provider abstraction for auth

Requirements

Server-side (Workbench BFF)

JWT Validation Details

Claims Mapping

Session Management

Enforcement

Client-side (Workbench UI)


Step 2 — RBAC requirements

Roles:

Rules:

RBAC Permission Matrix (minimum)

Capability / Endpoint Group viewer operator admin
Manifest read (GET /manifests, /manifests/{id}, /manifests/{id}/versions, /manifests/{id}/diff, /manifests/{id}/source)
Provenance read (GET /provenance/graph, /provenance/nodes/{id}, /provenance/lineage/{id}, /provenance/search, /provenance/impact/{id}, /provenance/compare)
Drift read (GET /drift/context/{context}, /drift/report/{node_id}, /drift/history)
Behavior read (GET /behavior/summaries, /behavior/nodes/{id}, /behavior/trends, /behavior/openobserve-config)
Ops read (GET /ops/actions, /ops/actions/{id}, /ops/runs, /ops/runs/{id}, /ops/runs/{id}/logs, /ops/runs/{id}/summary)
Ops write (POST /ops/runs, /ops/runs/{id}/cancel)
Drift analyze (POST /drift/analyze)
Behavior scan (POST /behavior/scan)
Drift remediation (POST /drift/remediate)
Governance export (POST /governance/export)
Policy reload (POST /policy/reload)
RBAC / auth config changes

Extension rule: adding a new endpoint requires an explicit matrix entry and tests for 401/403 behavior.


Step 3 — Governance export is real (no stubs)

Requirements

Policy Gateway changes

Export Bundle Specification (required)

Cryptography

Content addressing

Bundle layout

1
2
3
4
5
6
manifest.json
evidence/ledger.jsonl
evidence/objects/<evidence_id>/<artifact_id>
manifests/<manifest_id>.json
policies/opa/...
bundle.sig

manifest.json format

Verification process (consumer)

  1. Verify bundle.sig using the public Ed25519 key.
  2. Recompute file hashes and compare to manifest.json.
  3. Recompute root_sha256 and compare to manifest.

Step 4 — Tests

Required tests

Run:

1
2
3
4
pnpm exec nx test workbench -- --testPathPattern=auth
pnpm exec nx test workbench -- --testNamePattern="requires login"
pytest services/workbench-bff/tests/test_auth.py -v
pytest services/policy-gateway/tests/test_export.py -v

(And appropriate backend tests for BFF + policy-gateway.)


Acceptance criteria (from plan)