π‘οΈ Sentinel: [CRITICAL] Fix authorization bypass in API /usage endpoint - #119
Conversation
Added missing `OptionalAdmin` authorization check when falling back to the `tenant` query parameter if the `tenant_ctx` is `None` (unscoped caller). Also updated the corresponding tool call in `mcp_server.rs`. Co-authored-by: ovasylenko <3797513+ovasylenko@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
β¦184674616619685396
π¨ Severity: CRITICAL
π‘ Vulnerability: The
/usageendpoint lacked an authorization check when a caller omitted theX-Tenant-Idheader (unscoped caller). It allowed any unscoped caller to arbitrarily specify a tenant ID via the?tenant=query parameter and view that tenant's usage and cost data.π― Impact: This Insecure Direct Object Reference (IDOR) / Missing Authorization vulnerability allowed unauthenticated or unauthorized users to scrape usage and cost metrics across all tenants in the system.
π§ Fix: Updated the
get_usagehandler inorch8-api/src/usage.rsto require theadmin_ctxextractor. Iftenant_ctxisNone, it now callsrequire_admin(&admin_ctx)?before allowing the use of the?tenant=parameter. Also updated the MCP proxy logic inorch8-api/src/mcp_server.rsto match the new signature.β Verification:
cargo +nightly test -p orch8-api --test usagepasses successfully, andcargo +nightly check -p orch8-apiconfirms no compilation errors exist.PR created automatically by Jules for task 13184674616619685396 started by @ovasylenko