9장. Secret 없는 cloud 인증에 OIDC를 쓴다
장기 cloud access key를 CI secret에 저장하기보다 workload identity와 짧은 수명의 OIDC federation을 사용한다. GitHub 공식 OIDC reference는 workflow가 ID token을 요청할 때 id-token: write permission이 필요하다고 설명한다. 이 권한은 cloud 권한 자체가 아니라 token 요청 권한이며, cloud trust policy가 issuer·audience·subject를 제한해야 한다.
permissions:
contents: read
id-token: write
repository, branch/tag, environment, reusable workflow claim을 trust condition에 묶는다. wildcard subject로 조직 전체 production role을 열지 않는다. pull request의 untrusted code가 identity job에 도달하지 않는지 event별로 시험한다.
온프레미스에서도 Vault, SPIFFE/SPIRE, cloud workload identity 등 짧은 자격 증명을 검토한다. 불가피한 secret은 최소 scope, environment 제한, masking, rotation, 사용 감사와 폐기 절차를 가진다.