Skip to content

Commit b8e632c

Browse files
committed
fix(updating): add all-found safety check to SFW checksum fetcher
Like the zizmor update path, prevent partial checksum updates when some SFW asset downloads fail. Return unchanged checksums and changed: false so the caller does not write an inconsistent state.
1 parent 0e3b425 commit b8e632c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

.claude/hooks/setup-security-tools/update.mts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ async function fetchSfwChecksums(
383383

384384
const newChecksums: Record<string, string> = { __proto__: null } as unknown as Record<string, string>
385385
let changed = false
386+
let allFound = true
386387

387388
for (const { 0: platform, 1: assetName } of Object.entries(assetNames)) {
388389
const asset = release.assets.find(a => a.name === assetName)
@@ -401,9 +402,15 @@ async function fetchSfwChecksums(
401402
const msg = e instanceof Error ? e.message : String(e)
402403
logger.warn(` Failed to download ${assetName}: ${msg}`)
403404
newChecksums[platform] = currentChecksums[platform] ?? ''
405+
allFound = false
404406
}
405407
}
406408

409+
if (!allFound) {
410+
logger.warn(` Some ${label} assets could not be downloaded. Skipping update.`)
411+
return { checksums: currentChecksums, changed: false }
412+
}
413+
407414
return { checksums: newChecksums, changed }
408415
}
409416

0 commit comments

Comments
 (0)