**实现示例**
```ts
type Image = { registry: string; repo: string; tag: string; digest?: string }
type Policy = { allowRegistries: Set; requireDigest: boolean }
function validImage(i: Image, p: Policy): boolean {
const okReg = p.allowRegistries.has(i.registry)
const hasDig = p.requireDigest ? !!i.digest && /^[A-Fa-f0-9]{64}$/.test(i.digest) : true
return okReg && hasDig && !!i.repo && !!i.tag
}
```
**审计与运行治理**
- 准入策略审计来源域与摘要固定;异常阻断并输出修复建议。
- 策略变更需审批与归档。
镜像准入控制
通过准入控制器实现镜像签名验证与白名单校验,防止未授权镜像运行。
- cosign / notation 签名集成
- 白名单与正则匹配策略

发表评论 取消回复