Skip to content

[SECURITY] fix: add tenant isolation to scorecard endpoints (critical IDOR)#2918

Open
namann5 wants to merge 1 commit into
ritesh-1918:gssocfrom
namann5:fix/scorecard-idor-tenant-isolation-critical
Open

[SECURITY] fix: add tenant isolation to scorecard endpoints (critical IDOR)#2918
namann5 wants to merge 1 commit into
ritesh-1918:gssocfrom
namann5:fix/scorecard-idor-tenant-isolation-critical

Conversation

@namann5

@namann5 namann5 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

🔒 Security Fix: Tenant Isolation for Scorecard Endpoints

Fixes #2917

Vulnerability

All /api/scorecard/* endpoints authenticated users but never verified they belonged to the requested company_id. Any authenticated user could:

  • View any company's agent performance ranking
  • View any agent's individual scorecard
  • Force-refresh any agent's scorecard

Fix

Added _verify_tenant_access() that looks up the authenticated user's company_id from the profiles table and compares it against the requested company_id. Returns 403 Forbidden on cross-tenant access.

Verification

  • ✅ Zero merge conflicts with upstream/gssoc
  • ✅ Only backend/scorecard_router.py changed

Severity: Critical — CVSS 7.5 (IDOR / Broken Access Control)
Level: critical | advanced

…IDOR)

Scorecard endpoints authenticated users via Bearer token but never
verified the user belonged to the requested company_id. This allowed
any authenticated user to view any company's agent performance data
and force-refresh any agent's scorecard across tenant boundaries.

Added _verify_tenant_access() that:
- Looks up the authenticated user's company_id from profiles table
- Compares it against the requested company_id
- Returns 403 Forbidden on cross-tenant access

Applied to all three endpoints: GET /company/{id}, GET /agent/{id},
POST /refresh/{agent_id}.
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

@namann5 is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0135d749-2e59-4bf5-91a5-66cd4fa654bf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb40df4331

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread backend/scorecard_router.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant