Skip to content

feat(dashboard): add token-based authentication support#4668

Open
matanbaruch wants to merge 2 commits intoargoproj:masterfrom
matanbaruch:feat/dashboard-token-auth
Open

feat(dashboard): add token-based authentication support#4668
matanbaruch wants to merge 2 commits intoargoproj:masterfrom
matanbaruch:feat/dashboard-token-auth

Conversation

@matanbaruch
Copy link
Copy Markdown

@matanbaruch matanbaruch commented Mar 24, 2026

Summary

Adds optional authentication to the Argo Rollouts dashboard with Bearer token auth, OIDC SSO (Okta, Google, Azure AD, Keycloak, etc.), and per-user Kubernetes RBAC enforcement. Closes #1323.

Features

  • --auth-mode token — requires a valid Kubernetes bearer token for API access
  • OIDC SSO — browser-based login flow via --oidc-issuer-url, --oidc-client-id, etc.
  • Per-user RBAC — in token auth mode, every K8s API call uses the user's own token, so Kubernetes RBAC policies are enforced per user (e.g., a read-only user cannot promote/abort rollouts)
  • Token validation via Kubernetes TokenReview API with caching
  • CSRF protection for OIDC flow
  • Default behavior (--auth-mode server) is unchanged — fully backward compatible

Usage

# No auth (default, backward compatible)
kubectl argo rollouts dashboard

# Bearer token auth with per-user RBAC
kubectl argo rollouts dashboard --auth-mode token

# OIDC SSO (e.g., Okta)
kubectl argo rollouts dashboard --auth-mode token \
  --oidc-issuer-url https://your-org.okta.com \
  --oidc-client-id my-client-id \
  --oidc-client-secret my-client-secret \
  --oidc-redirect-url http://localhost:3100/rollouts/auth/callback

How RBAC works

When --auth-mode=token is set, the server creates per-request Kubernetes clients using the user's bearer token. This means:

  • A user with get permissions on rollouts can view but not modify them
  • A user with update permissions can promote/abort/restart
  • Namespace restrictions in RBAC are enforced naturally
  • No custom policy engine needed — standard Kubernetes RBAC applies

Files changed

Area Files What
Token auth server/auth.go HTTP middleware, gRPC interceptors, TokenReview validation, cache
OIDC SSO server/oidc.go OIDC discovery, login redirect, callback token exchange, CSRF
Server + RBAC server/server.go AuthMode, RESTConfig in ServerOptions, per-request client creation via getClients(), all handlers updated
CLI dashboard.go --auth-mode, --oidc-* flags, REST config passthrough
Generated docs kubectl-argo-rollouts_dashboard.md Updated via go run ./hack/gen-docs/main.go
Frontend auth auth.tsx, api.tsx Auth context, token management, auth-aware fetch
Frontend UI login.tsx, login.scss, App.tsx, header.tsx Login page with SSO button, auth routing, logout
Frontend streaming watch.ts Token in EventSource URLs for SSE
Tests auth_test.go, oidc_test.go 85 tests covering middleware, OIDC, token extraction, caching

Test plan

  • All server tests pass (go test ./server/... — 85 tests)
  • Go project builds successfully (go build ./...)
  • UI builds successfully (yarn build)
  • Generated docs updated (go run ./hack/gen-docs/main.go)
  • Manual: --auth-mode token shows login page, valid token grants access
  • Manual: invalid token shows error notification
  • Manual: OIDC SSO redirects to provider and returns with valid session
  • Manual: read-only RBAC user cannot promote/abort (gets K8s 403)
  • Manual: logout returns to login page
  • Manual: watch/streaming works with token auth

@matanbaruch matanbaruch force-pushed the feat/dashboard-token-auth branch 4 times, most recently from da2a399 to c4c3970 Compare March 24, 2026 05:55
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 89.18919% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.73%. Comparing base (4919fcd) to head (74a8879).

Files with missing lines Patch % Lines
...g/kubectl-argo-rollouts/cmd/dashboard/dashboard.go 51.61% 15 Missing ⚠️
server/server.go 90.29% 10 Missing and 3 partials ⚠️
server/oidc.go 89.65% 7 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4668      +/-   ##
==========================================
+ Coverage   84.94%   85.73%   +0.79%     
==========================================
  Files         164      166       +2     
  Lines       18954    19290     +336     
==========================================
+ Hits        16100    16539     +439     
+ Misses       2000     1880     -120     
- Partials      854      871      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

Published E2E Test Results

  4 files    4 suites   4h 3m 3s ⏱️
120 tests 101 ✅  7 💤 12 ❌
504 runs  455 ✅ 28 💤 21 ❌

For more details on these failures, see this check.

Results for commit 74a8879.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

Published Unit Test Results

2 571 tests   2 571 ✅  3m 19s ⏱️
  129 suites      0 💤
    1 files        0 ❌

Results for commit 74a8879.

♻️ This comment has been updated with latest results.

@matanbaruch matanbaruch force-pushed the feat/dashboard-token-auth branch 4 times, most recently from 988c8fe to 3844066 Compare March 26, 2026 15:49
@matanbaruch matanbaruch force-pushed the feat/dashboard-token-auth branch from 3844066 to 7c421f0 Compare March 26, 2026 17:14
@matanbaruch
Copy link
Copy Markdown
Author

matanbaruch commented Mar 26, 2026

Hey @zachaller @kostis-codefresh, would love your eyes on this when you get a chance!

This addresses #1323 (Dashboard Authentication), which has been one of the most requested features since mid-2021. The lack of auth on the dashboard has been a real blocker for teams wanting to expose it beyond localhost.

The implementation adds optional token-based auth with per-user Kubernetes RBAC enforcement, plus OIDC SSO support all fully backward compatible (default behavior is unchanged). All CI checks are green and test coverage is solid.

Really appreciate all the work you both do keeping this project moving, happy to address any feedback!

@kostis-codefresh
Copy link
Copy Markdown
Member

Hello

Regarding the feature itself

From issue 1323 please take a look at the comments that talk about scope, complexity and maintenance

Basically, we want to keep the controller simple and minimal. Security (Authentication and authorization) features are not something to be taken lightly. We have already seen the burden of handling these features in Argo CD, and we know firsthand how quickly the scope can change according to different user needs.

Specifically for authentication there are already many other projects such as external proxies, service meshes and api gateways that can handle this feature with a shared and battle hardened implementation.

There is a separate effort to move Argo Rollouts to a plugin based architecture exactly to allow people to extend Argo Rollouts on their own while keeping the core code as lean as possible. Adding RBAC and authentication to the controller itself would be against this paradigm.

Regarding the code

This PR seems to be 100% AI generated and doesn't even show our minimum requirements as outlined in the PR template. We are also very hesitant on accepting any security related feature that is entirely generated by AI.

See also the general stance of the project on this matter.

The way forward

If you want to continue your contribution please open a brand new PR that contains only the token passing feature. But please follow the guidelines from the PR template as outlined above. And just to be clear this will only meet the minimum requirements for getting a review. It does not mean we will automatically merge it.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 6, 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.

Dashboard - Authentication

2 participants