Skip to content
This repository was archived by the owner on Dec 7, 2020. It is now read-only.

Conversation

@Nuru
Copy link
Contributor

@Nuru Nuru commented Apr 18, 2020

No documentation needed, as this is a bug fix.

Testing

Very importantly, it passes all the existing unit tests, plus new ones I wrote with URLs associated with open bugs. I also corrected the test rig to properly test the URLs that are being passed upstream rather than the URLs sent to Gatekeeper for proper values.

Of course, the question is, does it also fix the Jenkins problem, and that it does.

If you use the test setup at https://github.com/primeroz/keycloak-10864-test-jenkins (not written by me) you will see the error message:

It appears your reverse proxy setup is broken

Then, in the docker-compose.yml, replace the proxy image "quay.io/keycloak/keycloak-gatekeeper:8.0.1" with "nuru/key-gate:KEYCLOAK-10864" (which contains the keycloak-gatekeeper binary from this PR) and then docker down, docker up, and you will see the error message is gone.

See discussion on Keycloak Dev but please add comments here.

newFakeProxy(cfg).RunTests(t, requests)
}

func TestPreserveURLEncoding(t *testing.T) {

Choose a reason for hiding this comment

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

Function 'TestPreserveURLEncoding' is too long (91 > 60) (from funlen)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

8 other functions in middleware_test.go are also > 60 lines. It's because the test cases are long. I suggest living with it and keeping the tests together rather than splitting them up.

@Nuru Nuru force-pushed the proxy-pass-through branch from 0261092 to 6b212e3 Compare April 18, 2020 02:47
@Nuru
Copy link
Contributor Author

Nuru commented Apr 22, 2020

@abstractj Please consider this PR as an improvement over #483 (details on the dev list)

@stianst
Copy link
Contributor

stianst commented Apr 27, 2020

If this PR is using the original path when invoking upstream, while using the normalized path when applying permission checks, then I'm in favour of this approach.

@Nuru
Copy link
Contributor Author

Nuru commented Apr 27, 2020

If this PR is using the original path when invoking upstream, while using the normalized path when applying permission checks, then I'm in favour of this approach.

@stianst That is it exactly.

@stianst
Copy link
Contributor

stianst commented Apr 27, 2020

+1 On this approach from me - haven't looked at the code though

@abstractj
Copy link

@Nuru thank you so much for submitting this and apologies if it took longer than expected. Your PR was superseded by #626, which is pretty much a rebase of your changes.

If you have any questions, please let me know.

@abstractj abstractj closed this May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gatekeeper mangles/truncates proxied request, even when encoded

4 participants