proxy: Allow injection of request headers#244
Merged
jphines merged 2 commits intobuzzfeed:masterfrom Aug 12, 2019
Merged
Conversation
* Added InjectRequestHeaders to UpstreamConfig/OptionsConfig * Loop over InjectRequestHeaders during Authenticate and add headers to the request
Codecov Report
@@ Coverage Diff @@
## master #244 +/- ##
==========================================
- Coverage 62.25% 62.22% -0.03%
==========================================
Files 50 50
Lines 4069 4072 +3
==========================================
+ Hits 2533 2534 +1
- Misses 1349 1350 +1
- Partials 187 188 +1
|
jphines
suggested changes
Aug 12, 2019
Contributor
jphines
left a comment
There was a problem hiding this comment.
Overall, this looks great! Just one small nit about placement of setting headers.
Additionally, can we add some documentation to https://github.com/buzzfeed/sso/blob/master/docs/sso_config.md?
internal/proxy/oauthproxy.go
Outdated
| req.Header.Set("X-Forwarded-Email", session.Email) | ||
| req.Header.Set("X-Forwarded-Groups", strings.Join(session.Groups, ",")) | ||
|
|
||
| for key, val := range p.upstreamConfig.InjectRequestHeaders { |
Contributor
There was a problem hiding this comment.
Let's move these above setting of the X-Forwarded- headers. We don't want to allow impersonation by setting these headers from a config.
* Moved header injection so that other used headers cannot be overridden * Updated sso_config documentation to reflect new addition
jphines
approved these changes
Aug 12, 2019
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.
Problem
#243
Notes
I am unfamiliar with Go and was unsure how to go about testing the actual adding of the headers. If someone would be kind enough to point me in the right direction I can continue.