Skip to content

Conversation

@mcfearsome
Copy link
Contributor

  • Added InjectRequestHeaders to UpstreamConfig/OptionsConfig
  • Loop over InjectRequestHeaders during Authenticate and add headers to the request

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.

* Added InjectRequestHeaders to UpstreamConfig/OptionsConfig
* Loop over InjectRequestHeaders during Authenticate and add headers to the request
@codecov
Copy link

codecov bot commented Aug 12, 2019

Codecov Report

Merging #244 into master will decrease coverage by 0.02%.
The diff coverage is 33.33%.

@@            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
Impacted Files Coverage Δ
internal/proxy/oauthproxy.go 50.73% <0%> (-0.25%) ⬇️
internal/proxy/proxy_config.go 78.26% <100%> (+0.11%) ⬆️

Copy link
Contributor

@jphines jphines left a comment

Choose a reason for hiding this comment

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

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?

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved

* Moved header injection so that other used headers cannot be overridden
* Updated sso_config documentation to reflect new addition
@jphines jphines merged commit 65be4a5 into buzzfeed:master Aug 12, 2019
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.

2 participants