Repository navigation
237 lines (209 loc) · 9.14 KB
/
Copy pathcode.yml
File metadata and controls
237 lines (209 loc) · 9.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
name: Code verification
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: code-verification-${{ github.ref }}
cancel-in-progress: true
jobs:
verify:
name: Verus, Rust, and TCB
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
CARGO_BUILD_JOBS: 1
RUST_TEST_THREADS: 1
EVIDENCE_ROOT: target/crucible/evidence/${{ github.run_id }}-${{ github.run_attempt }}
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Record initial resources
run: |
df -h .
free -h
ps -eo pid,pcpu,pmem,rss,comm --sort=-rss | head -20
- name: Install pinned Rust toolchain
run: rustup toolchain install 1.97.1-x86_64-unknown-linux-gnu --profile minimal --component clippy --component rustfmt
- name: Install Linux isolation tools
shell: bash
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install --yes bubblewrap
if [[ -e /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]]; then
echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns >/dev/null
fi
- name: Install digest-checked Verus toolchain
shell: bash
run: |
set -euo pipefail
tool_root="$RUNNER_TEMP/crucible-tools"
mkdir -p "$tool_root/verus" "$tool_root/verusfmt"
curl --fail --location --retry 3 \
--output "$RUNNER_TEMP/verus.zip" \
https://github.com/verus-lang/verus/releases/download/release/0.2026.08.09.92f466f/verus-0.2026.08.09.92f466f-x86-linux.zip
printf '%s %s\n' \
2f5a41c553f424aacdd732339e9d125563716a0b003c27730f75d6f81a282cef \
"$RUNNER_TEMP/verus.zip" | sha256sum --check --strict
unzip -q "$RUNNER_TEMP/verus.zip" -d "$tool_root/verus"
curl --fail --location --retry 3 \
--output "$RUNNER_TEMP/verusfmt.tar.xz" \
https://github.com/verus-lang/verusfmt/releases/download/v0.7.2/verusfmt-x86_64-unknown-linux-gnu.tar.xz
printf '%s %s\n' \
c5e0a8e07337055b2469d2878ddcc589da1f4be91348bb1917ce122ea46d4015 \
"$RUNNER_TEMP/verusfmt.tar.xz" | sha256sum --check --strict
tar -xJf "$RUNNER_TEMP/verusfmt.tar.xz" -C "$tool_root/verusfmt" --strip-components=1
printf '%s\n' "$tool_root/verus/verus-x86-linux" >> "$GITHUB_PATH"
printf '%s\n' "$tool_root/verusfmt" >> "$GITHUB_PATH"
- name: Verify formatting through pinned project interface
run: cargo xtask format --check
- name: Reproduce all Verus proofs
run: cargo xtask verify --all
- name: Seal cold proof evidence
if: always()
shell: bash
run: |
set -euo pipefail
report_dir=target/crucible/reports
proof_dir="$EVIDENCE_ROOT/proof"
mkdir -p "$proof_dir"
cp "$report_dir/verification.json" "$proof_dir/verification.json"
cp "$report_dir/verification.stdout.log" "$proof_dir/verification.stdout.log"
cp "$report_dir/verification.stderr.log" "$proof_dir/verification.stderr.log"
cp tools/verus-toolchain.lock "$proof_dir/verus-toolchain.lock"
source_tree=$(git rev-parse 'HEAD^{tree}')
tool_lock_sha256=$(sha256sum tools/verus-toolchain.lock | cut -d ' ' -f1)
verification_json_sha256=$(sha256sum "$proof_dir/verification.json" | cut -d ' ' -f1)
verification_stdout_sha256=$(sha256sum "$proof_dir/verification.stdout.log" | cut -d ' ' -f1)
verification_stderr_sha256=$(sha256sum "$proof_dir/verification.stderr.log" | cut -d ' ' -f1)
jq --null-input \
--arg run_id "$GITHUB_RUN_ID" \
--arg run_attempt "$GITHUB_RUN_ATTEMPT" \
--arg head_sha "$GITHUB_SHA" \
--arg source_tree "$source_tree" \
--arg tool_lock_sha256 "$tool_lock_sha256" \
--arg verification_json_sha256 "$verification_json_sha256" \
--arg verification_stdout_sha256 "$verification_stdout_sha256" \
--arg verification_stderr_sha256 "$verification_stderr_sha256" \
'{
schema: "crucible.proof-evidence.v1",
run_id: $run_id,
run_attempt: $run_attempt,
head_sha: $head_sha,
source_tree: $source_tree,
tool_lock: {
path: "tools/verus-toolchain.lock",
sealed_copy: "verus-toolchain.lock",
sha256: $tool_lock_sha256
},
proof: {
scope: "workspace --locked --all-targets",
verification_json_sha256: $verification_json_sha256,
stdout_sha256: $verification_stdout_sha256,
stderr_sha256: $verification_stderr_sha256
}
}' > "$proof_dir/manifest.json"
(
cd "$proof_dir"
sha256sum \
manifest.json \
verification.json \
verification.stdout.log \
verification.stderr.log \
verus-toolchain.lock > SHA256SUMS
)
chmod -R a-w "$proof_dir"
- name: Enforce trusted-boundary ledger and approved baseline
run: cargo xtask tcb-audit --deny-unregistered --deny-unapproved-growth
- name: Demonstrate rejection of an unregistered boundary
shell: bash
run: |
set -euo pipefail
fixture=crates/crucible-xtask/tcb-known-defect/unregistered.rs
mkdir -p "$(dirname "$fixture")"
trap 'rm -f "$fixture"' EXIT
printf '%s\n' \
'use vstd::prelude::*;' \
'verus! {' \
'#[verifier::external_body]' \
'fn intentionally_unregistered() {}' \
'}' > "$fixture"
if cargo xtask tcb-audit --deny-unregistered --deny-unapproved-growth; then
echo 'strict TCB audit accepted the known-defect fixture' >&2
exit 1
fi
rm -f "$fixture"
trap - EXIT
cargo xtask tcb-audit --deny-unregistered --deny-unapproved-growth
- name: Enforce Rust formatting and lints
run: |
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
- name: Rediscover the regression corpus
run: cargo test -p crucible-cli --test harness_selftest -- --test-threads=1
- name: Run the bounded short fuzz campaign
run: cargo test -p crucible-cli --test build_fuzz_cli -- --test-threads=1
- name: Run core property tests
run: cargo test -p crucible-core --locked -- --test-threads=1
- name: Run Crucible YAML parser and boundary fixtures
run: cargo test -p crucible-yaml --locked -- --test-threads=1
- name: Run all executable and documentation tests
run: cargo test --all --locked -- --test-threads=1
- name: Validate machine-readable reports
shell: bash
run: |
set -euo pipefail
jq --exit-status '.status == "success" and .unregistered == 0 and .unapproved_growth == 0' target/crucible/reports/tcb-audit.json
proof_dir="$EVIDENCE_ROOT/proof"
source_tree=$(git rev-parse 'HEAD^{tree}')
tool_lock_sha256=$(sha256sum tools/verus-toolchain.lock | cut -d ' ' -f1)
jq --exit-status \
--arg run_id "$GITHUB_RUN_ID" \
--arg run_attempt "$GITHUB_RUN_ATTEMPT" \
--arg head_sha "$GITHUB_SHA" \
--arg source_tree "$source_tree" \
--arg tool_lock_sha256 "$tool_lock_sha256" \
'.schema == "crucible.proof-evidence.v1"
and .run_id == $run_id
and .run_attempt == $run_attempt
and .head_sha == $head_sha
and .source_tree == $source_tree
and .tool_lock.sha256 == $tool_lock_sha256
and .proof.scope == "workspace --locked --all-targets"' \
"$proof_dir/manifest.json"
(
cd "$proof_dir"
sha256sum --check SHA256SUMS
jq --exit-status '.status == "success" and .tool_lock == "tools/verus-toolchain.lock"' verification.json
test -s verification.stdout.log
test -f verification.stderr.log
cmp --silent verus-toolchain.lock "$GITHUB_WORKSPACE/tools/verus-toolchain.lock"
)
tcb_dir="$EVIDENCE_ROOT/tcb"
mkdir -p "$tcb_dir"
cp target/crucible/reports/tcb-audit.json "$tcb_dir/tcb-audit.json"
(
cd "$tcb_dir"
sha256sum tcb-audit.json > SHA256SUMS
sha256sum --check SHA256SUMS
)
chmod -R a-w "$tcb_dir"
- name: Upload proof and trusted-boundary evidence
if: always()
uses: actions/upload-artifact@v7
with:
name: proof-and-tcb-reports
path: target/crucible/evidence/
if-no-files-found: error
- name: Record final resources
if: always()
run: |
du -sh target || true
df -h .
free -h
ps -eo pid,pcpu,pmem,rss,comm --sort=-rss | head -20