Skip to content

[MEDIUM] Add tenant isolation to weekly digest endpoints (fixes #2927)#2928

Open
namann5 wants to merge 1 commit into
ritesh-1918:gssocfrom
namann5:fix/weekly-digest-tenant-isolation
Open

[MEDIUM] Add tenant isolation to weekly digest endpoints (fixes #2927)#2928
namann5 wants to merge 1 commit into
ritesh-1918:gssocfrom
namann5:fix/weekly-digest-tenant-isolation

Conversation

@namann5

@namann5 namann5 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2927 - IDOR vulnerability in weekly digest endpoints allowed any authenticated user to access cross-tenant data.

Changes

  • Added _verify_company_access()\ helper that queries the user's \company_id\ from the \profiles\ table
  • Both /preview/{company_id}\ and /send-now\ now enforce tenant isolation
  • \master_admin\ role is exempted (allowed to access any company)
  • Non-matching company_id returns 403 Forbidden

Both /preview/{company_id} and /send-now endpoints accepted a company_id
from the client without verifying the authenticated user belonged to that
company. Any authenticated user could view digest statistics and trigger
emails for any tenant.

Added _verify_company_access helper that checks the user's profile in the
profiles table and rejects requests where the user's company_id does not
match the requested company_id (master_admin role exempted).
@vercel

vercel Bot commented Jun 19, 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 19, 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: f519726c-e55c-49fa-b4ab-d565f712a101

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: 21e1ec74c6

ℹ️ 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/routes/weekly_digest.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