Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Add secure middleware to enable more header options #618

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

timothy-spencer
Copy link

I needed to be have XSS and nosniff headers set to help compliance scans not complain, so I followed through with the suggestion in #384.

Please let me know if you have any suggestions or things that I could do to help this get merged in. We would love to be able to just use upstream for this.

Thanks!

@@ -836,3 +837,73 @@ func TestRequestSignaturePostRequest(t *testing.T) {
assert.Equal(t, 200, st.rw.Code)
assert.Equal(t, st.rw.Body.String(), "signatures match")
}

func TestHttpBrowserXssFilterTrue(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this tests a third-party package but doesn't really test the behavior of this package. What kinds of regressions would this test catch?

Copy link
Author

Choose a reason for hiding this comment

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

Well, other tests further up in the file test the proxy. This tests that the middleware is functioning on top of the proxy. I definitely don't have 100% coverage here. I only am testing one of the secure middleware options, for example. More tests certainly could be written!

These were sufficient for me to verify that the proxy with middleware worked for our purposes, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this tests any of the code you added. As far as I can tell, the test imports a third-party package, instantiates its middleware, and verifies that the middleware behaves as expected. It doesn't really exercise the code you added, or any of the code in this package.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that's how main() does it too. Remember how you told me to wrap the middleware outside of NewOAuthProxy? This is the result. As far as I can see, this is the only way I can actually do this sort of thing. As a golang neophyte, I welcome being proven wrong.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants