Skip to content

feat(forward-auth): add Ignored Paths #1210

Merged
tobychui merged 3 commits into
tobychui:v3.3.4from
CrazyWolf13:feat/forward-auth-ignored-paths
Jun 23, 2026
Merged

feat(forward-auth): add Ignored Paths #1210
tobychui merged 3 commits into
tobychui:v3.3.4from
CrazyWolf13:feat/forward-auth-ignored-paths

Conversation

@CrazyWolf13

@CrazyWolf13 CrazyWolf13 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

What this does

Fixes the Authentik single-application forward-auth redirect loop (#895) by adding a generic Ignored Paths option to the (global) Forward Auth settings, a comma-separated list of request path prefixes that bypass the forward-auth check entirely.

Setup (Authentik single-application mode)

  1. Forward Auth -> Advanced Options -> Ignored Paths = /outpost.goauthentik.io
  2. A virtual directory /outpost.goauthentik.io -> <authentik-host>:9000/outpost.goauthentik.io (Require TLS off) on each protected host, routes the OAuth callback to the outpost.

Both the Address and Ignored Paths fields carry inline notes guiding this, so it should be self-explanatory and no wiki page should be needed.

Warning

Paths in Ignored Paths get no authentication whatsoever — any request whose path starts with one of those prefixes bypasses Forward Auth entirely. Only list auth-callback paths (e.g. /outpost.goauthentik.io) or paths you intentionally want public. (This warning is also shown in the UI next to the field.)

grafik

Implementation (AI-Assisted:)

  • forward package: new IgnoredPaths option (load / GET / POST / DELETE / log) + IsIgnoredPath() with
    hardened, normalized matching (decoded + path.Clean + boundary check) so ../%2e%2e traversal and prefix-boundary
    tricks can't bypass auth on unintended paths. Empty entries are skipped so a stray comma can't disable auth
    site-wide.
  • dynamicproxy/authProviders.go: handleForwardAuth returns early for ignored paths — modeled on the existing
    ZorxAuthExceptionRules pattern. ~6 lines, no Server.go/routing changes, so it stays clear of the dynamic-proxy
    work on v3.3.4.
  • web/components/sso.html: Ignored Paths field under Advanced Options, with the inline warning + Authentik hint.
  • Unit tests for the matcher (boundary, traversal, multi-prefix).

Testing

test seem to pass, builds fine and I tested this build succesfully for multiple hours and will keep it live in my homelab, though I'd appreciate any testing!

Open question

Currently the /outpost.goauthentik.io vdir needs to be added manually per host.
I'd happily add a tickbox or similar to automatically handle this, but I first wanted to hear your opinion on this and kept the PR to a basic level.

Note

I'm not a professional dev and this was written largely with AI assistance. I'd be very happy if you @james-d-elliott could take a look and give it a thorough review!

Should resolve #895

CrazyWolf13 and others added 2 commits June 20, 2026 19:06
…th prefixes)

Implements the reviewed direction for the Authentik single-application
redirect loop (tobychui#895): instead of an Authentik-specific preset, add a
generic, comma-separated "Ignored Paths" list to the (global) Forward
Auth settings. Any request whose path falls within one of these prefixes
bypasses the forward auth check entirely.

For Authentik per-app mode you set this to /outpost.goauthentik.io so the
OAuth callback reaches the outpost instead of looping. Matching is
hardened (decoded + path.Clean + boundary checked) against path traversal
and prefix-boundary tricks; empty entries are skipped so a stray comma
cannot disable auth site-wide.

- forward/const.go: ignoredPaths DB key
- forward/forward.go: IgnoredPaths option; load / GET / POST / DELETE / log
- forward/ignoredpaths.go: hardened matcher + IsIgnoredPath (+ unit tests)
- dynamicproxy/authProviders.go: handleForwardAuth skips auth for ignored paths
- web/sso.html: Ignored Paths field under Advanced Options, with a warning

Refs tobychui#895

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Ignored Paths help/warning was a Semantic UI .warning.message inside the
form, which Semantic UI hides by default, so the field rendered with nothing
below it. Use an always-visible <small> for the description + Authentik
suggestion, plus a forced-visible (.visible) warning message for the no-auth
security warning. Also add an Authentik single-application hint under the
Address field pointing to Ignored Paths and the required virtual directory.

Refs tobychui#895

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CrazyWolf13 CrazyWolf13 requested a review from tobychui as a code owner June 20, 2026 18:55

@tobychui tobychui left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM, even path traversal attack is properly handled so I think this should be ready to merge. I will wait for @james-d-elliott final review before merging this.

@CrazyWolf13

Copy link
Copy Markdown
Contributor Author

@tobychui The CI is currently failing, but the reported test failures don't appear to be related to my changes. Is the CI expected to pass, or are these known/pre-existing issues?

On a side note, what do you think about an option to directly enable the vdir fir forward auth, as described here: #1210

@tobychui

Copy link
Copy Markdown
Owner

@CrazyWolf13 Yes I don't have time to fix the CI recently, so ignore that for now.

I am not sure about that since I am also new to forward auth, maybe James can provide some idea on this?

@james-d-elliott james-d-elliott left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@CrazyWolf13

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews, @tobychui and @james-d-elliott, appreciate it!

An open-question for a follow-up PR (or this one if desired):

Now that Ignored Paths is approved: Authentik single-app users still have to add the /outpost.goauthentik.io vdir by hand on every host.
I think it may be worth to add a built-in option to auto-create it (generic "forward-auth callback path", or an Authentik specific toggle)?

What do you think about this @james-d-elliott?

@james-d-elliott

Copy link
Copy Markdown
Contributor

Yeah I think this is a good idea. Would be advisable to carefully check if a vdir exists first.

This would be applicable to any forward auth. Maybe a button on this page to auto create them if not existing? Or a way to bulk create vdirs from another page?

Forgive me I'm not super familiar with each area of zoraxy. I lean towards a page that handles the vdirs already, and giving a link to that from forward auth, if that makes sense. If you can create a reusable component that is always preferable to one that's super special.

That all said maybe something along the lines of:

  1. Input where user gives vdir and required/optional parameters for the vdir.
  2. Button which sets them.
  3. When pressed the process checks each host and if the vdir or a conflicting vdir exists.
  4. If the vdir exists it checks if the settings are different (if not just ignore, if different capture to display a warning).
  5. Display a warning of all hosts which it was not updated on.

@CrazyWolf13

Copy link
Copy Markdown
Contributor Author

Thanks, sounds like a reasonable approach to me!

What do you think of this @tobychui, e.g. where would you think is the best place this would fit?
And most likely in a seperate PR, right, so this would be ready to merge then?

@tobychui

Copy link
Copy Markdown
Owner

Yeah a separate PR makes perfect sense. Will be merging this now.

@tobychui tobychui merged commit 4f55b37 into tobychui:v3.3.4 Jun 23, 2026
0 of 2 checks passed
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.

3 participants