Skip to content

fix(sso): return users to the page they asked for after logging in - #213

Merged
devantler merged 1 commit into
mainfrom
claude/template-sso-deep-links-200
Oct 2, 2026
Merged

devantler merged 1 commit into
mainfrom
claude/template-sso-deep-links-200

Conversation

@devantler

Copy link
Copy Markdown
Contributor

🤖 Generated by the Agentic Engineer

Why

On a platform created from this template, someone who opens a link into a protected dashboard while signed out (an alert link, a bookmarked report) lands on that service's front page after signing in, not on the page they asked for. The reference platform fixed and verified the same problem live last week.

What

Signing in now returns people to the exact page they opened, on every protected site, in both the default and the Coroot observability setup. A new check in the template's validation fails if a protected site is added without the matching sign-in setting, or if a leftover one remains.

Fixes #200

Port the reference platform's verified fix (devantler-tech/platform#3169):
register oauth2-proxy's callback on every fronted host with Dex, drop the
fixed redirect_url, and drop the per-route X-Auth-Request-Redirect headers.
The Coroot profile retires the callbacks of the UIs it removes. The guard
test renders both observability profiles on both providers.

Fixes #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e8fb657c-fbbb-4d32-a0c1-b78be04937d2

📥 Commits

Reviewing files that changed from the base of the PR and between 533ffac and 9cd8235.

📒 Files selected for processing (13)
  • .github/workflows/validate-scaffold.yaml
  • k8s/bases/apps/homepage/http-route.yaml
  • k8s/bases/infrastructure/controllers/cilium/http-route.yaml
  • k8s/bases/infrastructure/controllers/coroot/http-route.yaml
  • k8s/bases/infrastructure/controllers/dex/helm-release.yaml
  • k8s/bases/infrastructure/controllers/kube-prometheus-stack/http-route-alertmanager.yaml
  • k8s/bases/infrastructure/controllers/kube-prometheus-stack/http-route-prometheus.yaml
  • k8s/bases/infrastructure/controllers/oauth2-proxy/helm-release.yaml
  • k8s/bases/infrastructure/controllers/opencost/http-route.yaml
  • k8s/components/observability-coroot/remove-kps-ui/kustomization.yaml
  • k8s/components/observability-coroot/remove-opencost-references/kustomization.yaml
  • scripts/tests/test-oauth2-proxy-sso-redirects.sh
  • scripts/validate-observability-option.sh
💤 Files with no reviewable changes (6)
  • k8s/bases/infrastructure/controllers/kube-prometheus-stack/http-route-prometheus.yaml
  • k8s/bases/infrastructure/controllers/cilium/http-route.yaml
  • k8s/bases/infrastructure/controllers/kube-prometheus-stack/http-route-alertmanager.yaml
  • k8s/bases/apps/homepage/http-route.yaml
  • k8s/bases/infrastructure/controllers/opencost/http-route.yaml
  • k8s/bases/infrastructure/controllers/coroot/http-route.yaml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🔇 Additional comments (7)
k8s/bases/infrastructure/controllers/dex/helm-release.yaml (1)

73-86: LGTM!

k8s/bases/infrastructure/controllers/oauth2-proxy/helm-release.yaml (1)

84-92: LGTM!

k8s/components/observability-coroot/remove-kps-ui/kustomization.yaml (1)

82-94: LGTM!

k8s/components/observability-coroot/remove-opencost-references/kustomization.yaml (1)

337-350: LGTM!

scripts/validate-observability-option.sh (1)

800-805: LGTM!

scripts/tests/test-oauth2-proxy-sso-redirects.sh (1)

1-206: LGTM!

.github/workflows/validate-scaffold.yaml (1)

62-67: LGTM!


📝 Walkthrough

Walkthrough

Dex callback registrations and oauth2-proxy settings now support callbacks on protected hosts. HTTPRoutes no longer set a fixed X-Auth-Request-Redirect header. Profile patches remove callback registrations for hosts that are not routed. A new script checks rendered Hetzner and Docker overlays, and the scaffold workflow runs that script.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 9cd82

This change registers per-host SSO callbacks so users return to the page they opened after signing in. No concrete merge-blocking issue was found. CI should run the new redirect validation script before merge.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 9cd82

The callback expansion is limited to configured protected sites, which remain behind the same authentication proxy and group restriction. No authentication bypass or credential disclosure was established. Request-header handling, login-state protection, and behavior during partially completed upgrades remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed callback flow affects the protected sites sharing this proxy and Dex client within a generated platform deployment. A regression in that shared login flow could affect access to multiple dashboards. The inspected changes do not establish new cross-tenant authority, IAM permissions, or datastore privileges.

Trust Boundaries and Controls

  • inferred — Removing gateway-supplied redirect overrides makes request-derived destination handling more significant. Reverse-proxy mode, redirect-domain allowlisting, and exact Dex callback registrations are relevant controls, but the inspected evidence does not establish forwarded-header sanitization or deployed-version state/CSRF binding. This remains an enforcement gap, not a demonstrated open redirect or authentication bypass.

Resilience and Maintainability Implications

  • observed — Both authentication releases include shared install/upgrade remediation and drift-detection components. Exact-value callback patch tests also fail configuration composition when assumptions drift. These mechanisms support recovery and control consistency, but neither proves uninterrupted authentication or coordinated rollback.

Hardening Proposals

  • proposed — Supplement rendered checks with deployed-version authentication exercises covering manipulated redirect/forwarded headers, state and cookie correlation across hosts, concurrent and repeated callbacks, and login attempts during staggered upgrade and rollback. Establish that failures deny access and recover without weakening authentication controls.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Docstring Coverage ❌ Error Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (5 skipped: 5… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the coding requirements in [#200]. Dex registers callbacks for the protected hosts. oauth2-proxy no longer uses a fixed redirect_url, and protected routes no longer set `X-Auth-Req…
Out of Scope Changes check ✅ Passed The changed files support [#200]. They update Dex callback registration, oauth2-proxy redirect settings, protected HTTPRoutes, Coroot route-removal patches, and validation coverage. No unrelated chang…
Title check ✅ Passed The title clearly and concisely describes the main change: returning users to the protected page they requested after SSO login.
Description check ✅ Passed The description directly explains the SSO deep-link problem, the implemented fix, and the validation coverage described by the changeset.
Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (5 skipped: 5 unsupported.)

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

Readiness at 9cd8235a. CI is green (12 passed, 5 skipped, including the Talos and Docker scaffold validation). CodeRabbit finished a finding-free review of this head, and there are no review threads.

Tried as a user: nothing can run here without a cluster, so I inspected the rendered overlays. With the default observability setup, both providers put six hosts and oauth2-proxy's own host behind sign-in. Dex now accepts each host's own login callback, no route forces a fixed return URL, and oauth2-proxy no longer pins one callback host. With the Coroot setup, Dex keeps exactly the callbacks of the hosts that setup still serves (home, Hubble and Coroot). The OpenCost, Prometheus and Alertmanager callbacks are retired along with their UIs. The new guard passes on all four renders, and it fails on the unchanged template. validate-observability-option.sh, the shared-policy and recommended-label validators, ksail workload validate for prod, and every cluster overlay build pass.

@devantler
devantler marked this pull request as ready for review October 2, 2026 14:03
@devantler
devantler requested a review from a team as a code owner October 2, 2026 14:03
@devantler
devantler merged commit 111b61a into main Oct 2, 2026
17 checks passed
@devantler
devantler deleted the claude/template-sso-deep-links-200 branch October 2, 2026 14:04
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.

Protected UIs lose the requested page through the SSO login

1 participant