Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providers/proxy: rework redirect mechanism #8594

Merged
merged 9 commits into from May 6, 2024

Conversation

BeryJu
Copy link
Member

@BeryJu BeryJu commented Feb 20, 2024

Details

closes #6886
closes #5603

instead of relying on ?rd= being set and carried forward (which doesn't happen due to OAuth redirect URLs) and using oauth_redirect in the session (which can be overwritten by parallel requests and mainly leads to #6886)

this PR changes the logic to encode the redirect URL (after being validated) into the state param (turning the state param into a signed JWT which also contains the random secret), and then using the same state when returning to redirect the user in the end.


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@BeryJu BeryJu requested a review from a team as a code owner February 20, 2024 11:47
Copy link

netlify bot commented Feb 20, 2024

Deploy Preview for authentik-storybook canceled.

Name Link
🔨 Latest commit ba1c6e3
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/662f649ab18e420008402ee4

@BeryJu BeryJu force-pushed the providers/proxy/rework-proxy-redirect branch from c010c2e to ddaa975 Compare February 20, 2024 11:53
Copy link
Contributor

github-actions bot commented Feb 20, 2024

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-ghcr.io/goauthentik/dev-server:gh-ba1c6e34ae5ff93bf45adea50c4e1dfdfb74e75a
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

For arm64, use these values:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-ghcr.io/goauthentik/dev-server:gh-ba1c6e34ae5ff93bf45adea50c4e1dfdfb74e75a-arm64
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
image:
    repository: ghcr.io/goauthentik/dev-server
    tag: gh-ghcr.io/goauthentik/dev-server:gh-ba1c6e34ae5ff93bf45adea50c4e1dfdfb74e75a

For arm64, use these values:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
image:
    repository: ghcr.io/goauthentik/dev-server
    tag: gh-ghcr.io/goauthentik/dev-server:gh-ba1c6e34ae5ff93bf45adea50c4e1dfdfb74e75a-arm64

Afterwards, run the upgrade commands from the latest release notes.

Copy link

netlify bot commented Feb 21, 2024

Deploy Preview for authentik-docs canceled.

Name Link
🔨 Latest commit ba1c6e3
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/662f649a5cc7a1000807b654

@BeryJu BeryJu force-pushed the providers/proxy/rework-proxy-redirect branch from a5fad3d to 6e19669 Compare February 21, 2024 19:05
@hdlineage
Copy link

hdlineage commented Mar 20, 2024

Will this patch be included in the next release? @BeryJu

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
@BeryJu BeryJu force-pushed the providers/proxy/rework-proxy-redirect branch from 44f437e to d6af62a Compare April 28, 2024 20:00
Copy link

codecov bot commented Apr 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.43%. Comparing base (e716e24) to head (ba1c6e3).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8594      +/-   ##
==========================================
- Coverage   92.45%   92.43%   -0.03%     
==========================================
  Files         669      669              
  Lines       32695    32695              
==========================================
- Hits        30228    30220       -8     
- Misses       2467     2475       +8     
Flag Coverage Δ
e2e 50.61% <ø> (-0.03%) ⬇️
integration 26.00% <ø> (ø)
unit 89.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

BeryJu added a commit to BeryJu/k8s that referenced this pull request Apr 28, 2024
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
@BeryJu BeryJu requested a review from a team as a code owner April 28, 2024 22:27
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
@BeryJu BeryJu merged commit c45bb8e into main May 6, 2024
68 checks passed
@BeryJu BeryJu deleted the providers/proxy/rework-proxy-redirect branch May 6, 2024 01:07
@BeryJu
Copy link
Member Author

BeryJu commented May 6, 2024

as there hasn't been enough testing with this for all the possible setup options (we've tested it with proxy (single) and forward auth with nginx and envoy), we won't be including this in the next 2024.4 bugfix release. However in this case it should be possible to use the beta outpost image with the 2024.4 release to test this change.

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.

Proxy provider random incorrect redirects Proxy provider incorrect redirect behaviour
2 participants