Repository navigation
dashboard-api: restrict callers to onboarded accounts - #1605
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Every authenticated route now requires the caller's account to be in the portal registry (spore-portal-accounts, not offboarded) or in the new DASHBOARD_ALLOWED_ACCOUNTS, checked before the portal-role shortcut and before any user-account row is written. Fails closed: 403 when not entitled, 503 when the registry cannot be read. The role script grants GetItem on the registry and kms:Decrypt on its key via DynamoDB.
scttfrdmn
force-pushed
the
fix/sec-dashboard-api-entitlement
branch
from
November 12, 2026 20:07
1f5ed45 to
377472f
Compare
scttfrdmn
marked this pull request as ready for review
November 12, 2026 20:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restricts dashboard-api callers to onboarded or allow-listed accounts.
Authentication (STS
GetCallerIdentityon the caller's credentials, or API Gateway's IAM identity) shows who a caller is. It doesn't show that the caller is a customer. Every authenticated route now also requires an entitled account (lambda/dashboard-api/entitlement.go):spore-portal-accounts(GetItemonaccountId, projecting onlyaccountIdandstatus), and that row is notoffboarded; orDASHBOARD_ALLOWED_ACCOUNTS(comma-separated 12-digit IDs; malformed entries are logged and entitle nothing).spawn-user-accountsis deliberately not a source, because this Lambda writes that table itself on a caller's first request.What the check covers
spore-portal-launchshortcut, the user-account cache read, and any cache write. So that role name is honoured only inside an entitled account.POST /api/strata/resolve.GET /api/strata/catalogstays anonymous, as before.Deploy checklist impact (manual, ordered)
lambda/dashboard-api/scripts/setup-dashboard-lambda-role.sh <profile>. It addsdynamodb:GetItemontable/spore-portal-accountstoSpawnDashboardLambdaPolicy. It also writesSpawnDashboardLambdaPolicyPortalRegistryKMS:kms:Decrypton the table's own CMK (read withdescribe-table), conditioned onkms:ViaService=dynamodb.us-east-1.amazonaws.comandkms:EncryptionContext:aws:dynamodb:tableName=spore-portal-accounts. Both are inline on the existing role and are removed with it (oraws iam delete-role-policy …). No new resource.DASHBOARD_ALLOWED_ACCOUNTSonspawn-dashboard-api, merged into the existing map, because--environmentreplaces the whole map. Until this is set, and while the registry has no rows, every caller gets 403. Optional:DASHBOARD_ACCOUNTS_TABLE(defaultspore-portal-accounts).lambda/dashboard-api/deploy.sh <profile>(this is code plus a manual config step).Tests
Fakes only. They cover the allow list, active/dormant/no-status rows, offboarded rows, strangers, malformed entries, caching, an unreadable registry (fails closed, not cached), every named account having to pass, and parsing the scope's account. Through
handler()with a fake STS: a stranger's IAM user and a stranger assumingspore-portal-launchget 403 onPOST /teams,POST /teams/{id}/members,POST /api/strata/resolveandGET /api/instances, and cause no other AWS call. The same role in an onboarded account reaches the route. An unreadable registry returns 503. Removing the check makes the gate fail.make checkis green.semgrep scan --config=auto --erroron the changed paths is clean.Not changed:
POST /teams/{id}/membersstill accepts a member ARN from any account. An invitee may not be onboarded yet, so I left that as a product decision.