fix(tasks): bind tasks to token issuer as well as subject #296
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.65) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.65 · 339 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.349
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.065
Real PR Conversation Timeline
1 comments
"Review active on #296"
general
weight: 0.35
rozzilla
Problem
Tasks were owned by the token
subalone. A subject is only unique within its issuer, so on a server with severalauthorizationServersa user from idp-b with the samesubas a user from idp-a could see the other user's tasks intasks/listand calltasks/get,tasks/resultandtasks/cancelon them. #245 fixed this for sessions but not for tasks.Fix
TaskRecordgetsauthIssuer, set at creation fromrequest.tokenIssuer(the normalized issuer from the auth preHandler, includingintrospection:<endpoint>for introspected tokens withoutiss). It is stripped from the wire format likeauthSubject.assertTaskAccessrequires both subject and issuer to match. A foreign task still answers exactly like an unknown id, so callers cannot tell existence from ownership.TaskStore.list(owner, options)now takes{ subject, issuer }(new exported typeTaskOwner) instead of a bare subject. Both stores and the interface are updated. This signature was changed by #239 and has not been released yet.mcp:tasks:owner:<encodeURIComponent(iss)>:<encodeURIComponent(sub)>, so a:in either part cannot make two owners share a key.deleteremoves the entry from the same key.tasks/liststays refused.listcontract is updated.Migration note
With authorization enabled, tasks created before this change have no issuer. They fail closed: they cannot be reached and expire with their ttl. Old Redis index keys (
mcp:tasks:owner:<sub>) are no longer read and expire on their own.Overlap
Open #289 (fix/249-task-retention-quota) also uses the per-owner Redis key layout and the store
listowner argument. Whichever PR merges second needs to adopt the issuer-aware key and theTaskOwnersignature.Tests
test/task-owner-issuer.test.ts: the issue's scenario (two issuers, samesub) fortasks/get,tasks/result,tasks/cancelandtasks/list, on memory and Redis; the same issuer and subject still works, including a trailing-slash issuer; a task withoutauthIssueris unreachable when auth is on (memory and Redis); auth off is unchanged.liston both stores, Redis index keys with:in the issuer or subject, andtoWireTaskdroppingauthIssuer.npm run lint,npm run typecheck,npm test: 677/677 pass.Fixes #295
🤖 Generated with Claude Code
https://claude.ai/code/session_01UF4S3w7iA83V9DVsasLJzM