Skip to content

Commit ceebd02

Browse files
hyperpolymathclaudecoderabbitai[bot]HoTT-stuff
authored
fix(ci): turn main green: hypatia pin closure + clippy needless_bool + url 2.5.9 (carries #705 and #706 fixes) (#707)
## Why `main` fails three required checks and each fix sat in a different PR, so none could merge. This PR carries all three fixes (owner chose "Fold into #707"). | Fix | Commit | Origin | |---|---|---| | Pinned source closure: re-attest hypatia `credential-read-check.yml` at f2c06048 | 6e64d5a | this PR | | robot-repo-automaton clippy `needless_bool` in `confidence.rs` | 76a2155 | cherry-pick -x from #705 (6ddc6dc) | | GSBot audit: `url` 2.5.9 (RUSTSEC-2026-0592), `bots/gsbot/Cargo.lock` only | 7388520 | cherry-pick -x from #706 (6bfdde7) | Original authorship kept on the cherry-picks. The departures commit from #706 is **not** included; #706 keeps it. ## Closure fix (details) #699 bumped `hypatia-scan.yml` job `scanner-credential` to `hyperpolymath/hypatia/.github/workflows/credential-read-check.yml@f2c06048…` without updating `scripts/lib/pinned-reusable-sources.json`. **Pin only:** the file's blob is `15c597ea720a5affb861dab058084f7245ee4cbd` at both 29a9e4a8 and f2c06048, so the nested `uses:` closure is unchanged. No generator exists; same approach as #698 (manifest binding + receipts row). ## Local evidence - `audit-pinned-reusable-sources.sh --fetch-sources`: findings=0 verified-roots=6 (was 1 finding) - `audit-lock-closure.sh`: fatal=0; pinned-reusable-sources-test 55/0; lock-closure-test 47/0 - `cargo clippy --locked -- -D warnings` in robot-repo-automaton: clean - pinned-source-entrypoints-test: 7 pass, 2 fail locally (historical-source cache that CI fetches, as in #698) ## After merge Owner: close #705 (superseded); update #706's branch from main so it shrinks to the departures ledger. #704 untouched. #706 and #705 are unchanged by this PR. --- _Generated by [Claude Code](https://claude.ai/code)_ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Refactor** * Streamlined protected-file checks without changing which files are protected. * **Chores** * Updated a pinned reusable source reference; its path and other recorded metadata remain unchanged. * **Tests** * Added coverage for confidence classification of protected paths and for detecting stale references after a source is repinned. * No user-facing behavior changes are included in this update. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com>
1 parent f1b14e2 commit ceebd02

6 files changed

Lines changed: 87 additions & 15 deletions

File tree

‎bots/gsbot/Cargo.lock‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎robot-repo-automaton/src/confidence.rs‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,7 @@ fn is_protected_file(target: &str) -> bool {
349349
"spec/",
350350
"verification/",
351351
];
352-
if protected_dirs.iter().any(|dir| target.contains(dir)) {
353-
return true;
354-
}
355-
356-
false
352+
protected_dirs.iter().any(|dir| target.contains(dir))
357353
}
358354

359355
/// Check if a file is a standard repository file (high confidence to create)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// SPDX-License-Identifier: MPL-2.0
2+
//! Regression tests for the confidence guard on protected directories.
3+
4+
use robot_repo_automaton::catalog::{Fix, FixAction, Severity};
5+
use robot_repo_automaton::{ConfidenceLevel, DetectedIssue, ThresholdConfig};
6+
7+
fn deletion_confidence(target: &str) -> ConfidenceLevel {
8+
let issue = DetectedIssue {
9+
error_type_id: "TEST".into(),
10+
error_name: "Obsolete file".into(),
11+
severity: Severity::Medium,
12+
description: "Detected an obsolete file".into(),
13+
affected_files: vec![],
14+
confidence: 1.0,
15+
suggested_fix: "Delete the file".into(),
16+
commit_message: "fix: remove obsolete file".into(),
17+
};
18+
let fix = Fix {
19+
action: FixAction::Delete,
20+
target: target.into(),
21+
reason: None,
22+
modification: None,
23+
fallback: None,
24+
};
25+
ThresholdConfig::default().classify_fix(&issue, &fix)
26+
}
27+
28+
#[test]
29+
fn test_high_confidence_deletes_are_downgraded_in_protected_directories() {
30+
// No protected basename or extension can account for these results.
31+
for target in [
32+
".machine_readable/metadata.json",
33+
"crates/engine/src/abi/exports.rs",
34+
"docs/getting-started.txt",
35+
"packages/engine/spec/grammar.txt",
36+
"verification/run.sh",
37+
] {
38+
assert_eq!(
39+
deletion_confidence(target),
40+
ConfidenceLevel::Low,
41+
"{target}"
42+
);
43+
}
44+
}
45+
46+
#[test]
47+
fn test_high_confidence_deletes_keep_their_rating_for_directory_near_misses() {
48+
for target in [
49+
"src/docs", // A filename, with no trailing directory separator.
50+
"docs-old/notes.txt",
51+
"packages/engine/Spec/grammar.txt", // Directory markers are case sensitive.
52+
"crates/engine/src/abigail/exports.rs",
53+
] {
54+
assert_eq!(
55+
deletion_confidence(target),
56+
ConfidenceLevel::High,
57+
"{target}"
58+
);
59+
}
60+
}

‎scripts/lib/lock-closure-receipts.tsv‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ metadatastician/standards ea2f4d8a886585ed442687ae63d4ad7493379ba4 oven-sh/setup
7676
# Reviewed source: hyperpolymath/proven-cicd-and-workflows/.github/workflows/secret-scanner-reusable.yml@1fd5e6371a50f0fc3687206a5adca0cdf7b39aa6
7777
hyperpolymath/proven-cicd-and-workflows 1fd5e6371a50f0fc3687206a5adca0cdf7b39aa6 actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
7878

79-
# Reviewed source: hyperpolymath/hypatia/.github/workflows/credential-read-check.yml@29a9e4a881b6a3cc4cd27fcbc0886ffbadcbc5fe
80-
hyperpolymath/hypatia 29a9e4a881b6a3cc4cd27fcbc0886ffbadcbc5fe step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a
79+
# Reviewed source: hyperpolymath/hypatia/.github/workflows/credential-read-check.yml@f2c0604880f615bec5edda7aaefc8feac3d04cc5
80+
hyperpolymath/hypatia f2c0604880f615bec5edda7aaefc8feac3d04cc5 step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a

‎scripts/lib/pinned-reusable-sources.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@
731731
},
732732
{
733733
"repository": "hyperpolymath/hypatia",
734-
"commit": "29a9e4a881b6a3cc4cd27fcbc0886ffbadcbc5fe",
734+
"commit": "f2c0604880f615bec5edda7aaefc8feac3d04cc5",
735735
"path": ".github/workflows/credential-read-check.yml",
736736
"blob": "15c597ea720a5affb861dab058084f7245ee4cbd",
737737
"content_sha256": "645e8ac8ff118c33f2dc941ec46f1abac895f7836339736841c269e4b9dc084d",

‎scripts/tests/pinned-reusable-sources-test.sh‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ replace_pin() {
7777
done
7878
}
7979
check() {
80-
local label="$1" expected="$2" rc=0 valid=0
80+
local label="$1" expected="$2" expected_rule="${3:-}" rc=0 valid=0
8181
timeout 15s bash "$HELPER" --json --repo-root "$CASE/repo" --manifest "$MANIFEST" \
8282
--lock "$CASE/repo/.github/workflows/actions.lock" --receipts "$CASE/repo/receipts.tsv" --cache "$CASE/cache" \
8383
> "$CASE/result.json" 2> "$CASE/stderr" || rc=$?
8484
if jq -e 'type=="object" and (.findings|type=="array") and (.not_run|type=="array") and (.verified_roots|type=="array") and (.verified_receipt_sources|type=="array")' "$CASE/result.json" >/dev/null 2>&1; then
8585
case "$expected" in
8686
clean) [[ "$rc" == 0 ]] && jq -e '(.findings|length)==0 and (.not_run|length)==0 and (.verified_roots|length)==1 and (.verified_receipt_sources|length)>0' "$CASE/result.json" >/dev/null && valid=1 ;;
87-
fatal) [[ "$rc" == 1 || "$rc" == 3 ]] && jq -e 'any(.findings[]; .severity=="FATAL" and (.rule|length)>0 and (.detail|length)>0) and (.verified_roots|length)==0 and (.verified_receipt_sources|length)==0' "$CASE/result.json" >/dev/null && valid=1 ;;
87+
fatal) [[ "$rc" == 1 || "$rc" == 3 ]] && jq -e --arg rule "$expected_rule" 'any(.findings[]; .severity=="FATAL" and (.rule|length)>0 and ($rule=="" or .rule==$rule) and (.detail|length)>0) and (.verified_roots|length)==0 and (.verified_receipt_sources|length)==0' "$CASE/result.json" >/dev/null && valid=1 ;;
8888
notrun) [[ "$rc" == 2 ]] && jq -e '(.findings|length)==0 and any(.not_run[]; (.rule|length)>0 and (.detail|length)>0) and (.verified_roots|length)==0 and (.verified_receipt_sources|length)==0' "$CASE/result.json" >/dev/null && valid=1 ;;
8989
*) printf 'Unexpected fixture expectation: %s\n' "$expected" >&2; exit 64 ;;
9090
esac
@@ -115,6 +115,22 @@ fi
115115
[[ -f "$HELPER" ]] || { echo 'Missing helper; this is a prerequisite failure, not a successful rejection control.' >&2; exit 64; }
116116

117117
case_fixture good; check 'authenticated active source and exact receipt' clean
118+
119+
# A pin can move even when the reusable workflow and its direct edges are
120+
# unchanged. The new caller pin still needs both current attestations.
121+
case_fixture same-blob-repin
122+
repin_tree="$(git --git-dir="$CASE/cache/org/reusable.git" rev-parse "$ROOT_SHA^{tree}")"
123+
repin_sha="$(commit_tree "$CASE/cache/org/reusable.git" "$repin_tree" 'Repin unchanged workflow')"
124+
[[ "$repin_sha" != "$ROOT_SHA" ]]
125+
replace_pin "$ROOT_SHA" "$repin_sha"
126+
check 'unchanged workflow authenticates after repinning caller, catalog and receipt' clean
127+
128+
cp "$BASE/repo/receipts.tsv" "$CASE/repo/receipts.tsv"
129+
check 'unchanged workflow cannot use a receipt for the old pin' fatal SOURCE-RECEIPT
130+
replace_pin "$ROOT_SHA" "$repin_sha"
131+
edit_manifest --arg old "$ROOT_SHA" '.sources[0].commit=$old'
132+
check 'unchanged workflow cannot use a catalog binding for the old pin' fatal SOURCE-ACTIVE-MISSING
133+
118134
case_fixture historical; edit_manifest '.sources += [(.sources[0] | .role="retained-review" | .callers=[] | .path=".github/workflows/other.yml")]'; check 'explicit historical review can coexist with active source' clean
119135
case_fixture unrelated-vendor; cat >> "$CASE/repo/.github/workflows/actions.lock" <<YAML
120136
'unrelated/action@v9':
@@ -269,4 +285,4 @@ for variant in main-good main-wrong-blob; do
269285
else FAIL=$((FAIL+1)); printf 'FAIL: %s entrypoint did not enforce source authentication (exit %s)\n' "$variant" "$rc"; cat "$CASE/main.json" "$CASE/main.stderr"; fi
270286
done
271287
printf '\n%d passed, %d failed\n' "$PASS" "$FAIL"
272-
[[ "$FAIL" == 0 ]]
288+
[[ "$FAIL" == 0 ]]

0 commit comments

Comments
 (0)