Skip to content
guidePhase: BuildData SecurityGuide 16 of 16

Roles: security · devops sre · developer

Guide: Identity, Access & Secrets ​

Decision: How humans, CI, and services authenticate — and how credentials, keys, and permissions are scoped across environments.

Related: identity-access-secrets.md · data-governance.md · ci-cd-release.md · static-analysis-linting.md · ai-guardrails-security.md · SOP-010 · SOP-011 · GOVERNANCE


Scope: three access planes ​

PlaneWhoTypical controlsThis guide section
Human (workforce)Developers, SRE, SEC, POSSO, IAM Identity Center, break-glassWorkforce identity
Machine (CI/CD & workloads)Pipelines, ECS tasks, LambdaOIDC, IAM roles, IRSACI/CD & runtime IAM
Application (end users)Customers, internal usersRBAC, ABAC, API scopesApplication RBAC

Secret scanning (detecting keys in Git) lives in Linters & static analysis. This guide covers storage, rotation, access, and permission design.


Workforce identity (SSO → IAM) ​

ApproachProsCons
IAM Identity Center (SSO) + permission setsCentral IdP federation; per-account rolesPermission-set sprawl without governance
Direct IAM usersSimple for tiny teamsNo SSO; keys on laptops; audit nightmare
Cross-account role assumptionClear dev/staging/prod separationTrust policy mistakes = lateral movement
Just-in-time (JIT) elevationReduces standing prod accessExtra tooling (e.g. IAM Identity Center + approval workflow)

Recommended: IAM Identity Center → permission sets mapped to environment accounts (dev / staging / prod). No long-lived access keys for humans.

Environment account pattern ​

Permission set (example)DevStagingProd
DeveloperRead/write app resourcesRead-only + deploy via CI onlyNo direct access
SRE / PlatformFull infra readDeploy + observabilityDeploy + incident break-glass
Security (SEC)Read + GuardDutyRead + scan configsRead + audit; no data plane write
Read-only auditorReadReadRead

Pitfall: Developers with AdministratorAccess in prod "for debugging" — use read-only + temporary elevation with ticket audit.


CI/CD & runtime IAM ​

ApproachProsCons
OIDC federation (GitHub Actions → AWS)No static CI keys; short-lived credsTrust policy + audience tuning
CodePipeline service roleNative AWS; simple in-accountCross-repo patterns harder
Long-lived IAM user for CIFamiliarAvoid — key rotation burden, leak risk
Task/instance roles (ECS, EKS IRSA, Lambda)Least privilege per workloadPolicy per service; needs IaC discipline
ABAC via resource tagsScales multi-team accountsTag hygiene; policy complexity

Recommended: One org standard — OIDC for external CI (GitHub/GitLab) or CodePipeline roles in-account; workloads always use task roles, never instance profiles with broad s3:*.

CI OIDC vs static keys ​

OIDC roleStatic access key in CI secret
Credential lifetimeMinutesUntil rotated (often never)
Blast radius on leakScoped to role + sessionFull key permissions
AI-generated pipeline YAML riskStill dangerous if role is too broadCatastrophic
Setup costOne-time trust + role"Easy" day one

See CI/CD & release for orchestrator choice; this guide owns how CI authenticates.

Runtime permission model ​

WorkloadPatternPitfall
ECS FargateTask execution role + task roleTask role with * on S3/RDS
EKSIRSA per service accountShared namespace SA with admin
LambdaFunction execution roleOne role for all functions
Batch / GlueJob role scoped to job prefixCross-job data access

With AI: Models generate IAM policies with "Action": "*" — enforce OPA/Conftest on IaC (see static-analysis-linting.md) and human review for new permissions.


Application RBAC ​

ApproachProsCons
Amazon Cognito + groups → IAM (API Gateway)AWS-native; JWT at edgeCognito UX limits for complex B2B
Corporate IdP (Okta, Entra) + OIDC/SAML appSingle sign-on for workforce appsApp must map groups → roles
Custom RBAC in app DBFlexible product rolesEasy to get wrong; test coverage critical
ABAC (attributes: tenant, classification, region)Fine-grained multi-tenantPolicy authoring harder
OPA / Cedar at API gatewayCentral policy; auditableLatency + operational overhead
AWS Verified Permissions (Cedar)Managed policy storeCedar learning curve

Recommended starting point:

  • Customer-facing SaaS: IdP or Cognito for auth + explicit RBAC model in ADR (roles, permissions, tenant isolation).
  • Internal tools: Corporate SSO + group-to-role mapping.
  • Service-to-service: mTLS or SigV4 with scoped IAM roles — not shared API keys.

RBAC design checklist (record in ADR) ​

ElementExamplePitfall
Rolesadmin, editor, viewerRole explosion (50+ roles)
Permissionsinvoice:read, invoice:writeCoarse admin only
ScopeOrg / tenant / resourceMissing tenant boundary → data leak
Default denyNew users = no accessDefault allow in generated code
AuditWho granted role changeNo log on privilege escalation

With AI: Generated auth middleware often skips authorization while implementing authentication — require contract tests for forbidden paths per role.


Secret management lifecycle ​

Where secrets live ​

StoreBest forProsCons
Secrets ManagerDB passwords, API keys, rotationAutomatic rotation hooksCost per secret
SSM Parameter Store (SecureString)Config + non-rotating secretsCheaper; KMS-backedRotation manual unless scripted
KMS envelope encryptionApp-level secret blobsStrong auditApp must call KMS
Git / .env in repo——Never (scan + block)
CI variables (masked)Build-time onlySimpleLeak via logs; not for prod DB passwords in app

Recommended: Secrets Manager for rotating credentials; Parameter Store for static config; never plaintext in Git, tickets, or AI prompts (SOP-010).

Lifecycle stages ​

StageControlOwner
CreateNaming convention {env}/{service}/{name}SRE + service owner
ReadIAM secretsmanager:GetSecretValue on resource ARNTask role only
RotateLambda rotation or native RDS rotationSRE
Break-glassSeparate emergency secret; time-bound accessSEC + SRE
Detect leakgitleaks + GuardDuty + SM access anomaliesSEC

Rotation policy (example) ​

Secret typeRotationTrigger
Database password30–90 daysAutomated SM rotation
Third-party API key90 days or vendor policyCalendar + incident
CI OIDCN/A (no long-lived secret)—
KMS CMKAnnual or on compromiseSEC runbook
JWT signing key90 days + overlap windowDual-key verify period

Pitfall: Rotation without dual-active period — app breaks at flip. Always support current + previous key during overlap.


Permission matrix by lifecycle phase ​

Maps GOVERNANCE roles to access types (not every IAM action — adapt in your ADR).

PhaseHuman accessCI / machine accessApplication RBAC
Plan / intakePO, ARCH: backlog tools——
Define (spec, ADR)ARCH, SEC: Git write docs/——
BuildDEV: dev account writeCI: build, scan, push ECR (no prod)Dev/test tenants only
Verify (PR)Reviewers: Git; no prodCI: unit/integration in ephemeral accountTest roles in preview env
ReleaseSRE: approve T1 deployCD: deploy staging → prod via scoped roleStaging sign-off roles
OperateSRE on-call: prod read + runbook actionsWorkloads: task roles onlyProd user roles enforced
IncidentIC: break-glass (logged)Rollback pipeline roleMay disable features via flags
LearnPostmortem: log/metric read——
ActionWho may triggerAWS mechanism
Merge to mainDEV + reviewer + green CIBranch protection
Deploy stagingCI pipeline roledeploy-staging role
Deploy prod T1SRE approval + CIdeploy-prod role + manual gate
Deploy prod T2–3CI after metric gateSame role; no human for routine
IAM policy changeSRE/SEC review + IaC PRSeparate iac-admin role

Cross-cutting controls ​

ControlPurposeOptions
CloudTrailAPI auditOrg trail; log file validation
IAM Access AnalyzerExternal access findingsEnable in all accounts
Permission boundariesCap max permissions for rolesPlatform team owns boundary policy
SCP (Organizations)Deny list at account rootDeny iam:*User*, deny unapproved regions
Session tags (ABAC)Project=, Classification= on sessionPair with data governance Layer 2
Secrets in AIBlock .env, keys in promptsSOP-010

Pitfalls ​

PitfallWhy it hurtsMitigation
Shared prod DB password in SlackInstant breachSM + break-glass only; DLP on chat
One IAM role for all microservicesLateral movementTask role per service
CI admin roleCompromised PR = prod takeoverSplit build vs deploy roles
RBAC only in UI, not APIBOLA/IDOR via direct APIContract tests per role
Secrets in container env at buildImage layer leakFetch at runtime from SM
No offboardingFormer employee accessSSO deprovision + SM version disable (SOP-011)
AI-generated AKIA in samplesReal-looking keys mergedgitleaks + never commit (static-analysis-linting.md)
Permanent AdministratorAccess exceptionPolicy theaterTime-bound SOP-012
Auth without authzLogin works; data leaks across tenantsADR-mandated permission matrix + tests
Ignoring service-linked rolesBlind spots in auditDocument SLR usage in runbooks

  1. IAM Identity Center with dev/staging/prod accounts and permission sets (no human access keys).
  2. OIDC for CI → separate build and deploy roles.
  3. Secrets Manager for DB/API secrets; task roles for runtime fetch.
  4. gitleaks pre-commit + CI (see linters guide).
  5. ADR for application RBAC model before first customer-facing API.
  6. Phase × role matrix above copied into your wiki; align with GOVERNANCE RACI.

Reference template only — no production code. Adapt in your own project.