Skip to content

Commit bd1d761

Browse files
committed
feat(scan): unit suffixes for reachability timeout/memory limits (1.1.123, Coana 15.5.0)
--reach-analysis-timeout and --reach-analysis-memory-limit now accept unit suffixes (s/m/h for duration, MB/GB for memory, case-insensitive). Coana owns the canonical parsing, so the CLI forwards the raw string verbatim instead of coercing to a number. A thin local validator gives fast errors before the Coana binary is spawned. Empty or zero-magnitude values are omitted when forwarding so Coana applies its own defaults, preserving the prior numeric-0 sentinel. Bare numbers keep working but are no longer documented. Bumps the bundled Coana CLI to 15.5.0, whose parser handles these units.
1 parent c78c6c6 commit bd1d761

17 files changed

Lines changed: 280 additions & 77 deletions

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

7+
## [1.1.123](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.123) - 2026-06-18
8+
9+
### Added
10+
- `socket scan create --reach` and `socket scan reach` now accept unit suffixes on `--reach-analysis-timeout` (`s`, `m`, `h` — e.g. `90s`, `10m`, `1h`) and `--reach-analysis-memory-limit` (`MB`, `GB` — e.g. `512MB`, `8GB`). Plain numbers keep working as before.
11+
12+
### Changed
13+
- Updated the Coana CLI to v `15.5.0`.
14+
715
## [1.1.122](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.122) - 2026-06-17
816

917
### Changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "socket",
3-
"version": "1.1.122",
3+
"version": "1.1.123",
44
"description": "CLI for Socket.dev",
55
"homepage": "https://github.com/SocketDev/socket-cli",
66
"license": "MIT",
@@ -96,7 +96,7 @@
9696
"@babel/preset-typescript": "7.27.1",
9797
"@babel/runtime": "7.28.4",
9898
"@biomejs/biome": "2.2.4",
99-
"@coana-tech/cli": "15.4.6",
99+
"@coana-tech/cli": "15.5.0",
100100
"@cyclonedx/cdxgen": "12.1.2",
101101
"@dotenvx/dotenvx": "1.49.0",
102102
"@eslint/compat": "1.3.2",

pnpm-lock.yaml

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

src/commands/ci/handle-ci.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export async function handleCi(autoManifest: boolean): Promise<void> {
5252
pullRequest: 0,
5353
reach: {
5454
excludePaths: [],
55-
reachAnalysisMemoryLimit: 0,
56-
reachAnalysisTimeout: 0,
55+
reachAnalysisMemoryLimit: '',
56+
reachAnalysisTimeout: '',
5757
reachConcurrency: 1,
5858
reachContinueOnAnalysisErrors: false,
5959
reachContinueOnInstallErrors: false,

src/commands/scan/cmd-scan-create.mts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import { assertValidExcludePaths } from './exclude-paths.mts'
88
import { handleCreateNewScan } from './handle-create-new-scan.mts'
99
import { outputCreateNewScan } from './output-create-new-scan.mts'
1010
import { excludePathsFlag, reachabilityFlags } from './reachability-flags.mts'
11+
import {
12+
REACH_ANALYSIS_MEMORY_LIMIT_HELP,
13+
REACH_ANALYSIS_TIMEOUT_HELP,
14+
isValidReachAnalysisMemoryLimit,
15+
isValidReachAnalysisTimeout,
16+
} from './reachability-units.mts'
1117
import { suggestOrgSlug } from './suggest-org-slug.mts'
1218
import { suggestTarget } from './suggest_target.mts'
1319
import { validateReachabilityTarget } from './validate-reachability-target.mts'
@@ -284,8 +290,8 @@ async function run(
284290
tmp: boolean
285291
// Reachability flags.
286292
reach: boolean
287-
reachAnalysisMemoryLimit: number
288-
reachAnalysisTimeout: number
293+
reachAnalysisMemoryLimit: string
294+
reachAnalysisTimeout: string
289295
reachConcurrency: number
290296
reachContinueOnAnalysisErrors: boolean
291297
reachContinueOnInstallErrors: boolean
@@ -572,6 +578,18 @@ async function run(
572578
message: 'Reachability analysis flags require --reach to be enabled',
573579
fail: 'add --reach flag to use --reach-* options',
574580
},
581+
{
582+
nook: true,
583+
test: !reach || isValidReachAnalysisTimeout(reachAnalysisTimeout),
584+
message: `The --reach-analysis-timeout must be ${REACH_ANALYSIS_TIMEOUT_HELP}`,
585+
fail: `invalid value "${reachAnalysisTimeout}"`,
586+
},
587+
{
588+
nook: true,
589+
test: !reach || isValidReachAnalysisMemoryLimit(reachAnalysisMemoryLimit),
590+
message: `The --reach-analysis-memory-limit must be ${REACH_ANALYSIS_MEMORY_LIMIT_HELP}`,
591+
fail: `invalid value "${reachAnalysisMemoryLimit}"`,
592+
},
575593
{
576594
nook: true,
577595
test: !reach || reachTargetValidation.isValid,
@@ -633,8 +651,8 @@ async function run(
633651
})
634652
: undefined,
635653
excludePaths,
636-
reachAnalysisMemoryLimit: Number(reachAnalysisMemoryLimit),
637-
reachAnalysisTimeout: Number(reachAnalysisTimeout),
654+
reachAnalysisMemoryLimit,
655+
reachAnalysisTimeout,
638656
reachConcurrency: Number(reachConcurrency),
639657
reachContinueOnAnalysisErrors: Boolean(reachContinueOnAnalysisErrors),
640658
reachContinueOnInstallErrors: Boolean(reachContinueOnInstallErrors),

src/commands/scan/cmd-scan-create.test.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ describe('socket scan create', async () => {
5656
--workspace The workspace in the Socket Organization that the repository is in to associate with the full scan.
5757
5858
Reachability Options (when --reach is used)
59-
--reach-analysis-memory-limit The maximum memory in MB to use for the reachability analysis. The default is 8192MB.
60-
--reach-analysis-timeout Set timeout for the reachability analysis. Split analysis runs may cause the total scan time to exceed this timeout significantly.
59+
--reach-analysis-memory-limit The maximum memory for the reachability analysis as a whole number optionally followed by MB or GB (e.g. 512MB, 8GB). The default is 8GB.
60+
--reach-analysis-timeout Set the timeout for the reachability analysis as a whole number optionally followed by s, m or h (e.g. 90s, 10m, 1h). Defaults to 10m. Split analysis runs may cause the total scan time to exceed this timeout significantly.
6161
--reach-concurrency Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available.
6262
--reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed (Tier 2) results. By default, the CLI halts on analysis errors.
6363
--reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed (Tier 2) results. By default, the CLI halts on installation errors.

src/commands/scan/cmd-scan-reach.mts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import { logger } from '@socketsecurity/registry/lib/logger'
66
import { assertValidExcludePaths } from './exclude-paths.mts'
77
import { handleScanReach } from './handle-scan-reach.mts'
88
import { excludePathsFlag, reachabilityFlags } from './reachability-flags.mts'
9+
import {
10+
REACH_ANALYSIS_MEMORY_LIMIT_HELP,
11+
REACH_ANALYSIS_TIMEOUT_HELP,
12+
isValidReachAnalysisMemoryLimit,
13+
isValidReachAnalysisTimeout,
14+
} from './reachability-units.mts'
915
import { suggestTarget } from './suggest_target.mts'
1016
import { validateReachabilityTarget } from './validate-reachability-target.mts'
1117
import constants from '../../constants.mts'
@@ -147,8 +153,8 @@ async function run(
147153
markdown: boolean
148154
org: string
149155
output: string
150-
reachAnalysisMemoryLimit: number
151-
reachAnalysisTimeout: number
156+
reachAnalysisMemoryLimit: string
157+
reachAnalysisTimeout: string
152158
reachConcurrency: number
153159
reachContinueOnAnalysisErrors: boolean
154160
reachContinueOnInstallErrors: boolean
@@ -259,6 +265,18 @@ async function run(
259265
message: 'Target directory must be inside the current working directory',
260266
fail: 'provide a path inside the working directory',
261267
},
268+
{
269+
nook: true,
270+
test: isValidReachAnalysisTimeout(reachAnalysisTimeout),
271+
message: `The --reach-analysis-timeout must be ${REACH_ANALYSIS_TIMEOUT_HELP}`,
272+
fail: `invalid value "${reachAnalysisTimeout}"`,
273+
},
274+
{
275+
nook: true,
276+
test: isValidReachAnalysisMemoryLimit(reachAnalysisMemoryLimit),
277+
message: `The --reach-analysis-memory-limit must be ${REACH_ANALYSIS_MEMORY_LIMIT_HELP}`,
278+
fail: `invalid value "${reachAnalysisMemoryLimit}"`,
279+
},
262280
)
263281
if (!wasValidInput) {
264282
return
@@ -277,8 +295,8 @@ async function run(
277295
outputPath: outputPath || '',
278296
reachabilityOptions: {
279297
excludePaths,
280-
reachAnalysisMemoryLimit: Number(reachAnalysisMemoryLimit),
281-
reachAnalysisTimeout: Number(reachAnalysisTimeout),
298+
reachAnalysisMemoryLimit,
299+
reachAnalysisTimeout,
282300
reachConcurrency: Number(reachConcurrency),
283301
reachContinueOnAnalysisErrors: Boolean(reachContinueOnAnalysisErrors),
284302
reachContinueOnInstallErrors: Boolean(reachContinueOnInstallErrors),

src/commands/scan/cmd-scan-reach.test.mts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ describe('socket scan reach', async () => {
3838
3939
Reachability Options
4040
--exclude-paths List of glob patterns to exclude from the scan, including SCA/SBOM manifest discovery and (when --reach is enabled) Tier 1 reachability analysis. Patterns are anchored micromatch globs matched relative to the Socket scan root, which is the command working directory (\`--cwd\` if set), not the reachability target: \`tests\` matches only \`<cwd>/tests\`; use \`**/tests\` to match at any depth. Negation patterns (\`!path\`) are not supported. Accepts a comma-separated value or multiple flags.
41-
--reach-analysis-memory-limit The maximum memory in MB to use for the reachability analysis. The default is 8192MB.
42-
--reach-analysis-timeout Set timeout for the reachability analysis. Split analysis runs may cause the total scan time to exceed this timeout significantly.
41+
--reach-analysis-memory-limit The maximum memory for the reachability analysis as a whole number optionally followed by MB or GB (e.g. 512MB, 8GB). The default is 8GB.
42+
--reach-analysis-timeout Set the timeout for the reachability analysis as a whole number optionally followed by s, m or h (e.g. 90s, 10m, 1h). Defaults to 10m. Split analysis runs may cause the total scan time to exceed this timeout significantly.
4343
--reach-concurrency Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available.
4444
--reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed (Tier 2) results. By default, the CLI halts on analysis errors.
4545
--reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed (Tier 2) results. By default, the CLI halts on installation errors.
@@ -1054,8 +1054,10 @@ describe('socket scan reach', async () => {
10541054
async cmd => {
10551055
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd)
10561056
const output = stdout + stderr
1057-
expect(output).toContain('[DryRun]: Bailing now')
1058-
expect(code).toBe(0)
1057+
expect(output).toContain(
1058+
'The --reach-analysis-memory-limit must be a whole number optionally followed by MB or GB',
1059+
)
1060+
expect(code).not.toBe(0)
10591061
},
10601062
)
10611063

@@ -1065,18 +1067,20 @@ describe('socket scan reach', async () => {
10651067
'reach',
10661068
FLAG_DRY_RUN,
10671069
'--reach-analysis-memory-limit',
1068-
'-1',
1070+
'512kb',
10691071
'--org',
10701072
'fakeOrg',
10711073
FLAG_CONFIG,
10721074
'{"apiToken":"fake-token"}',
10731075
],
1074-
'should show clear error for negative memory limit',
1076+
'should show clear error for unsupported memory unit',
10751077
async cmd => {
10761078
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd)
10771079
const output = stdout + stderr
1078-
expect(output).toContain('[DryRun]: Bailing now')
1079-
expect(code).toBe(0)
1080+
expect(output).toContain(
1081+
'The --reach-analysis-memory-limit must be a whole number optionally followed by MB or GB',
1082+
)
1083+
expect(code).not.toBe(0)
10801084
},
10811085
)
10821086

@@ -1096,8 +1100,10 @@ describe('socket scan reach', async () => {
10961100
async cmd => {
10971101
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd)
10981102
const output = stdout + stderr
1099-
expect(output).toContain('[DryRun]: Bailing now')
1100-
expect(code).toBe(0)
1103+
expect(output).toContain(
1104+
'The --reach-analysis-timeout must be a whole number optionally followed by s, m or h',
1105+
)
1106+
expect(code).not.toBe(0)
11011107
},
11021108
)
11031109

@@ -1107,13 +1113,13 @@ describe('socket scan reach', async () => {
11071113
'reach',
11081114
FLAG_DRY_RUN,
11091115
'--reach-analysis-timeout',
1110-
'0',
1116+
'10m',
11111117
'--org',
11121118
'fakeOrg',
11131119
FLAG_CONFIG,
11141120
'{"apiToken":"fake-token"}',
11151121
],
1116-
'should show clear error for zero timeout',
1122+
'should accept a timeout value with a unit suffix',
11171123
async cmd => {
11181124
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd)
11191125
const output = stdout + stderr

src/commands/scan/create-scan-from-github.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ async function scanOneRepo(
251251
pullRequest: 0,
252252
reach: {
253253
excludePaths: [],
254-
reachAnalysisMemoryLimit: 0,
255-
reachAnalysisTimeout: 0,
254+
reachAnalysisMemoryLimit: '',
255+
reachAnalysisTimeout: '',
256256
reachConcurrency: 1,
257257
reachContinueOnAnalysisErrors: false,
258258
reachContinueOnInstallErrors: false,

src/commands/scan/exclude-paths.test.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ function makeReachOptions(
1515
): ReachabilityOptions {
1616
return {
1717
excludePaths: [],
18-
reachAnalysisMemoryLimit: 8192,
19-
reachAnalysisTimeout: 0,
18+
reachAnalysisMemoryLimit: '8192',
19+
reachAnalysisTimeout: '',
2020
reachConcurrency: 1,
2121
reachContinueOnAnalysisErrors: false,
2222
reachContinueOnInstallErrors: false,

0 commit comments

Comments
 (0)