skipper icon indicating copy to clipboard operation
skipper copied to clipboard

feature: allow client redirects via 302 responses (#3130)

Open FergusInLondon opened this issue 1 year ago • 5 comments

This commit changes the behaviour of the webhook filter when a 302 Found response is received from the AuthN/AuthZ endpoint. As a result, it allows front-end facing (i.e. non-API) traffic to be filtered via the webhook.

Documentation updates and increased test coverage are included.

Incidental: Prevent the webhook client from following redirects from the AuthN/AuthZ endpoint: during testing I realised that the default net/http behaviour was in use - i.e. redirects were followed. Is this an intended behaviour of the filter: it's not documented, and it seems potentially risky?

Please take a look at #3130 for more details.


Changes:

  1. Update to the documentation - filters.md.
  2. Update to the auth reject() function, whereby the Location header is forwarded to the client if a 302 is encountered from the AuthN/AuthZ endpoint.
  3. Prevent the webhook filter from following 302 redirects.
  4. Update tests to cover 302 redirect forwarding.

FergusInLondon avatar Jun 27 '24 10:06 FergusInLondon

I'm more than happy to adapt or change the approach if required - especially if there's any reason why the webhook filter is expected to follow redirects itself.

Bringing the webhook filter closer to traefik's ForwardAuth functionality - i.e. having more control over the response returned to the client - would be very useful though!

FergusInLondon avatar Jun 27 '24 11:06 FergusInLondon

Any plans to merge this change?

ppoloskov avatar Dec 07 '24 03:12 ppoloskov

Any plans to merge this change?

Can you share your use case? In my point of view it has a potential problem but also a useful change. In general who follows the redirect should not be an issue, but behavior change is always a higher risk factor.

szuecs avatar Dec 09 '24 12:12 szuecs

Sorry for bumping this after such a long time. I want to use skipper for front-end traffic and use authelia for authentication. The original problem described here - https://github.com/zalando/skipper/issues/3329

ppoloskov avatar Oct 02 '25 02:10 ppoloskov

There are open comments about it. Maybe you can check if you can fix it, such that it is usable to integrate with authelia webhook.

szuecs avatar Oct 02 '25 10:10 szuecs