Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Changed
- Updated the Coana CLI to v `15.15.7`.

### Fixed
- With `--reach-disable-dependency-downloads`, `--dynamic-sbom-inference` scans no longer let Gradle, Maven, sbt or .NET download dependencies while generating Socket facts.

## [1.17.1](https://github.com/SocketDev/socket-cli/releases/tag/v1.17.1) - 2026-11-26

### Changed
Expand Down
6 changes: 6 additions & 0 deletions src/commands/manifest/run-manifest-facts.mts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ type SocketFactsPurpose = 'upload' | 'fix' | 'reachability'
export type SocketFactsContext = {
// The Coana that reads `workDir` must be the one that wrote it.
coanaVersion?: string | undefined
// Resolve from the build tools' own caches only, as the reachability run
// that reads the facts analyses only what is installed.
disableDependencyDownloads?: boolean | undefined
orgSlug?: string | undefined
workDir?: SocketFactsWorkDir | undefined
}
Expand Down Expand Up @@ -197,6 +200,9 @@ async function runGenerateSocketFacts<T>(
'--output-file',
resultFile,
...flags,
...(context.disableDependencyDownloads
? ['--disable-dependency-downloads']
: []),
],
context.orgSlug,
{
Expand Down
30 changes: 30 additions & 0 deletions src/commands/manifest/run-manifest-facts.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,36 @@ describe('listBuildProjects', () => {
})
})

it.each([true, false])(
'lists and generates with --disable-dependency-downloads only when its context disables downloads (%s)',
async disableDependencyDownloads => {
coanaAnswers({ projects: [], status: 'listed' })
await listBuildProjects({
...listArgs,
context: { disableDependencyDownloads },
cwd,
})
coanaAnswers({
factsPath: '/r/f',
projects: [],
status: 'generated',
targetPath: '/r/f',
})
await runManifestFacts({
...baseArgs,
context: { disableDependencyDownloads },
cwd,
staged: true,
})
for (const { args } of calls) {
expect(args.includes('--disable-dependency-downloads')).toBe(
disableDependencyDownloads,
)
}
expect(calls).toHaveLength(2)
},
)

it('lists with the Coana version and org of its context', async () => {
coanaAnswers({ projects: [], status: 'listed' })
await listBuildProjects({
Expand Down
2 changes: 2 additions & 0 deletions src/commands/scan/handle-create-new-scan.mts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ async function createNewScan(
await withTmpDir('socket-auto-manifest-', async manifestTmpDir => {
const factsContext: SocketFactsContext = {
coanaVersion: reach.reachVersion,
disableDependencyDownloads:
reach.runReachabilityAnalysis && reach.reachDisableDependencyDownloads,
orgSlug,
workDir: reach.runReachabilityAnalysis
? await createSocketFactsWorkDir(
Expand Down
31 changes: 31 additions & 0 deletions src/commands/scan/handle-create-new-scan.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,37 @@ describe('handleCreateNewScan excludePaths', () => {
)
})

it.each([
{ runReachabilityAnalysis: true, expected: true },
{ runReachabilityAnalysis: false, expected: false },
])(
'generates facts without downloads when a reachability scan disables them (reachability: $runReachabilityAnalysis)',
async ({ expected, runReachabilityAnalysis }) => {
mockGenerateRecursiveManifests.mockResolvedValueOnce([
{
dir: '/repo/service-a',
ecosystem: 'maven',
factsPath: '/repo/service-a/.socket.facts.json',
status: 'generated',
},
])
const config = createConfig({ autoManifest: false, targets: ['/repo'] })
config.reach.dynamicSbomInference = ['maven']
config.reach.runReachabilityAnalysis = runReachabilityAnalysis
config.reach.reachDisableDependencyDownloads = true

await handleCreateNewScan(config)

expect(mockGenerateRecursiveManifests).toHaveBeenCalledWith(
expect.objectContaining({
context: expect.objectContaining({
disableDependencyDownloads: expected,
}),
}),
)
},
)

it('aborts before scan creation when auto-manifest generation fails', async () => {
mockGenerateAutoManifest.mockRejectedValueOnce(
new Error('Bazel auto-manifest generation failed'),
Expand Down
Loading