实现示例type Image = { registry: string; repo: string; tag: string; digest?: string }

type Policy = { allowRegistries: Set<string>; 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

}

审计与运行治理准入策略审计来源域与摘要固定;异常阻断并输出修复建议。策略变更需审批与归档。

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部