Add basic auth to integrations api#79
Merged
Merged
Conversation
1d824c8 to
f48c138
Compare
3mcd
approved these changes
Sep 8, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that we nearly have a publicly exposed endpoint allowing us to send emails, I think we need to protect the API before someone spams people with our mailgun account. This PR requires all requests to the integrations api (except to the auth endpoint) to send an
Authorization: Bearer <api key>header. It doesn't yet add this to the client SDK though! It also defaults to allowing requests if the API_KEY env var isn't set, so nothing will break when this is merged. That's not the default we should ship with!Issue(s) Resolved
Resolves #44
Test Plan
API_KEY=abc123in your.env.localcurl -iX GET localhost:3000/api/v0/integrations/708c6434-37c1-49f7-8fe6-f7e005b865cd/pubs -H 'authorization: Bearer abc123' -H 'content-type:application/json'and you should get a 200 responseabc123or without the header and make sure you get an error responseNotes/Context/Gotchas
Authorizationheader for both the api key and the user auth token is a good idea. Seems like it might be confusing!