-
Notifications
You must be signed in to change notification settings - Fork 28
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] Add endpoint that checks whether an owner has Gen AI consent #1102
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
📢 Thoughts on this report? Let us know! |
❌ 5 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
❌ 5 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
✅ All tests successful. No failed tests were found. 📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #1102 +/- ##
=======================================
Coverage 96.09% 96.10%
=======================================
Files 832 835 +3
Lines 19501 19596 +95
=======================================
+ Hits 18740 18832 +92
- Misses 761 764 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
20acd52
to
28457dd
Compare
|
||
def validate_signature(self, request): | ||
key = get_config( | ||
"gen_ai", "auth_secret", default=b"testixik8qdauiab1yiffydimvi72ekq" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to avoid setting a default here and instead error out if it is not set?
def sign_payload(payload, secret=PAYLOAD_SECRET): | ||
data = json.dumps(payload, separators=(",", ":")).encode("utf-8") | ||
signature = "sha256=" + hmac.new(secret, data, digestmod=sha256).hexdigest() | ||
return signature, data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def sign_payload(payload, secret=PAYLOAD_SECRET): | |
data = json.dumps(payload, separators=(",", ":")).encode("utf-8") | |
signature = "sha256=" + hmac.new(secret, data, digestmod=sha256).hexdigest() | |
return signature, data | |
def sign_payload(payload: bytes, secret=PAYLOAD_SECRET): | |
signature = "sha256=" + hmac.new(secret, payload, digestmod=sha256).hexdigest() | |
return signature, data |
I would avoid going from bytes -> string -> bytes with json.dumps()
. Ordering of the keys isn't guaranteed (afaik), this can result in different signatures. The recommendation when working with payload signatures like this is to always calculate them based on the raw bytes.
Co-authored-by: Matthew T <[email protected]>
161ab0e
to
ac5908b
Compare
We want to authenticate 2 ways from Seer <-> Codecov before invoking any of our AI features. This endpoint will be called from Seer to verify that the owner has a valid app installation with Codecov.
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.