Skip to content

Commit bb6b4c8

Browse files
authored
chore(tools): add checksum for socket-basics archive (#1222)
Adds a SHA-256 checksum for the socket-basics source archive in bundle-tools.json and wires it through to the downloader so the download now gets verified like every other bundled tool. Previously: - socket-basics was the only bundled tool without a checksum in bundle-tools.json, so the download was trusted as-is. Now: - `bundle-tools.json` has `checksums["socket-basics-v2.0.2.tar.gz"]`. - `downloads.mts` passes `sha256: archiveSha256` to the same `httpDownload(...)` helper the other tools already use, and throws if the checksum entry is missing. Note: the archive key uses the tag-qualified filename (`socket-basics-v<ver>.tar.gz`) to match the existing local-path convention (`socket-basics-${version}.tar.gz`) and stay consistent with the asset-keyed checksums elsewhere in the file.
1 parent 5e24716 commit bb6b4c8

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

packages/cli/bundle-tools.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@
4747
"repository": "github:SocketDev/socket-basics",
4848
"release": "archive",
4949
"version": "v2.0.2",
50-
"packageManager": "pip"
50+
"packageManager": "pip",
51+
"checksums": {
52+
"socket-basics-v2.0.2.tar.gz": "ba175171f07ac927eb926387e526283320630e80da42da000ec6894a55adeb13"
53+
}
5154
},
5255
"socketsecurity": {
5356
"description": "Socket Python CLI (socket-python-cli)",

packages/cli/scripts/sea-build-utils/downloads.mts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,17 @@ export async function downloadExternalTools(platform, arch, isMusl = false) {
538538
const releaseVersion = socketBasicsConfig.version
539539
const version = releaseVersion.replace(/^v/, '') // Remove 'v' prefix for version
540540

541+
// Checksum key matches the local filename convention used for
542+
// archive-style releases (`socket-basics-v<ver>.tar.gz`).
543+
const archiveKey = `socket-basics-${releaseVersion}.tar.gz`
544+
const archiveSha256 = socketBasicsConfig.checksums?.[archiveKey]
545+
if (!archiveSha256) {
546+
throw new Error(
547+
`Missing SHA-256 checksum for socket-basics archive: ${archiveKey}. ` +
548+
'Please update bundle-tools.json with the correct checksum.',
549+
)
550+
}
551+
541552
logger.log(` Installing socket_basics ${version} from GitHub...`)
542553

543554
// Download source tarball from GitHub.
@@ -551,6 +562,7 @@ export async function downloadExternalTools(platform, arch, isMusl = false) {
551562
progressInterval: 10,
552563
retries: 2,
553564
retryDelay: 5_000,
565+
sha256: archiveSha256,
554566
})
555567

556568
// Install from tarball using pip (handles building and dependencies).

0 commit comments

Comments
 (0)