Skip to content

ci(scratch-aws-access): tag AssumeRole sessions with --source-identity#36639

Draft
jasonhernandez wants to merge 1 commit into
mainfrom
sec-573-source-identity-on-assume-role
Draft

ci(scratch-aws-access): tag AssumeRole sessions with --source-identity#36639
jasonhernandez wants to merge 1 commit into
mainfrom
sec-573-source-identity-on-assume-role

Conversation

@jasonhernandez
Copy link
Copy Markdown
Contributor

Summary

Every CI session today appears in CloudTrail under role-session-name `ci` — indistinguishable from every other CI session. Adding `--source-identity "$BUILDKITE_JOB_ID"` makes each AssumeRole call attributable to a specific job, and unlocks future trust-policy conditions on `sts:SourceIdentity` (e.g., "only this build-step can use this role").

Coordination

This requires a paired i2 PR that allows the `sts:SetSourceIdentity` action in the `mz-scratch-ci-role` trust policy — see `MaterializeInc/i2` PR (TBD). Without that allowance, this AssumeRole call fails with `AccessDenied`. Land the i2 PR first.

Tracking: i2 SEC-573 / SEC-566 audit.

Test plan

  • After both PRs merge, run a representative job; confirm it succeeds (no AccessDenied)
  • Check CloudTrail `AssumeRole` events: `sourceIdentity` field should contain the BUILDKITE_JOB_ID UUID
  • Verify the local-dev fallback (`BUILDKITE_JOB_ID` unset) still succeeds with `unknown`

🤖 Generated with Claude Code

The plugin currently calls AssumeRole with a fixed role-session-name `ci`,
so CloudTrail can't attribute a session to a specific job — every CI run's
session looks identical. Adding `--source-identity "$BUILDKITE_JOB_ID"`
makes each session uniquely traceable in CloudTrail and lets us write
role-trust conditions on `sts:RoleSessionName` / `sts:SourceIdentity` later.

Coordination: requires the `mz-scratch-ci-role` trust policy in i2 to
allow `sts:SetSourceIdentity` action. Without that, `aws sts assume-role
--source-identity ...` fails with AccessDenied. The i2 PR adding that
allowance must land first.

Tracking: i2 SEC-573 / SEC-566 audit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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