Skip to content

fix: ForwardedHeaderFilter for OIDC behind TLS ingress, gitleaks URL override, graceful SIGTERM shutdown#163

Merged
coopernetes merged 3 commits intomainfrom
fix/oidc-http-headers
Apr 15, 2026
Merged

fix: ForwardedHeaderFilter for OIDC behind TLS ingress, gitleaks URL override, graceful SIGTERM shutdown#163
coopernetes merged 3 commits intomainfrom
fix/oidc-http-headers

Conversation

@coopernetes
Copy link
Copy Markdown
Owner

Summary

  • ForwardedHeaderFilter — register Spring's ForwardedHeaderFilter as the first filter in GitProxyWithDashboardApplication, ahead of Spring Session and Security. Fixes OAuth2 redirect URIs being built with http:// when running behind a TLS-terminating ingress (OCP Route, nginx), causing Entra ID to reject the authorization request for non-localhost origins.
  • Gitleaks download URL overridebuild.gradle now reads GITLEAKS_DOWNLOAD_URL env var, allowing air-gapped/restricted CI environments to redirect the binary download to a corporate artifact mirror (e.g. Artifactory) without modifying the build script.
  • Graceful SIGTERM shutdown — both GitProxyJettyApplication and GitProxyWithDashboardApplication now configure setStopAtShutdown(true) and setStopTimeout(30_000). Prevents in-flight git pushes from being torn down mid-transfer during Kubernetes rolling deploys or pod eviction.

Test plan

  • Deploy behind TLS-terminating ingress and confirm OIDC login redirects use https://
  • Set GITLEAKS_DOWNLOAD_URL to a mirror URL and confirm ./gradlew build fetches from it
  • Send SIGTERM mid-push and confirm the connection drains gracefully rather than being forcibly closed

coopernetes and others added 3 commits April 15, 2026 16:19
…ns, gitleaks URL override

ForwardedHeaderFilter (GitProxyWithDashboardApplication):
  Register Spring's ForwardedHeaderFilter as the first filter in the
  chain, ahead of Spring Session and Spring Security. When the app runs
  behind a TLS-terminating ingress (OCP Route, nginx, etc.) the pod only
  sees plain HTTP internally. Without this filter, Spring Security builds
  OAuth2 redirect URIs with an http:// scheme, which Entra ID refuses to
  process for non-localhost origins. The filter consumes X-Forwarded-Proto,
  X-Forwarded-Host, and X-Forwarded-Port from the ingress and rewraps the
  request so all downstream code — including the OAuth2 authorization
  request resolver — sees the correct public-facing scheme and host.

Redact regex pattern from blocked-content violation messages (BlockedContentDiffCheck):
  Violation messages previously included the raw regex pattern string
  ("blocked pattern: (?i)(password|secret...)"). This leaks internal
  scanning rules to the committer. Changed to a generic "blocked pattern
  match" message. The location (file path) is still included so the
  committer knows which file triggered the check.

Gitleaks download URL override (build.gradle):
  The gitleaks binary download URL is now overridable via the
  GITLEAKS_DOWNLOAD_URL environment variable. This allows CI environments
  without direct access to github.com releases to redirect the download
  to a corporate artifact mirror (e.g. Artifactory) without modifying
  the build script.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both server entry points (GitProxyJettyApplication and
GitProxyWithDashboardApplication) now configure Jetty for graceful
shutdown:

- server.setStopAtShutdown(true): registers a JVM shutdown hook so that
  SIGTERM triggers server.stop() rather than an abrupt JVM exit. Without
  this the OS kills the process immediately on SIGTERM regardless of
  in-flight work.

- server.setStopTimeout(30_000): gives Jetty up to 30s to drain active
  connections before the stop completes. Requests still being processed
  when SIGTERM arrives (e.g. a slow git push) are allowed to finish
  within that window; any that exceed 30s are forcibly closed.

This matches the behaviour Spring Boot provides via server.shutdown=graceful
+ spring.lifecycle.timeout-per-shutdown-phase. It is especially important
on Kubernetes/OCP where the kubelet sends SIGTERM during rolling deploys
and pod eviction — previously any in-flight git push or proxy stream would
be torn down mid-transfer, leaving the client with a broken pack.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reverts the regex-redaction change introduced in d34d139 — saving it
for a dedicated PR with fuller context for issue #152.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coopernetes coopernetes enabled auto-merge (squash) April 15, 2026 20:46
@coopernetes coopernetes merged commit 754f43c into main Apr 15, 2026
9 checks passed
@coopernetes coopernetes deleted the fix/oidc-http-headers branch April 15, 2026 20:49
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.

1 participant