Skip to content

Commit 26c03c4

Browse files
fix: sha256sum --ignore-missing silently passes when binary is absent from checksums.txt (#47)
* Initial plan * fix: sha256sum --ignore-missing silently passes when no entry matches binary name Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
1 parent 7fcabe2 commit 26c03c4

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

templates/1es-base.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extends:
6767
6868
echo "Verifying checksum..."
6969
cd "$DOWNLOAD_DIR"
70-
sha256sum -c checksums.txt --ignore-missing
70+
grep "ado-aw-linux-x64" checksums.txt | sha256sum -c -
7171
mv ado-aw-linux-x64 ado-aw
7272
chmod +x ado-aw
7373
displayName: "Download agentic pipeline compiler (v{{ compiler_version }})"
@@ -182,7 +182,7 @@ extends:
182182
183183
echo "Verifying checksum..."
184184
cd "$DOWNLOAD_DIR"
185-
sha256sum -c checksums.txt --ignore-missing
185+
grep "ado-aw-linux-x64" checksums.txt | sha256sum -c -
186186
mv ado-aw-linux-x64 ado-aw
187187
chmod +x ado-aw
188188
displayName: "Download agentic pipeline compiler (v{{ compiler_version }})"
@@ -327,7 +327,7 @@ extends:
327327
328328
echo "Verifying checksum..."
329329
cd "$DOWNLOAD_DIR"
330-
sha256sum -c checksums.txt --ignore-missing
330+
grep "ado-aw-linux-x64" checksums.txt | sha256sum -c -
331331
mv ado-aw-linux-x64 ado-aw
332332
chmod +x ado-aw
333333
displayName: "Download agentic pipeline compiler (v{{ compiler_version }})"

templates/base.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
6666
echo "Verifying checksum..."
6767
cd "$DOWNLOAD_DIR"
68-
sha256sum -c checksums.txt --ignore-missing
68+
grep "ado-aw-linux-x64" checksums.txt | sha256sum -c -
6969
mv ado-aw-linux-x64 ado-aw
7070
chmod +x ado-aw
7171
displayName: "Download agentic pipeline compiler (v{{ compiler_version }})"
@@ -185,7 +185,7 @@ jobs:
185185
186186
echo "Verifying checksum..."
187187
cd "$DOWNLOAD_DIR"
188-
sha256sum -c checksums.txt --ignore-missing
188+
grep "awf-linux-x64" checksums.txt | sha256sum -c -
189189
mv awf-linux-x64 awf
190190
chmod +x awf
191191
echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf"
@@ -325,7 +325,7 @@ jobs:
325325
326326
echo "Verifying checksum..."
327327
cd "$DOWNLOAD_DIR"
328-
sha256sum -c checksums.txt --ignore-missing
328+
grep "ado-aw-linux-x64" checksums.txt | sha256sum -c -
329329
mv ado-aw-linux-x64 ado-aw
330330
chmod +x ado-aw
331331
displayName: "Download agentic pipeline compiler (v{{ compiler_version }})"
@@ -346,7 +346,7 @@ jobs:
346346
347347
echo "Verifying checksum..."
348348
cd "$DOWNLOAD_DIR"
349-
sha256sum -c checksums.txt --ignore-missing
349+
grep "awf-linux-x64" checksums.txt | sha256sum -c -
350350
mv awf-linux-x64 awf
351351
chmod +x awf
352352
echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf"
@@ -523,7 +523,7 @@ jobs:
523523
524524
echo "Verifying checksum..."
525525
cd "$DOWNLOAD_DIR"
526-
sha256sum -c checksums.txt --ignore-missing
526+
grep "ado-aw-linux-x64" checksums.txt | sha256sum -c -
527527
mv ado-aw-linux-x64 ado-aw
528528
chmod +x ado-aw
529529
displayName: "Download agentic pipeline compiler (v{{ compiler_version }})"

tests/compiler_tests.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,12 @@ fn test_compiled_yaml_structure() {
145145
"Template should download the compiler from GitHub Releases"
146146
);
147147
assert!(
148-
template_content.contains("sha256sum -c checksums.txt --ignore-missing"),
149-
"Template should verify checksum using checksums.txt"
148+
!template_content.contains("sha256sum -c checksums.txt --ignore-missing"),
149+
"Template should not use --ignore-missing which silently passes when binary is missing from checksums"
150+
);
151+
assert!(
152+
template_content.contains(r#"grep "ado-aw-linux-x64" checksums.txt | sha256sum -c -"#),
153+
"Template should verify ado-aw checksum using targeted grep to ensure binary entry exists"
150154
);
151155
assert!(
152156
!template_content.contains("grep -q"),

0 commit comments

Comments
 (0)