auth: allowlist agent Bearer access to task checklist routes - #2430
Conversation
The checklist-items handlers (PR #2415) authorize agents via the project_tasks_create scope, but the middleware's exact (method, regex) Bearer allowlist had no checklist pattern, so a registry JWT was refused 401 before any scope check ran. Add GET/POST /api/projects/{pid}/tasks/{tid}/checklist-items to _AGENT_TASK_ROUTES, with predicate + dispatch tests for both halves (allowed pair passes the middleware gate; DELETE and the /checklist-items/{id} sibling stay 401). Inert until the checklist routes merge.
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
|
Warning Review limit reached
Next review available in: 4 minutes Limit details: You’ve used all 2 included reviews currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous Review Summary (commit f30e078)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit f30e078)Status: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by step-3.7-flash · Input: 46.4K · Output: 5.2K · Cached: 256.3K |
…outes The doc-gate agent-api rule requires docs/agent-coordination.md to change whenever the auth middleware allowlist changes. Document the new checklist-items list/create entries and the deliberate exclusion of DELETE and per-item subpaths.
Why
The task checklist handlers in #2415 authorize agents via the
project_tasks_createscope, and their docstrings advertise agent access — buttinyagentos/auth_middleware.pyholds an exact(method, path-regex)Bearer allowlist (_AGENT_TASK_ROUTES) with no checklist pattern. A registry JWT is therefore refused401 Authentication requiredby the middleware BEFORE any scope check runs, making the agent-authorization branch in both handlers unreachable. This PR adds the two missing allowlist entries as their own diff, per the ruling on #2415.Entries added (matching the anchoring and
_SEGconventions of their neighbours):Nothing wider: DELETE on the same path and the
/checklist-items/{id}sibling remain session-only (there is no archive route; archiving is store-level and verified+reported-gated).Proven red
The positive tests were run once against the UNPATCHED middleware (allowlist change stashed) before restoring it:
Tests
Both halves at the granularity of the evidence, in
tests/test_auth_middleware.py:TestIsAgentTaskChecklistPath— predicate-level: GET/POST checklist-items allowed; DELETE same path refused;/checklist-items/{id}(GET and PATCH) refused;/checklistsnear-miss sibling refused.TestTaskChecklistAgentTokenDispatch— middleware dispatch: a Bearer token on GET/POST checklist-items reachescall_nextwithvia == "registry_jwt_candidate"(i.e. it reaches the handler's scope layer instead of the 401 gate); DELETE and the{id}subpath get 401 withcall_nextnever awaited.Commands run
Red run above exited 1 (4 failed) against the unpatched file.
Unblocks #2415; patterns are inert until the checklist routes merge.