Skip to content

Commit b2ea6aa

Browse files
jfblaaclaude
andauthored
fix(scan): upload the analyzed facts files next to the reachability report (#1653)
A --reach scan uploaded Coana's report in place of every facts file. depscan drops the report's components without public metadata, so private libraries and build modules went missing from the stored SBOM and their dependencies lost their parent. Upload the facts files Coana analyzed, minus earlier reports, as --reach-use-only-pregenerated-sboms already does. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 876048d commit b2ea6aa

3 files changed

Lines changed: 23 additions & 21 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1111

1212
### Fixed
1313
- With `--dynamic-sbom-inference`, an sbt build that fails before writing its results is reported as failed instead of reusing another build's results.
14+
- `socket scan create --reach` keeps the private libraries and build modules of Socket facts files in the stored SBOM, with their dependencies under them.
1415

1516
## [1.10.0](https://github.com/SocketDev/socket-cli/releases/tag/v1.10.0) - 2026-10-22
1617

‎src/commands/scan/handle-create-new-scan.mts‎

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { checkCommandInput } from '../../utils/check-input.mts'
2020
import {
2121
compressSocketFactsForUpload,
2222
isReachabilityReportPath,
23-
isSocketFactsFile,
2423
snapshotSocketFacts,
2524
} from '../../utils/coana.mts'
2625
import { findSocketYmlSync } from '../../utils/config.mts'
@@ -360,25 +359,22 @@ async function createNewScan(
360359

361360
reachabilityReport = reachResult.data?.reachabilityReport
362361

363-
// Mirror the SBOM inputs Coana analyzed; otherwise its fresh report
364-
// (appended below) supersedes every facts file.
365-
const pathsForScan = reach.reachUseOnlyPregeneratedSboms
366-
? filterToPregeneratedSboms(packagePaths, supportedFiles).filter(
367-
p =>
368-
!isReachabilityReportPath(p, {
369-
cwd,
370-
outputPath: constants.DOT_SOCKET_DOT_FACTS_JSON,
371-
}),
372-
)
373-
: packagePaths.filter(p => !isSocketFactsFile(p))
374-
375-
// Append coana's reachability report, but not twice: a pre-generated facts
376-
// input can resolve to the same path coana wrote its report to.
377-
const reportPath = reachabilityReport
378-
? path.resolve(cwd, reachabilityReport)
379-
: undefined
362+
// Upload Coana's inputs next to its report: depscan drops the report's
363+
// components without public metadata, such as private libraries.
364+
const pathsForScan = (
365+
reach.reachUseOnlyPregeneratedSboms
366+
? filterToPregeneratedSboms(packagePaths, supportedFiles)
367+
: packagePaths
368+
).filter(
369+
p =>
370+
!isReachabilityReportPath(p, {
371+
cwd,
372+
outputPath: constants.DOT_SOCKET_DOT_FACTS_JSON,
373+
}),
374+
)
375+
380376
scanPaths = [
381-
...pathsForScan.filter(p => path.resolve(cwd, p) !== reportPath),
377+
...pathsForScan,
382378
...(reachabilityReport ? [reachabilityReport] : []),
383379
]
384380

‎src/commands/scan/handle-create-new-scan.test.mts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ describe('handleCreateNewScan excludePaths', () => {
263263
expect(cleanup).toHaveBeenCalledOnce()
264264
})
265265

266-
it('replaces every facts file input with the reachability report', async () => {
266+
it('keeps build facts but not earlier reports next to the reachability report', async () => {
267267
const cleanup = vi.fn()
268268
const files = [
269269
'/repo/pom.xml.socket.facts.json',
@@ -284,7 +284,12 @@ describe('handleCreateNewScan excludePaths', () => {
284284
})
285285
await handleCreateNewScan(config)
286286
expect(mockFetchCreateOrgFullScan).toHaveBeenCalledWith(
287-
['/repo/package-lock.json', '.socket.facts.json'],
287+
[
288+
'/repo/pom.xml.socket.facts.json',
289+
'/repo/gradle.socket.facts.json',
290+
'/repo/package-lock.json',
291+
'.socket.facts.json',
292+
],
288293
'fakeOrg',
289294
expect.anything(),
290295
expect.anything(),

0 commit comments

Comments
 (0)