WEBBOOK CHAPTER

AI가 만든 코드, 공급망까지 안전합니까: 11장 artifact를 tag가 아니라 digest로 식별한다

11장 artifact를 tag가 아니라 digest로 식별한다

app:latestapp:1.2 tag는 다른 image를 가리키도록 바뀔 수 있다. digest는 content hash이므로 같은 bytes는 같은 identity를 가진다.

실습은 artifact.bin의 SHA-256을 계산한다.


const digest = createHash('sha256').update(artifact).digest('hex');

build가 만든 digest를 deployment manifest에 기록하고 promotion 때 다시 build하지 않는다. staging에서 검증한 artifact와 production artifact가 같아야 한다. environment별 설정은 외부 주입하되 executable artifact는 그대로 승격한다.

hash는 누가 만들었는지를 말해 주지 않는다. 공격자가 악성 artifact의 hash를 함께 바꿀 수 있다. 그래서 digest를 신뢰할 수 있는 identity가 서명한 attestation과 연결한다.