Skip to content

dashboard-api: retire SpawnDashboardCrossAccountReadRole; read EC2 as the caller (#1585) - #1633

Merged
scttfrdmn merged 1 commit into
mainfrom
hardening/1585-retire-dashboard-read-role
Nov 14, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
hardening/1585-retire-dashboard-read-role

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1585

What changes

The live mitigation (2026-11-11) removed EC2 read and the AssumeRole into 435415984226 from Cognito_SpawnDashboard_Auth_Role. This PR removes what still assumed the role:

  • lambda/dashboard-api/cross_account.go: getEC2ClientForRegion now builds the EC2 client on the caller's own verified credentials, in the caller's own account. There is no AssumeRole and no role ARN, and the SPAWN_DASHBOARD_CROSS_ACCOUNT_ROLE override is gone. A portal sign-in (spore-portal-launch in its own account) or a CLI user's own keys read their own account, so IAM bounds what each caller sees. The Lambda role is never used for these reads.
  • Identity-pool sessions (.../assumed-role/<role>/CognitoIdentityCredentials) are not acted as. Their role has no EC2 access, so /api/instances, /api/instances/{id} and /api/cost-summary return a 403 naming the portal and spawn list before any EC2 call. Previously they made a denied call in every region and returned an empty list.
  • Terminate stays refused, per the owner decision in Dashboard: terminate and sweep cancel in a member account have no role that may do them (owner decision) #1349. Before, the code called TerminateInstances on the read role, which IAM always denied. On the caller's own credentials that call could now succeed, so handleTerminateInstance makes no EC2 call at all and returns the 403 naming spawn terminate <id>. terminateCancellingSpot and its tests are removed with it.
  • Deleted: lambda/dashboard-api/scripts/setup-cross-account-role.sh.
  • IAM coverage gate: the dashboard-api "member account" context (variant: the read role) becomes "caller's own credentials". Its policy is the spawn list row of the generated docs/reference/cli-iam-actions.md, meaning what a spawn user already holds. The callerAssumeRoleProvider cut is gone, and so are the two permanent Dashboard: terminate and sweep cancel in a member account have no role that may do them (owner decision) #1349 ledger entries, because the calls no longer exist.
  • The browser still holds its own sts.assumeRole into the role (spore-host web/js/main.js:296), plus spore-host scripts that create the role and re-grant EC2 to the Cognito role. I filed Dashboard: remove the browser's AssumeRole into SpawnDashboardCrossAccountReadRole and the scripts that grant it (spawn#1585) spore-host#742 for those.

Tests

cross_account_test.go: nil credentials refuse in the client builder and in all three read paths. The client signs with exactly the caller's access key. No non-test file contains stscreds, AssumeRole(, the role ARN or the override, and the setup script is gone. isIdentityPoolSession is covered, and terminate returns 403 naming the CLI. The iamcoverage gate passes. make check is clean apart from the known space-in-path failures. Semgrep is clean.

Live deletion for the owner

Delete SpawnDashboardCrossAccountReadRole from 435415984226, and from any other account setup-cross-account-role.sh or spore-host's setup-dashboard-cross-account-role.sh was run in:

# snapshot first
aws iam get-role --role-name SpawnDashboardCrossAccountReadRole --profile spore-host-dev
aws iam list-role-policies --role-name SpawnDashboardCrossAccountReadRole --profile spore-host-dev
aws iam list-attached-role-policies --role-name SpawnDashboardCrossAccountReadRole --profile spore-host-dev
aws iam get-role-policy --role-name SpawnDashboardCrossAccountReadRole --policy-name SpawnDashboardEC2ReadAccess --profile spore-host-dev > /tmp/read-role-policy.json
# delete (detach any managed policy the list shows first)
aws iam delete-role-policy --role-name SpawnDashboardCrossAccountReadRole --policy-name SpawnDashboardEC2ReadAccess --profile spore-host-dev
aws iam delete-role --role-name SpawnDashboardCrossAccountReadRole --profile spore-host-dev

To find other copies, run aws iam get-role --role-name SpawnDashboardCrossAccountReadRole in each onboarded account. The role has the tags spawn:purpose=dashboard-read and spawn:managed=true.

Also, list key names only for spawn-dashboard-api's environment. If it sets SPAWN_DASHBOARD_CROSS_ACCOUNT_ROLE, remove that key and keep the rest.

Deploy

  • spawn-dashboard-api: code-only. No IAM change in the infra account.

Live checks

  1. Before deleting the role: aws iam simulate-principal-policy --policy-source-arn arn:aws:iam::966362334030:role/Cognito_SpawnDashboard_Auth_Role --action-names sts:AssumeRole --resource-arns arn:aws:iam::435415984226:role/SpawnDashboardCrossAccountReadRole returns implicitDeny. --action-names ec2:DescribeInstances also returns implicitDeny. This confirms the 2026-11-11 mitigation.
  2. After deploy: a portal sign-in lists its own instances. A Cognito-identity-pool sign-in gets the 403 naming spawn list on /api/instances and causes no EC2 calls (check CloudTrail in 966362334030 for DescribeInstances by CognitoIdentityCredentials sessions, count only). DELETE /api/instances/<id> returns the 403 naming spawn terminate.
  3. After deleting the role: aws iam get-role --role-name SpawnDashboardCrossAccountReadRole --profile spore-host-dev returns NoSuchEntity.

@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn force-pushed the hardening/1585-retire-dashboard-read-role branch from 2ce9dd7 to 5dd0299 Compare November 14, 2026 20:17
… the caller (#1585)

The read role in 435415984226 trusted the Cognito identity-pool role every
Google/GitHub/Globus sign-in gets, so any of them could list every
tenant's instances there from the browser. The live mitigation removed
the Cognito role's AssumeRole and EC2 read; this removes what still
assumed the role.

EC2 reads now use the caller's own verified credentials in the caller's
own account, with no AssumeRole; an identity-pool session is not acted as
and gets a 403 before any EC2 call. Terminate stays refused (#1349) and
now makes no EC2 call. setup-cross-account-role.sh and the
SPAWN_DASHBOARD_CROSS_ACCOUNT_ROLE override are removed. The IAM coverage
gate checks the reads against the caller's `spawn list` grants from the
generated CLI reference. The browser side is spore-host/spore-host#742.
@scttfrdmn
scttfrdmn marked this pull request as ready for review November 14, 2026 22:32
@scttfrdmn
scttfrdmn force-pushed the hardening/1585-retire-dashboard-read-role branch from 5dd0299 to f053b6c Compare November 14, 2026 22:32
@scttfrdmn
scttfrdmn merged commit a247d76 into main Nov 14, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the hardening/1585-retire-dashboard-read-role branch November 14, 2026 22:50
@scttfrdmn scttfrdmn mentioned this pull request Nov 15, 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.

security: Dashboard per-user instance isolation is Lambda-side only; any Google/GitHub/Globus sign-in can read every tenant's instances directly

1 participant