Repository navigation
feat: support configuring OIDCXForwardedHeaders in the httpd oidc image - #54
Merged
Merged
Conversation
When the container runs behind a reverse proxy that sets X-Forwarded-*, mod_auth_openidc logs a warning for every forwarded header on every request, because since 2.4.10 it ignores those headers unless they are explicitly listed in OIDCXForwardedHeaders. There was previously no way to list them. Add an OIDC_X_FORWARDED_HEADERS variable following the existing OIDCRemoteUserClaim idiom: the directive ships commented out and is uncommented at boot only when the variable is set. Conditional rendering is required rather than cosmetic, since an empty OIDCXForwardedHeaders directive fails Apache's config parse. Leaving the variable unset remains the default, so existing deployments are unaffected and nothing begins trusting spoofable headers implicitly. Verified against the published 0.3.0 image with these files overlaid, issuing one request carrying all three headers: unset yields 3 warnings, set yields 0, and apache2ctl configtest reports Syntax OK in both cases. With the variable unset the rendered config is byte-identical to today's. Fixes #53 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018RE59Gf2SNENSR6AA6FuE8 Signed-off-by: Nathan Klick <nathan@swirldslabs.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #53
Summary
Adds an
OIDC_X_FORWARDED_HEADERSvariable so operators runningapache-httpd-oidcbehind a trusted reverse proxy can populateOIDCXForwardedHeaders. There was previously no way to set it.Since mod_auth_openidc 2.4.10,
X-Forwarded-*headers are ignored unless explicitly listed in that directive, and the module warns once per forwarded header per request when it sees one it has not been told to trust. Not listing them is the safe default — the module is refusing to trust headers a client could spoof — so this adds an opt-in rather than changing what happens by default.Implementation
Follows the
OIDCRemoteUserClaimidiom already established in this image: ship the directive commented out, uncomment it at boot only when the variable is set.#OIDCXForwardedHeaders ${OIDC_X_FORWARDED_HEADERS}The conditional rendering is required rather than stylistic: an empty
OIDCXForwardedHeadersdirective fails Apache's config parse, so the line must stay commented when the variable is unset.Verification
Built against the published
0.3.0image with these two files overlaid, issuing a single request carryingX-Forwarded-Host,X-Forwarded-PortandX-Forwarded-Proto:apache2ctl configtestWith the variable set, boot logs the expected line and the directive is active:
With it unset, the directive stays commented and the rendered config is byte-identical to today's — existing deployments are unaffected.
shellcheckonentrypoint-helper.shreports nothing new (the singleSC1091info about sourcinglogger.shis pre-existing).A full
docker buildfrom source was not possible in my environment — the Debian snapshotapt-getstep in the Dockerfile fails independently of this change — hence verification against the published image with the modified files overlaid.Notes for reviewers
X-Forwarded-*rather than passing them through; otherwise this turns a spoofable header into trusted input.OIDCRemoteUserClaimis only applied whenOIDC_REMOTE_USER_CLAIMis non-empty, which is correct — flagging only because the commented-by-default pattern is easy to misread as the directive being inert.🤖 Generated with Claude Code
https://claude.ai/code/session_018RE59Gf2SNENSR6AA6FuE8