Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add validation for trial start/cancel for user in calling org #736

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

ajay-sentry
Copy link
Contributor

Purpose/Motivation

This PR aims to fix the IDOR hole mentioned in https://github.com/codecov/internal-issues/issues/646 where users can start or cancel trials even if they don't belong to the organization

To fix, we simply check to see that the user is part of the organization in the validate step prior to executing the mutation

Links to relevant tickets

Closes https://github.com/codecov/internal-issues/issues/646

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@codecov-notifications
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.04%. Comparing base (e245d32) to head (2ce548e).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@               Coverage Diff                @@
##               main       #736        +/-   ##
================================================
+ Coverage   96.02000   96.04000   +0.02000     
================================================
  Files           814        814                
  Lines         18428      18543       +115     
================================================
+ Hits          17695      17809       +114     
- Misses          733        734         +1     
Flag Coverage Δ
unit 91.74% <100.00%> (+0.01%) ⬆️
unit-latest-uploader 91.74% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

from codecov.db import sync_to_async
from codecov_auth.helpers import current_user_part_of_org
from codecov_auth.models import Owner
from plan.service import PlanService


class StartTrialInteractor(BaseInteractor):
Copy link
Contributor

Choose a reason for hiding this comment

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

if we use this interactor in graphql fields, we probably can make use of the decorator @require_part_of_org

@ajay-sentry ajay-sentry added this pull request to the merge queue Aug 7, 2024
Merged via the queue into main with commit 85ef159 Aug 7, 2024
17 of 18 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/646-trial-start-cancel-auth branch August 7, 2024 15:20
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.

2 participants