fix: prevent IDOR vulnerability in environment update endpoint#6384
fix: prevent IDOR vulnerability in environment update endpoint#6384gagantrivedi merged 5 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Docker builds report
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6384 +/- ##
=======================================
Coverage 98.31% 98.31%
=======================================
Files 1335 1335
Lines 49717 49732 +15
=======================================
+ Hits 48879 48895 +16
+ Misses 838 837 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
90b1762 to
cd0e004
Compare
Make the `project` field read-only during environment updates to prevent attackers from moving an environment to a different project they don't own. The vulnerability allowed an attacker with access to their own environment to modify the `project` field in the PUT request body, effectively moving their environment into a victim's project. Fix: Override __init__ in CreateUpdateEnvironmentSerializer to set project field as read-only when instance exists (update operation).
cd0e004 to
d29b554
Compare
matthewelwell
left a comment
There was a problem hiding this comment.
Approving with a couple of minor comments.
Address PR review comments by using explicit swagger_fake_view attribute check instead of implicit project_id presence check.
733c2ae to
28e10e7
Compare
There was a problem hiding this comment.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on January 10
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Resolve conflict in environments/serializers.py: incorporate drf-spectacular schema generation guard from main into the new CreateEnvironmentSerializer while keeping the separate UpdateEnvironmentSerializer from this branch.
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on April 10. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
for more information, see https://pre-commit.ci
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
Replace .get("project") + None guard with direct dict access since
the swagger_fake_view check above already handles schema generation.
Applies review suggestion from PR #6384.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature!Changes
Make the
projectfield read-only during environment updates to prevent moving an environment to a different projectThe vulnerability allowed an attacker with access to their own environment to modify the
projectfield in the PUT request body, effectively moving their environment into a victim's project.Fix: Override init in CreateUpdateEnvironmentSerializer to set project field as read-only when instance exists (update operation).
How did you test this code?
Adds unit test