Skip to content

feat(doop): verify Multica task assertions and plug the task identity verifier (CHE-7081) [squash] - #171

Open
congvc-bot-x99[bot] wants to merge 1 commit into
mainfrom
agent/x99-claude-sonnet-200k/che-7081-ee85b46ef081
Open

congvc-bot-x99[bot] wants to merge 1 commit into
mainfrom
agent/x99-claude-sonnet-200k/che-7081-ee85b46ef081

Conversation

@congvc-bot-x99

Copy link
Copy Markdown

What

CHE-7081, slice S2 of CHE-7064 (plan r3 D1.6; r5 merge route). doop verifies Multica's signed task assertion and plugs the G1 task identity verifier from it.

  • server/taskAssertion.ts: parses DOOP_MULTICA_ASSERTION_KEYS (JSON kid to base64 Ed25519 public key, 1 or 2 keys); verifies mta1.<p>.<s> (strict unpadded base64url, kid known, signature, v 1, aud doop, exp in the future, iat at most 60 s ahead); checks liveness through GET /api/issues/{iid}/task-runs (status dispatched or running, agent_id = aid); plugs in at boot only when the keys, MULTICA_API_URL and MULTICA_API_TOKEN are all set (server/index.ts).
  • /mcp reads X-Multica-Task-Assertion (resolveRequestTask). A valid token sets the actor's task from tid and the identity's agentId, issueId, projectId from the claims; provider and model ride in the write context for the S3 ledger (TaskIdentity now carries them).
  • With the keys set, the bare X-Multica-Task-Id never verifies: the id is dropped, so the actor is a task-less MCP agent (refused everywhere while a verifier is plugged in), and it cannot borrow the 5 min cache a valid assertion filled.
  • With no keys: unchanged (header id passes through; no verifier).
  • DOOP_MULTICA_ASSERTION_KEYS in server/env.ts, .env.example, .context/TECHSTACK.md. The S7 vector is copied to tests/fixtures/taskAssertionVector.json (cheese-work/multica server/internal/taskassert/testdata/vector.json).

Choices to check: the runs request uses the assertion's signed wid as X-Workspace-ID (and must equal MULTICA_WORKSPACE_ID when that is set), so the three envs of D1.6 suffice; a chat task (empty iid) has no issue runs and fails closed; a malformed key list logs and leaves assertions off (writes stay refused, as today).

Out of scope, untouched: G5 lock and pin, any C00 config, secret, build or deploy, any real doop canvas, design_card_guard. doop main does not deploy to C00; this PR claims no deploy.

Test-first evidence

Test command: bunx vitest run tests/taskAssertion.test.ts (tests/taskAssertion.test.ts, 48 cases, writes go through the real store on a bound canvas).

Red, with a stub whose functions answer "nothing" (every failure is an assertion, not a compile error):

 Test Files  1 failed (1)
      Tests  26 failed | 22 passed (48)

(the 22 that pass are the "must throw / must refuse" cases, which a stub also satisfies; the failing 26 include: the S7 vector verifies, a fresh token verifies, liveness identity for running and dispatched, the plug-in cases, a valid assertion writes on its own bound page, and the no-keys pass-through.)

Green, same file, after the implementation:

 Test Files  1 passed (1)
      Tests  48 passed (48)

Acceptance map: S7 vector verifies and a changed payload or signature byte fails; unknown kid, wrong aud, wrong version, expired, iat 120 s ahead fail (30 s ahead passes); ended task (completed, failed, cancelled, queued) fails; agent_id mismatch fails; bare task id refused on a bound page (also right after a valid assertion filled the cache); a valid assertion writes on its own bound page and is refused on another issue's page; Multica down leaves the actor unverified; no keys behaves as before.

Other checks

  • bun run typecheck: clean. bun run lint: clean. bunx prettier on changed files: clean.
  • bunx vitest run tests/taskAssertion.test.ts tests/writePolicy.test.ts tests/multicaTaskMcp.test.ts tests/frameLockPolicy.test.ts tests/reconGuard.test.ts: 5 files pass (209 tests). The full suite runs in CI.
  • Self-review: no secrets (the vector seed is the test-only one from S7); no new route; the only new network call is the existing task-runs read.

… verifier

CHE-7081 (S2 of CHE-7064): server/taskAssertion.ts verifies the signed mta1 task
assertion (Ed25519, D1.6), checks liveness through the issue task-runs, and plugs
the task identity verifier at boot when DOOP_MULTICA_ASSERTION_KEYS, MULTICA_API_URL
and MULTICA_API_TOKEN are set. /mcp reads X-Multica-Task-Assertion; a bare
X-Multica-Task-Id never verifies once the keys are set.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants