Repository navigation
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
Conversation
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: parsesDOOP_MULTICA_ASSERTION_KEYS(JSON kid to base64 Ed25519 public key, 1 or 2 keys); verifiesmta1.<p>.<s>(strict unpadded base64url, kid known, signature,v1,auddoop,expin the future,iatat most 60 s ahead); checks liveness throughGET /api/issues/{iid}/task-runs(statusdispatchedorrunning,agent_id=aid); plugs in at boot only when the keys,MULTICA_API_URLandMULTICA_API_TOKENare all set (server/index.ts)./mcpreadsX-Multica-Task-Assertion(resolveRequestTask). A valid token sets the actor's task fromtidand the identity'sagentId,issueId,projectIdfrom the claims;providerandmodelride in the write context for the S3 ledger (TaskIdentitynow carries them).X-Multica-Task-Idnever 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.DOOP_MULTICA_ASSERTION_KEYSinserver/env.ts,.env.example,.context/TECHSTACK.md. The S7 vector is copied totests/fixtures/taskAssertionVector.json(cheese-work/multicaserver/internal/taskassert/testdata/vector.json).Choices to check: the runs request uses the assertion's signed
widasX-Workspace-ID(and must equalMULTICA_WORKSPACE_IDwhen that is set), so the three envs of D1.6 suffice; a chat task (emptyiid) 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. doopmaindoes 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):
(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:
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 prettieron 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.task-runsread.