Skip to content

feat(dashboard-api): accept federated portal identity, scope by account - #445

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/dashboard-api-federated-portal-auth
Jul 26, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/dashboard-api-federated-portal-auth

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Why

The spore.host portal signs in via Globus→STS AssumeRoleWithWebIdentity, so its X-AWS-Credentials caller resolves (via GetCallerIdentity) to an assumed-role ARN — arn:aws:sts::<acct>:assumed-role/spore-portal-launch/<session> — not an IAM :user/ ARN.

The existing auth path (getUserFromCredentialsHeader) treats any non-:user/ caller as a "web" Cognito identity that must present an email claim + a CLI-linked IAM ARN (spawn auth link). The browser-native, no-paste portal sends neither, so every portal API call 401s today (confirmed live: GET api.spore.host/api/strata/catalog → 401).

This blocks portal Slice 5 (shared/multi-tenant features via X-AWS-Credentials: strata catalog, cost-history, teams, Slack).

What

Recognize a caller assuming a trusted portal launch role and scope its data by its own verified AWS account — the tenant key the portal decided on — skipping the Cognito/email/CLI-link requirement.

  • portalAccountFromARN: parse the assumed-role ARN, match the role name against an allow list, return the verified account.
  • Allow list defaults to [spore-portal-launch], overridable per-deploy via SPAWN_DASHBOARD_PORTAL_ROLES (e.g. spore-ucla-launch for institution self-deploys).
  • Federated portal identities are not cached (the per-session role ARN would churn a spawn-user-accounts row per login).
  • CLI (:user/) and existing Cognito paths are untouched.

Security

The account is always the SigV4-verified caller's own (from GetCallerIdentity). Trusting a role name here can never widen access beyond the account that already holds those credentials — same invariant as the phone-home registrar.

Tests

auth_test.go: role recognition (trusted role → account; IAM user / unknown role / malformed / no-session → rejected), env-override allow list, default-when-unset. go build ./... + go test ./... green.

The spore.host portal signs in via Globus→STS AssumeRoleWithWebIdentity, so
its X-AWS-Credentials caller resolves to an assumed-role ARN
(arn:aws:sts::<acct>:assumed-role/spore-portal-launch/<session>), not an IAM
:user/ ARN. The old auth path treated any non-:user/ caller as a "web" Cognito
identity requiring an email claim + a CLI-linked IAM ARN (spawn auth link) —
neither of which the browser-native, no-paste portal sends. Result: every
portal API call 401'd.

Recognize a caller assuming a trusted portal launch role and scope its data by
its OWN verified AWS account (the tenant key the portal decided on), skipping
the Cognito/email/CLI-link requirement. The account always comes from the
SigV4-verified caller, so trusting a role NAME here can never widen access
beyond the account that already holds those creds.

- portalAccountFromARN: parse assumed-role ARN, match role name against the
  allow list, return the verified account.
- allow list defaults to [spore-portal-launch], overridable per-deploy via
  SPAWN_DASHBOARD_PORTAL_ROLES (e.g. spore-ucla-launch for self-deploys).
- federated portal identities are not cached (per-session role ARN would churn
  a spawn-user-accounts row per login).
- CLI (:user/) and existing Cognito paths are untouched.

Unblocks portal Slice 5 (shared/multi-tenant features via X-AWS-Credentials).
@scttfrdmn
scttfrdmn merged commit a284697 into main Jul 26, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the feat/dashboard-api-federated-portal-auth branch July 26, 2026 08:24
scttfrdmn added a commit that referenced this pull request Jul 28, 2026
Backfills Unreleased entries for #443 (spawn onboard), #444, #445 and #446,
which merged without changelog entries, and commits the generated reference
for spawn onboard — check-docs only diffs tracked files, so docs-gen/onboard.md
was never added when the command landed.

Sections reordered to Keep-a-Changelog order (Added first), matching prior
releases.
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