Resolve the Django user in tools; permission-lock and hide tools per user #24
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 · 335 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.348
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.065
Real PR Conversation Timeline
1 comments
"Review active on #24"
general
weight: 0.35
BenA-SA
Completes the auth story from ADR-0011 and answers two needs directly: access the user in tools to permission-lock them, and hide tools a user can't use from
tools/list. Recorded in ADR-0014, with a full django-oauth-toolkit recipe.user_resolver— the user in toolsAfter a token verifies, the resolver sets
request.user, so tools gate the ordinary Django way:A separate hook from the SDK
token_verifieron purpose: the SDK'sAccessTokenis token-shaped (client_id, scopes) with no slot for a Django user, and the verifier is the only place that knows the user.PermittedToolsFilter— hide tools per userFilters
tools/listso a client is never even shown a tool it can't use. Runs the predicate in a worker thread sohas_perm(which queries) doesn't raiseSynchronousOnlyOperationon the event loop.The load-bearing decision: hiding ≠ gating
Visibility filtering is not a security boundary, and the design refuses to pretend it is. Nothing stops a client calling a hidden tool by name. A test encodes the model: a hidden tool called by name is still refused, because the tool gates its own execution. Gate to be safe; hide to be tidy. Docs and ADR say so explicitly.
Two things worth reading
permissions.pyimportedAnonymousUserat import time, forcing the app registry to load onimport django_stateless_mcpand crashing the django-stubs mypy plugin withAppRegistryNotReady. Now lazy. Rule recorded in the ADR.dictat the middleware tier, not aListToolsResult— the same two-shapes quirk ADR-0013 hit. The filter handles both.The recipe
docs/recipes/oauth-and-permissions.mdshows the whole picture with django-oauth-toolkit + django-oauth-toolkit-dcr —DOTTokenVerifier, a DOT-backeduser_resolver, execution gating, and visibility filtering — mirroring howic_cookielayers OAuth today. DOT is documented, not depended on.Test plan