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

Add encode secret string resolver #568

Merged
merged 14 commits into from
May 22, 2024

Conversation

rohitvinnakota-codecov
Copy link
Contributor

@rohitvinnakota-codecov rohitvinnakota-codecov commented May 15, 2024

Adds a resolver to return an encoded secret string. We want to move our REST endpoints to GQL(we are currently using a POST request to do this from gazebo).

A follow up PR will be made in gazebo to migrate the endpoints.

After that, we will delete the old REST code, once we confirm that it is no longer in use.

This issue closes codecov/engineering-team#1746

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 May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.84%. Comparing base (62f64f3) to head (00c759d).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #568   +/-   ##
=====================================
  Coverage   95.84   95.84           
=====================================
  Files        777     779    +2     
  Lines      17290   17321   +31     
=====================================
+ Hits       16571   16602   +31     
  Misses       719     719           
Flag Coverage Δ
unit 91.37% <100.00%> (+0.01%) ⬆️
unit-latest-uploader 91.37% <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.

@rohitvinnakota-codecov rohitvinnakota-codecov changed the title [draft] Add encode secret string mutation [draft] Add encode secret string resolver May 16, 2024
@codecov-staging
Copy link

codecov-staging bot commented May 16, 2024

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!

@codecov-qa
Copy link

codecov-qa bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.37%. Comparing base (62f64f3) to head (00c759d).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #568      +/-   ##
==========================================
+ Coverage   91.35%   91.37%   +0.01%     
==========================================
  Files         599      601       +2     
  Lines       15972    16003      +31     
==========================================
+ Hits        14592    14623      +31     
  Misses       1380     1380              
Flag Coverage Δ
unit 91.37% <100.00%> (+0.01%) ⬆️
unit-latest-uploader 91.37% <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 May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.37%. Comparing base (62f64f3) to head (00c759d).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #568      +/-   ##
==========================================
+ Coverage   91.35%   91.37%   +0.01%     
==========================================
  Files         599      601       +2     
  Lines       15972    16003      +31     
==========================================
+ Hits        14592    14623      +31     
  Misses       1380     1380              
Flag Coverage Δ
unit 91.37% <100.00%> (+0.01%) ⬆️
unit-latest-uploader 91.37% <100.00%> (+0.01%) ⬆️

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

Files Coverage Δ
...nds/repository/interactors/encode_secret_string.py 100.00% <100.00%> (ø)
core/commands/repository/interactors/utils.py 100.00% <100.00%> (ø)
core/commands/repository/repository.py 100.00% <100.00%> (ø)
graphql_api/types/repository/repository.py 100.00% <100.00%> (ø)

Impacted file tree graph

@rohitvinnakota-codecov rohitvinnakota-codecov force-pushed the rvinnakota/add-enc-sec-string-mutation branch from 644ebad to 3449308 Compare May 16, 2024 18:44
@rohitvinnakota-codecov rohitvinnakota-codecov changed the title [draft] Add encode secret string resolver Add encode secret string resolver May 16, 2024
@rohitvinnakota-codecov rohitvinnakota-codecov marked this pull request as ready for review May 16, 2024 19:33
@rohitvinnakota-codecov rohitvinnakota-codecov requested a review from a team as a code owner May 16, 2024 19:33
if not self.current_user.is_authenticated:
raise Unauthenticated()
if not repo:
raise ValidationError("Repo not found")
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. What does the encoded secret string actually do?
  2. Currently this allows authenticated users not belonging to the org to generate this value as well, is that ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have a widget in gazebo that lets us generate a secret string(for any text, but meant to be used for YAML values)

Screenshot 2024-05-19 at 2 35 31 PM

It returns an encrypted string for the text entered. It's basically a big wrapper around the encode_secret_string function.

Since the user can enter any string, and they will need org validation to see other sensitive data, I am comfortable with allowing any authenticated user to call this.

Let me know if you think I'm missing anything, thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha, as long as this has the same auth validation as the internal REST endpoint its fine.

@rohitvinnakota-codecov rohitvinnakota-codecov added this pull request to the merge queue May 22, 2024
Merged via the queue into main with commit 1979f83 May 22, 2024
21 of 22 checks passed
@rohitvinnakota-codecov rohitvinnakota-codecov deleted the rvinnakota/add-enc-sec-string-mutation branch May 22, 2024 17:43
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.

[API] Create a useEncodeString GQL mutation
2 participants