Skip to content

Fix SAML callback blank redirect response - #93

Merged
LeoStehlik merged 1 commit into
masterfrom
fix/saml-callback-blank-page-root-cause-2026-09-14
Sep 14, 2026
Merged

LeoStehlik merged 1 commit into
masterfrom
fix/saml-callback-blank-page-root-cause-2026-09-14

Conversation

@LeoStehlik

@LeoStehlik LeoStehlik commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • replace descriptor-based SAML callback redirects with an explicit terminal Fastify 303 response
  • mark provider and custom ACS callback handlers with SkipTransform so the global response interceptor cannot wrap redirect output
  • update the SSO Fastify callback spec to include the production global response transform; this test reproduces the PR Fix SAML callback runtime redirects #92 gap
  • add safe RelayState fallback coverage and an OCI revision label hook for image provenance

Root Cause

PR #92 returned Nest @Redirect() descriptors like { url, statusCode } from callbacks. Its test booted Fastify with the /api prefix and cookie plugin, but did not register the production TransformHttpResponseInterceptor from main.ts.

In production, that interceptor wrapped the descriptor under data, so Nest's redirect handler no longer saw a top-level url or statusCode. A local production-interceptor probe against master reproduced this as 302, empty Location, auth cookie present, and zero-byte body for both SAML callback routes. That explains why the browser can stay on a blank callback after a successful-looking login and why PR #92 passed locally.

Fix

The callbacks now issue the terminal response directly: status 303, Location, auth cookie, send(). The response is not a JSON API payload, so the callbacks explicitly skip the global transform.

Verification Run

  • pnpm --filter ./apps/server test -- sso --runInBand: 3 suites, 22 tests passed
  • pnpm --filter ./apps/server exec jest --runInBand: 27 suites, 156 tests passed
  • pnpm --filter ./apps/server build: passed
  • git diff --check: passed
  • production-interceptor HTTP probe after fix: provider callback and custom ACS both returned 303, non-empty Location, Set-Cookie present, zero-byte body

Live-Safe Post-Deploy Checks

Do not print SAMLResponse, cookies, JWTs, certificates, or claims. For the deployed container, confirm source and compiled artifact with read-only commands such as:

git rev-parse HEAD
docker image inspect <image> --format '{{ index .Config.Labels "org.opencontainers.image.revision" }} {{ .Created }} {{ .Id }}'
docker inspect <container> --format '{{ .Created }} {{ .Image }} {{ json .Config.Labels }}'
docker exec -T <container> sh -lc "grep -R --line-number \"sendSamlCallbackRedirect\\|SkipTransform\\|status(HttpStatus.SEE_OTHER)\\|header('Location'\" /app/apps/server/dist/core/sso/sso.controller.js"

For one fresh incognito SP-initiated login, capture only safe callback metadata: timestamp/path, HTTP status, whether Location is present and same-origin, whether Set-Cookie is present without value, content type, byte count, app log outcome, and whether the Redis request key was consumed. Expected successful callback: 303, Location to app URL, Set-Cookie present, zero-byte body.

Security

SAML validation is unchanged: validateInResponseTo remains ifPresent, Redis request ID TTL/consumption remains in place, and response/assertion signature requirements remain enabled.

@LeoStehlik
LeoStehlik merged commit e571400 into master Sep 14, 2026
1 check passed
@LeoStehlik LeoStehlik mentioned this pull request Sep 14, 2026
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