Skip to content

Commit ca8e845

Browse files
authored
Fail on cargo audit error (#6411)
# Motivation `release-sop` assumes that `cargo audit --json` will either * succeed and not output any issues, or * fail and output issues But `cargo audit` has been failing without outputting anything on stdout, and the following error on stderr: ``` error: not found: Couldn't load Cargo.lock: I/O operation failed: parse error: parse error: invalid Cargo.lock format version: `4` ``` This went unnoticed because the `release-sop` script assumed success because there was no output on stdout. # Changes 1. Only assume there are no vulnerabilities if `cargo audit` succeeds. # Tests 1. Manually ran the command on an old commit without issues, on an old commit with issues and on a new commit with the above error. # Todos - [ ] Add entry to changelog (if necessary). not necessary
1 parent 907c517 commit ca8e845

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

scripts/nns-dapp/release-sop

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,8 @@ npm_audit() {
305305
}
306306

307307
cargo_audit() {
308-
local output
309-
output="$(cargo audit --json | jq -r '[.vulnerabilities.list[] | .advisory.id] | sort | join(",")' || true)"
310-
311-
if [ -z "$output" ]; then
308+
if cargo audit --json | jq -r '[.vulnerabilities.list[] | .advisory.id] | sort | join(",")'; then
312309
echo "no vulnerabilities"
313-
else
314-
echo "$output"
315310
fi
316311
}
317312

0 commit comments

Comments
 (0)