Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 依赖有没有安全公告(RustSec)。配置在仓库根目录的 deny.toml。
#
# 插件跑在 Wasmtime 的沙箱里,沙箱的安全就是 Wasmtime 的安全,而它几乎每个
# 大版本都有公告。别的依赖(rustls、hyper……)同理。
#
# **两条触发,各管一件事。**
# - 改了依赖的 PR、推到 main:这次引入或升级的 crate 有没有公告。只在依赖
# 文件变了的时候跑 —— 否则一条新公告发布出来,所有不相干的 PR 一起红,
# 而和自己的改动无关的红,看几次就没人看了。
# - 每天定时:依赖没动,公告库却在长。新公告落在已有的依赖上,在这里红,
# 失败的通知照常发。
name: Audit

on:
pull_request:
paths:
- "**/Cargo.toml"
- "Cargo.lock"
- "deny.toml"
- ".github/workflows/audit.yml"
push:
branches: [main]
paths:
- "**/Cargo.toml"
- "Cargo.lock"
- "deny.toml"
- ".github/workflows/audit.yml"
schedule:
- cron: "0 2 * * *"
workflow_dispatch:

jobs:
advisories:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# 只查公告。许可证、重复版本这几项是另一回事,不在这里
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check advisories
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ The toolchain is `stable`, so a newer stable than your local one can
surface lints you cannot reproduce — `rustup update stable` before
blaming CI.

A change to a `Cargo.toml` or to `Cargo.lock` also runs the Audit
workflow: `cargo deny check advisories`, configured in `deny.toml`, fails
on any RustSec advisory against a crate in the lock file. It runs daily
on `main` as well, so an advisory published against a dependency that is
already shipped turns up without anyone touching the dependencies.

`scripts/smoke.sh` runs the real binary against a real socket and a real
data plane, talking to the control plane through `twcore call` (every
control connection starts with a Noise handshake, so curl cannot). **It catches what unit tests structurally cannot** — file
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 依赖的安全公告(RustSec)。只用 cargo-deny 的 advisories 一项:
# `.github/workflows/audit.yml` 跑 `cargo deny check advisories`。
#
# 插件沙箱(Wasmtime)是这棵依赖树里最要紧的一环:沙箱的安全就是它的
# 安全,而它几乎每个大版本都有安全公告。

[graph]
# 带上所有 feature:tw-api 的 `ts` 之类默认不开的依赖也要查到
all-features = true

[advisories]
version = 2
# 漏洞类公告一律报错,不能整类关掉。确认不受影响的单条才写进这里,
# 写明理由和复查的时间
ignore = []
# 「无人维护」只看我们直接依赖的 crate。传递依赖里的那些我们换不掉,
# 每出一条就红一次只会让人学会忽略这一项
unmaintained = "workspace"
Loading