You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No check that a deploy script grants IAM to the role its function actually uses #860
Found while fixing #835. scripts/deploy-custom-dns.sh created and granted permissions to SpawnDNSLambdaRole:
$ aws iam get-role --role-name SpawnDNSLambdaRoleAn error occurred (NoSuchEntity): The role with name SpawnDNSLambdaRole cannot be found.
$ aws lambda get-function-configuration --function-name spawn-dns-updater \ --region us-east-1 --query Role --output textarn:aws:iam::966362334030:role/SpawnDNSLambdaExecutionRole
So every put-role-policy the script made went to a role it had just created for the purpose and nothing used, while the function kept running under a different role whose policies exist only in the account. The script reported success either way, and the create path would have attached the wrong role to a fresh function.
Fixed for that one script in #858. Nothing detects the next one. This is the IAM-side twin of #790's "reconstructing an identifier from a convention": a role name in a script is an assertion about the live account, and nothing checks it.
Why CI can't gate it
The property is a comparison against live AWS, so it belongs with scripts/lambda-deploy-census.sh and make lambda-versions-deployed rather than in make check.
Proposed check
For each lambda-deploying script, discovered rather than listed (per rule 4, failing on an empty discovery):
extract its FUNCTION_NAME default and its ROLE_NAME / ROLE_ARN;
read the live function's Role;
report any mismatch, and any role name the script references that does not exist.
It would also catch the inverse — a role that exists, is granted to, and is attached to nothing.
Scope note
A quick scan suggests this is worth running across all of scripts/ and lambda/*/deploy.sh before writing the checker, since the count of affected scripts is unknown; deploy-custom-dns.sh is simply the one that surfaced. Not measured yet — deliberately not claiming a number here.
Measured, filling the scope note. 1 of 8 was wrong, and #858 fixed it — so this checker is purely preventive, not a cleanup. Adjusting the priority down accordingly.
Discovery: every *.sh under scripts/, lambda/ and deployment/ containing aws lambda create-function or update-function-code (8 scripts), each script's ROLE_NAME compared against the live function's Role:
script
function
role in script
live role
verdict
lambda/dashboard-api/deploy.sh
spawn-dashboard-api
SpawnDashboardLambdaRole
SpawnDashboardLambdaRole
ok
lambda/dashboard-api/scripts/deploy.sh
spawn-dashboard-api
(none)
SpawnDashboardLambdaRole
ok
lambda/dashboard-websocket-processor/deploy.sh
spawn-dashboard-websocket-processor
SpawnDashboardLambdaRole
SpawnDashboardLambdaRole
ok
lambda/dashboard-websocket/deploy.sh
spawn-dashboard-websocket
SpawnDashboardLambdaRole
SpawnDashboardLambdaRole
ok
scripts/deploy-cost-history-collector.sh
spawn-cost-history-collector
SpawnDashboardLambdaRole
SpawnDashboardLambdaRole
ok
scripts/deploy-custom-dns.sh
spawn-dns-updater
SpawnDNSLambdaExecutionRole
SpawnDNSLambdaExecutionRole
ok (after #858; was SpawnDNSLambdaRole, nonexistent)
scripts/deploy-scheduler-handler.sh
scheduler-handler
SpawnSchedulerHandlerExecutionRole
SpawnSchedulerHandlerExecutionRole
ok
scripts/deploy-sweep-orchestrator.sh
spawn-sweep-orchestrator
SpawnSweepOrchestratorRole
SpawnSweepOrchestratorRole
ok
A methodology note, because it nearly went in the issue as fact: my first pass used grep -oE and reported one MISMATCH and one ROLE MISSING that were both artefacts of my own parsing — a trailing } left on ${SPAWN_LAMBDA_ROLE:-SpawnDashboardLambdaRole} and several FUNCTION_NAME values unresolved, which rendered as (no such function). Both looked exactly like real findings. The checker this issue proposes has to resolve ${VAR:-default} properly, and anything it reports as absent needs confirming by a second route before anyone acts on it.
Two things the table shows that are worth keeping:
lambda/dashboard-api/scripts/deploy.sh names no role at all and deploys the same function as lambda/dashboard-api/deploy.sh. Two deploy scripts for one function is its own hazard, separate from this one.
Activity
scttfrdmn commentedon Oct 12, 2026
Measured, filling the scope note. 1 of 8 was wrong, and #858 fixed it — so this checker is purely preventive, not a cleanup. Adjusting the priority down accordingly.
Discovery: every
*.shunderscripts/,lambda/anddeployment/containingaws lambda create-functionorupdate-function-code(8 scripts), each script'sROLE_NAMEcompared against the live function'sRole:lambda/dashboard-api/deploy.shlambda/dashboard-api/scripts/deploy.shlambda/dashboard-websocket-processor/deploy.shlambda/dashboard-websocket/deploy.shscripts/deploy-cost-history-collector.shscripts/deploy-custom-dns.shSpawnDNSLambdaRole, nonexistent)scripts/deploy-scheduler-handler.shscripts/deploy-sweep-orchestrator.shA methodology note, because it nearly went in the issue as fact: my first pass used
grep -oEand reported one MISMATCH and one ROLE MISSING that were both artefacts of my own parsing — a trailing}left on${SPAWN_LAMBDA_ROLE:-SpawnDashboardLambdaRole}and severalFUNCTION_NAMEvalues unresolved, which rendered as(no such function). Both looked exactly like real findings. The checker this issue proposes has to resolve${VAR:-default}properly, and anything it reports as absent needs confirming by a second route before anyone acts on it.Two things the table shows that are worth keeping:
lambda/dashboard-api/scripts/deploy.shnames no role at all and deploys the same function aslambda/dashboard-api/deploy.sh. Two deploy scripts for one function is its own hazard, separate from this one.scheduler-handleris the only function whose name is notspawn--prefixed, which is why a prefix-filtered inventory missed it before (Leave no trace: nothing reaps the control plane — the lambdas, their roles/rules/alarms, or the buckets spawn auto-creates #653).