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

feat: check authorization for GQL owners #426

Merged
merged 17 commits into from
Mar 7, 2024
Merged

feat: check authorization for GQL owners #426

merged 17 commits into from
Mar 7, 2024

Conversation

JerrySentry
Copy link
Contributor

@JerrySentry JerrySentry commented Feb 28, 2024

Purpose/Motivation

Add a authentication and authorization for a few sensitive fields in the Owners query, we don't want to expose these information to users that don't belong in this org.

Links to relevant tickets

codecov/engineering-team#1082

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.

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.72%. Comparing base (8461595) to head (78c6a4b).

❗ Current head 78c6a4b differs from pull request most recent head 5ec255b. Consider uploading reports for the commit 5ec255b to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #426     +/-   ##
=======================================
+ Coverage   95.65   95.72   +0.07     
=======================================
  Files        763     763             
  Lines      17504   17751    +247     
=======================================
+ Hits       16743   16991    +248     
+ Misses       761     760      -1     
Flag Coverage Δ
unit 95.96% <100.00%> (?)
unit-latest-uploader 95.96% <100.00%> (?)

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.

@codecov-qa
Copy link

codecov-qa bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.05%. Comparing base (b1c7efe) to head (2622729).

❗ Current head 2622729 differs from pull request most recent head 0f88f91. Consider uploading reports for the commit 0f88f91 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #426      +/-   ##
==========================================
+ Coverage   96.04%   96.05%   +0.01%     
==========================================
  Files         643      643              
  Lines       17057    17080      +23     
==========================================
+ Hits        16382    16407      +25     
+ Misses        675      673       -2     
Flag Coverage Δ
unit 96.05% <100.00%> (+0.01%) ⬆️
unit-latest-uploader 96.05% <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.

Copy link

codecov-public-qa bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b1c7efe) 96.04% compared to head (0f88f91) 96.06%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #426      +/-   ##
==========================================
+ Coverage   96.04%   96.06%   +0.01%     
==========================================
  Files         643      643              
  Lines       17057    17082      +25     
==========================================
+ Hits        16382    16409      +27     
+ Misses        675      673       -2     
Flag Coverage Δ
unit 96.06% <100.00%> (+0.01%) ⬆️
unit-latest-uploader 96.06% <100.00%> (+0.01%) ⬆️

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

Files Coverage Δ
graphql_api/helpers/mutation.py 100.00% <100.00%> (ø)
graphql_api/types/owner/owner.py 94.55% <100.00%> (+2.07%) ⬆️

Impacted file tree graph

@codecov-staging
Copy link

codecov-staging bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@JerrySentry JerrySentry changed the title DRAFT: check authorization for GQL owners check authorization for GQL owners Mar 4, 2024
@JerrySentry JerrySentry changed the title check authorization for GQL owners feat: check authorization for GQL owners Mar 4, 2024
@JerrySentry JerrySentry marked this pull request as ready for review March 4, 2024 19:22
@JerrySentry JerrySentry requested a review from a team as a code owner March 4, 2024 19:22
@@ -15,21 +15,21 @@ type Owner {
repository(name: String!): RepositoryResult!
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These fields can be null now, when the user is not part of the the field will be null and will also have error in the response with the appropriate message.

@@ -57,5 +58,20 @@ def authenticated_resolver(instance, info, *args, **kwargs):
return authenticated_resolver


def require_part_of_org(resolver):
Copy link
Contributor

Choose a reason for hiding this comment

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

is it easy to add a UT for this guy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this function should be fully covered with the test_owner.py tests

Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

just a small comment about UT but otherwise looks good

@JerrySentry JerrySentry merged commit 06b40b8 into main Mar 7, 2024
17 of 18 checks passed
@JerrySentry JerrySentry deleted the feb_28_1082 branch March 7, 2024 15:23
Copy link

@barnett-yuxiang barnett-yuxiang left a comment

Choose a reason for hiding this comment

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

cool

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.

None yet

3 participants