Skip to content

Commit 8ce043d

Browse files
committed
chore(deps): update @socketsecurity/lib to 5.11.1
1 parent 27cbc1c commit 8ce043d

File tree

12 files changed

+159
-26
lines changed

12 files changed

+159
-26
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "socket-cli-monorepo",
33
"version": "0.0.0",
4-
"packageManager": "pnpm@10.32.1",
4+
"packageManager": "pnpm@10.33.0",
55
"private": true,
66
"engines": {
77
"pnpm": ">=10.22.0"

packages/cli/external-tools.json

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,31 @@
1717
"description": "OpenGrep SAST/code analysis engine (fork of Semgrep)",
1818
"type": "github-release",
1919
"repository": "opengrep/opengrep",
20-
"githubRelease": "v1.16.0"
20+
"githubRelease": "v1.16.0",
21+
"checksums": {
22+
"opengrep-core_linux_aarch64.tar.gz": "e6a92e2c465b53284ae326d20b315acbd2eb99bc9ea4b3af48db6379306f3a82",
23+
"opengrep-core_linux_x86.tar.gz": "4d474141329983c4ddd7a6cd586759deecc7f3fa9aee6e6eeab8c55759dc816b",
24+
"opengrep-core_osx_aarch64.tar.gz": "b3d6ff863449014844391ee6b8740683524787da5ab0797f98faa32714e558e9",
25+
"opengrep-core_osx_x86.tar.gz": "2b9f380b5840596ec57f6ead508af7be7bfcac4dbcfe5414dfe495d5f7277887",
26+
"opengrep-core_windows_x86.zip": "d7cae83d95fea6b945a373b800839505bf27770771388514fe17e0f2437e8f71"
27+
}
2128
},
2229
"python": {
2330
"description": "Python runtime from python-build-standalone",
2431
"type": "github-release",
2532
"repository": "astral-sh/python-build-standalone",
2633
"githubRelease": "3.11.14",
27-
"buildTag": "20260203"
34+
"buildTag": "20260203",
35+
"checksums": {
36+
"cpython-3.11.14+20260203-aarch64-apple-darwin-install_only.tar.gz": "63e3352fefd3b6494f73f46f51c6581c57a7e0d98775e6e00229d14a67ec3ce9",
37+
"cpython-3.11.14+20260203-aarch64-pc-windows-msvc-install_only.tar.gz": "cb7828c131a005da367f7dba3a561bed91619452de870e531ee03344b2ac346f",
38+
"cpython-3.11.14+20260203-aarch64-unknown-linux-gnu-install_only.tar.gz": "7341a5a0acd65f2c7c7a228d8bafa6561d220ffed26293d6a02c15ae2ee86af5",
39+
"cpython-3.11.14+20260203-aarch64-unknown-linux-musl-install_only.tar.gz": "f0e5988c108187b12eb4d53cbac33a499a8e38e1693104432e1faabbab14c664",
40+
"cpython-3.11.14+20260203-x86_64-apple-darwin-install_only.tar.gz": "f3b63051a9b1ffb4f663d928ebaec4311435cb67f3bdfa5634953df93397f25e",
41+
"cpython-3.11.14+20260203-x86_64-pc-windows-msvc-install_only.tar.gz": "d220beff465bdc97bf5874be8ffbf07278e5bdf9a064cab932b5d93b542e3e86",
42+
"cpython-3.11.14+20260203-x86_64-unknown-linux-gnu-install_only.tar.gz": "67abde21b6e074b58c0f738f0c4802b23827a7d49707dcaf3ed4dadf572f3f37",
43+
"cpython-3.11.14+20260203-x86_64-unknown-linux-musl-install_only.tar.gz": "290de5199a9647d4de4adcf13a79a7c59f060357853bf41fd6d1a69b4b5fd00c"
44+
}
2845
},
2946
"socket-basics": {
3047
"description": "Socket Basics - integrated SAST, secret scanning, and container analysis",
@@ -42,15 +59,32 @@
4259
"description": "Socket Patch CLI for applying security patches (Rust binary)",
4360
"type": "github-release",
4461
"repository": "SocketDev/socket-patch",
45-
"githubRelease": "v2.0.0"
62+
"githubRelease": "v2.0.0",
63+
"checksums": {
64+
"socket-patch-aarch64-apple-darwin.tar.gz": "dd8f778aef4db3f2c5000cd870101a31d1bb03822158d76e5bd2e773098428f0",
65+
"socket-patch-aarch64-pc-windows-msvc.zip": "5c0bbfc12d2b6f30a0f79caf4bff85a1eac6baf9541c46d9af4b3f37b05bd574",
66+
"socket-patch-aarch64-unknown-linux-gnu.tar.gz": "baf84c0ec84aa5355ae9d0225ae9199f618014a10af7414947132d326c10cdd5",
67+
"socket-patch-x86_64-apple-darwin.tar.gz": "73db4c70f1810d98f7f81adf94d0068e2d9378dfd8660811fb541751abe0078d",
68+
"socket-patch-x86_64-pc-windows-msvc.zip": "3b980a74621f084ff92126e4e6284f2f742e57e66cf6727e6e010257377017e8",
69+
"socket-patch-x86_64-unknown-linux-musl.tar.gz": "00e7b659c82e863857dc6b1d9721a2719a4a77f981488484e35e998359dc91b0"
70+
}
4671
},
4772
"sfw": {
4873
"description": "Socket Firewall (sfw) - GitHub binary for SEA, npm package for CLI",
4974
"type": "github-release",
5075
"repository": "SocketDev/sfw-free",
5176
"githubRelease": "v1.6.1",
5277
"npmPackage": "sfw",
53-
"npmVersion": "2.0.4"
78+
"npmVersion": "2.0.4",
79+
"checksums": {
80+
"sfw-free-linux-arm64": "df2eedb2daf2572eee047adb8bfd81c9069edcb200fc7d3710fca98ec3ca81a1",
81+
"sfw-free-linux-x86_64": "4a1e8b65e90fce7d5fd066cf0af6c93d512065fa4222a475c8d959a6bc14b9ff",
82+
"sfw-free-macos-arm64": "bf1616fc44ac49f1cb2067fedfa127a3ae65d6ec6d634efbb3098cfa355e5555",
83+
"sfw-free-macos-x86_64": "724ccea19d847b79db8cc8e38f5f18ce2dd32336007f42b11bed7d2e5f4a2566",
84+
"sfw-free-musl-linux-arm64": "41e5ebfe84e33eb7f34846eeb1b0e0c3039b2ba8bcdb87f4a75a5ccb89c64ae1",
85+
"sfw-free-musl-linux-x86_64": "19f26c163311d5d0b184d305304972d26c52e445659c9142cefc7d8a11e06c3a",
86+
"sfw-free-windows-x86_64.exe": "c953e62ad7928d4d8f2302f5737884ea1a757babc26bed6a42b9b6b68a5d54af"
87+
}
5488
},
5589
"synp": {
5690
"description": "Tool for converting between yarn.lock and package-lock.json",
@@ -62,12 +96,27 @@
6296
"description": "Trivy container and filesystem vulnerability scanner",
6397
"type": "github-release",
6498
"repository": "aquasecurity/trivy",
65-
"githubRelease": "v0.69.2"
99+
"githubRelease": "v0.69.2",
100+
"checksums": {
101+
"trivy_0.69.2_Linux-64bit.tar.gz": "affa59a1e37d86e4b8ab2cd02f0ab2e63d22f1bf9cf6a7aa326c884e25e26ce3",
102+
"trivy_0.69.2_Linux-ARM64.tar.gz": "c73b97699c317b0d25532b3f188564b4e29d13d5472ce6f8eb078082546a6481",
103+
"trivy_0.69.2_macOS-64bit.tar.gz": "41f6eac3ebe3a00448a16f08038b55ce769fe2d5128cb0d64bdf282cdad4831a",
104+
"trivy_0.69.2_macOS-ARM64.tar.gz": "320c0e6af90b5733b9326da0834240e944c6f44091e50019abdf584237ff4d0c",
105+
"trivy_0.69.2_windows-64bit.zip": "d772fa7c3c1bc52d2914ff78107596fbd20010b5f18bec6f39d63ee3bb31ad45"
106+
}
66107
},
67108
"trufflehog": {
68109
"description": "TruffleHog secret and credential detection",
69110
"type": "github-release",
70111
"repository": "trufflesecurity/trufflehog",
71-
"githubRelease": "v3.93.1"
112+
"githubRelease": "v3.93.1",
113+
"checksums": {
114+
"trufflehog_3.93.1_darwin_amd64.tar.gz": "f1f4ecbda3996b88dc70cf6aef2c469c4902efb591aca86128d6305d606d8e07",
115+
"trufflehog_3.93.1_darwin_arm64.tar.gz": "d65a2ad0f043a9d48a97176f28533890e558817e2fb7dd1e34132653b61be4a0",
116+
"trufflehog_3.93.1_linux_amd64.tar.gz": "2edf991c20fd8e6d2ec5f255b928289156bc1f0640618829c580c6e87e28ff57",
117+
"trufflehog_3.93.1_linux_arm64.tar.gz": "6424e63e0397f7e1b63b880bed6657f76025783738b45868210b445aa5a27b5f",
118+
"trufflehog_3.93.1_windows_amd64.tar.gz": "2add5bcfd2f9b9fd5db721f7d47921e02b3f093838d24551f7cf8d6d66bc023e",
119+
"trufflehog_3.93.1_windows_arm64.tar.gz": "f2d53334a8f6c0c871db1e53defb9ce591a13e1f84d35cb9ca7865255f4fd4ae"
120+
}
72121
}
73122
}

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@
7878
"@octokit/graphql": "catalog:",
7979
"@octokit/request-error": "catalog:",
8080
"@octokit/rest": "catalog:",
81+
"@socketaddon/iocraft": "file:../package-builder/build/dev/out/socketaddon-iocraft",
8182
"@socketregistry/hyrious__bun.lockb": "catalog:",
8283
"@socketregistry/indent-string": "catalog:",
8384
"@socketregistry/is-interactive": "catalog:",
8485
"@socketregistry/packageurl-js": "catalog:",
85-
"@socketaddon/iocraft": "file:../package-builder/build/dev/out/socketaddon-iocraft",
8686
"@socketregistry/yocto-spinner": "catalog:",
8787
"@socketsecurity/config": "catalog:",
8888
"@socketsecurity/lib": "catalog:",
@@ -95,7 +95,6 @@
9595
"brace-expansion": "catalog:",
9696
"browserslist": "catalog:",
9797
"build-infra": "workspace:*",
98-
"package-builder": "workspace:*",
9998
"chalk-table": "catalog:",
10099
"cmd-shim": "catalog:",
101100
"compromise": "catalog:",
@@ -112,6 +111,7 @@
112111
"nanotar": "catalog:",
113112
"npm-package-arg": "catalog:",
114113
"open": "catalog:",
114+
"package-builder": "workspace:*",
115115
"pony-cause": "catalog:",
116116
"registry-auth-token": "catalog:",
117117
"registry-url": "catalog:",

packages/cli/scripts/environment-variables.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ export class EnvironmentVariables {
108108
publishedBuild ? '' : ':dev'
109109
}`
110110

111+
// Get checksums for tools that have them.
112+
const pythonChecksums = externalTools.python?.checksums || {}
113+
const socketPatchChecksums = externalTools['socket-patch']?.checksums || {}
114+
111115
// Return all environment variables with raw values.
112116
return {
113117
INLINED_SOCKET_CLI_CDXGEN_VERSION: cdxgenVersion,
@@ -119,10 +123,12 @@ export class EnvironmentVariables {
119123
INLINED_SOCKET_CLI_PUBLISHED_BUILD: publishedBuild ? '1' : '',
120124
INLINED_SOCKET_CLI_PYCLI_VERSION: pyCliVersion,
121125
INLINED_SOCKET_CLI_PYTHON_BUILD_TAG: pythonBuildTag,
126+
INLINED_SOCKET_CLI_PYTHON_CHECKSUMS: JSON.stringify(pythonChecksums),
122127
INLINED_SOCKET_CLI_PYTHON_VERSION: pythonVersion,
123128
INLINED_SOCKET_CLI_SENTRY_BUILD: sentryBuild ? '1' : '',
124129
INLINED_SOCKET_CLI_SFW_NPM_VERSION: sfwNpmVersion,
125130
INLINED_SOCKET_CLI_SFW_VERSION: sfwVersion,
131+
INLINED_SOCKET_CLI_SOCKET_PATCH_CHECKSUMS: JSON.stringify(socketPatchChecksums),
126132
INLINED_SOCKET_CLI_SOCKET_PATCH_VERSION: socketPatchVersion,
127133
INLINED_SOCKET_CLI_SYNP_VERSION: synpVersion,
128134
INLINED_SOCKET_CLI_TRIVY_VERSION: trivyVersion,

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,17 @@ export async function downloadExternalTools(platform, arch, isMusl = false) {
326326
// Release tags can be any format (v1.6.1, 3.11.14, 20260203, etc.).
327327
const tag = config.version
328328
const url = `https://github.com/${config.owner}/${config.repo}/releases/download/${tag}/${assetName}`
329+
330+
// Get SHA256 checksum if available in external-tools.json.
331+
const toolConfig = externalTools[toolName]
332+
const sha256 = toolConfig?.checksums?.[assetName]
333+
329334
await httpDownload(url, archivePath, {
330335
logger,
331336
progressInterval: 10,
332337
retries: 2,
333338
retryDelay: 5000,
339+
...(sha256 && { sha256 }),
334340
})
335341

336342
// Extract binary (or handle standalone binaries).
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Python SHA-256 checksums getter function.
3+
* Uses direct process.env access so esbuild define can inline values.
4+
* IMPORTANT: esbuild's define plugin can only replace direct process.env['KEY'] references.
5+
* If we imported from env modules, esbuild couldn't inline the values at build time.
6+
* This is critical for embedding checksums into the binary for integrity verification.
7+
*/
8+
9+
import process from 'node:process'
10+
11+
import type { PythonChecksums } from '../types.mjs'
12+
13+
/**
14+
* Get Python checksums from inlined environment variable.
15+
* Returns a map of asset filename to SHA-256 hex checksum.
16+
*/
17+
export function getPythonChecksums(): PythonChecksums {
18+
const checksums = process.env['INLINED_SOCKET_CLI_PYTHON_CHECKSUMS']
19+
if (!checksums) {
20+
return {}
21+
}
22+
try {
23+
return JSON.parse(checksums) as PythonChecksums
24+
} catch {
25+
return {}
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Socket Patch SHA-256 checksums getter function.
3+
* Uses direct process.env access so esbuild define can inline values.
4+
* IMPORTANT: esbuild's define plugin can only replace direct process.env['KEY'] references.
5+
* If we imported from env modules, esbuild couldn't inline the values at build time.
6+
* This is critical for embedding checksums into the binary for integrity verification.
7+
*/
8+
9+
import process from 'node:process'
10+
11+
import type { SocketPatchChecksums } from '../types.mjs'
12+
13+
/**
14+
* Get Socket Patch checksums from inlined environment variable.
15+
* Returns a map of asset filename to SHA-256 hex checksum.
16+
*/
17+
export function getSocketPatchChecksums(): SocketPatchChecksums {
18+
const checksums = process.env['INLINED_SOCKET_CLI_SOCKET_PATCH_CHECKSUMS']
19+
if (!checksums) {
20+
return {}
21+
}
22+
try {
23+
return JSON.parse(checksums) as SocketPatchChecksums
24+
} catch {
25+
return {}
26+
}
27+
}

packages/cli/src/types.mts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ export type BaseFetchOptions = {
77
sdkOpts?: import('./utils/socket/sdk.mjs').SetupSdkOptions | undefined
88
}
99

10+
// Checksum types for external tool integrity verification.
11+
// Maps asset filename to SHA-256 hex checksum.
12+
export type PythonChecksums = Record<string, string>
13+
export type SocketPatchChecksums = Record<string, string>
14+
1015
// CResult is akin to the "Result" or "Outcome" or "Either" pattern.
1116
// Main difference might be that it's less strict about the error side of
1217
// things, but still assumes a message is returned explaining the error.

packages/cli/src/utils/dlx/resolve-binary.mts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { SOCKET_CLI_PYCLI_LOCAL_PATH } from '../../env/socket-cli-pycli-local-pa
1313
import { SOCKET_CLI_SFW_LOCAL_PATH } from '../../env/socket-cli-sfw-local-path.mts'
1414
import { SOCKET_CLI_SOCKET_PATCH_LOCAL_PATH } from '../../env/socket-cli-socket-patch-local-path.mts'
1515
import { getSfwNpmVersion } from '../../env/sfw-version.mts'
16+
import { getSocketPatchChecksums } from '../../env/socket-patch-checksums.mts'
1617
import { getSocketPatchVersion } from '../../env/socket-patch-version.mts'
1718
import { getSynpVersion } from '../../env/synp-version.mts'
1819

@@ -26,6 +27,11 @@ export type GitHubReleaseSpec = {
2627
binaryName: string
2728
owner: string
2829
repo: string
30+
/**
31+
* Optional SHA-256 hex checksum for integrity verification.
32+
* If provided, downloads will be verified against this checksum.
33+
*/
34+
sha256?: string | undefined
2935
version: string
3036
}
3137

@@ -160,14 +166,19 @@ export function resolveSocketPatch(): BinaryResolution {
160166
)
161167
}
162168

169+
// Get SHA-256 checksum for integrity verification.
170+
const checksums = getSocketPatchChecksums()
171+
const sha256 = checksums[assetName]
172+
163173
return {
164174
type: 'github-release',
165175
details: {
176+
assetName,
177+
binaryName: 'socket-patch',
166178
owner: 'SocketDev',
167179
repo: 'socket-patch',
180+
sha256,
168181
version: getSocketPatchVersion(),
169-
assetName,
170-
binaryName: 'socket-patch',
171182
},
172183
}
173184
}

packages/cli/src/utils/dlx/spawn.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,15 @@ export async function spawnDlx(
158158
* Security:
159159
* - Uses lock files to prevent TOCTOU race conditions during concurrent downloads.
160160
* - Validates zip entries for path traversal attacks before extraction.
161+
* - Verifies SHA-256 checksum if provided in spec.
161162
*
162163
* @param spec - GitHub release specification.
163164
* @returns Path to the downloaded binary.
164165
*/
165166
async function downloadGitHubReleaseBinary(
166167
spec: GitHubReleaseSpec,
167168
): Promise<string> {
168-
const { assetName, binaryName, owner, repo, version } = spec
169+
const { assetName, binaryName, owner, repo, sha256, version } = spec
169170
const isPlatWin = os.platform() === 'win32'
170171
const binaryFileName = binaryName + (isPlatWin ? '.exe' : '')
171172

@@ -237,6 +238,7 @@ async function downloadGitHubReleaseBinary(
237238

238239
const result = await downloadBinary({
239240
name: `${owner}-${repo}-${version}-${assetName}`,
241+
sha256,
240242
url,
241243
})
242244

0 commit comments

Comments
 (0)