
# sigil
*每个签名下的版本。*
[](https://securityscorecards.dev/viewer/?uri=github.com/0-draft/sigil)
[](https://github.com/0-draft/sigil/actions/workflows/ci.yml)
[](./LICENSE)
fork 它。push。你的发布版本包含 sigstore 签名,slsa v1.0 证明来源,以及 npm 受信任的发布者。
无需 `NPM_TOKEN`。没有证明的路径不能发布。
## 链
```
flowchart TB
src["1. source
gitsign + signed-commit branch protection"]
deps["2. deps
npm ci --ignore-scripts + lockfile + dependabot"]
bld["3. build
harden-runner + SHA-pinned actions"]
pub["4. publish
npm OIDC --provenance + cosign sign-blob"]
dst["5. distribute
npm registry attestation"]
con["6. consume
verify.sh: audit + cosign + slsa-verifier"]
src --> deps --> bld --> pub --> dst --> con
classDef src fill:#f05032,stroke:#000,color:#fff
classDef deps fill:#cb3837,stroke:#000,color:#fff
classDef bld fill:#fbca04,stroke:#000,color:#000
classDef pub fill:#2ea44f,stroke:#000,color:#fff
classDef dst fill:#7a52d6,stroke:#000,color:#fff
classDef con fill:#326ce5,stroke:#000,color:#fff
class src src
class deps deps
class bld bld
class pub pub
class dst dst
class con con
```
如果有任何链接中断,下一步将拒绝输入。这就是唯一的行为。
## 使用此模板
```
# 1. 在 GitHub 上点击 "使用此模板"
# 2. 克隆您的新仓库
git clone https://github.com/
/.git
cd
# 3. 重命名 + sha-pin 每个操作
./scripts/init.sh
# 4. 本地安装 + 验证
npm ci
npm run check
# 5. 在 npmjs.com 上配置 npm 受信任的发布者
# 设置 -> 包 -> 添加受信任的发布者
# 仓库: /
# 工作流程: .github/workflows/release.yml
# 环境: release
```
`init.sh` 打印 `gh api` 单行命令以应用分支保护。运行它。
## 验证发布(消费者端)
```
./scripts/verify.sh @/@1.0.0
```
三个独立的证明,三个退出代码:
1. `npm audit signatures` — 注册服务端 sigstore 证明
2. `cosign verify-blob` — 通过 OIDC 锚定的工作流程身份
3. `slsa-verifier verify-npm-package` — slsa v1.0 证明来源
任何一个失败 -> 非 0 -> 安装被拒绝。
## 参见
- [chainscope](https://github.com/0-draft/chainscope) 用于概念图
- [docs/github-settings.md](./docs/github-settings.md) 用于一次性 UI 强化
- [docs/branch-protection.md](./docs/branch-protection.md) 用于分支保护 API 调用
- [SECURITY.md](./SECURITY.md) 用于漏洞报告
- [CONTRIBUTING.md](./CONTRIBUTING.md) 对于贡献者规则
- [MIT](./LICENSE)