Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## [Unreleased]

### Changed
- Updated the Coana CLI to v `15.9.7`.
- Updated the Coana CLI to v `15.9.9`.
- `socket scan view` now reads completed scans from Socket's cached immutable results, retrying briefly while a fresh scan finalizes; `--stream` keeps streaming live results.
- `socket fix` vulnerability discovery now reads Coana's structured `--output-file` JSON result instead of parsing stdout, and warns when the Socket backend resolved 0 artifacts so an incomplete server-side resolve is surfaced instead of silently reporting "Finished!".

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"@babel/preset-typescript": "7.27.1",
"@babel/runtime": "7.28.4",
"@biomejs/biome": "2.2.4",
"@coana-tech/cli": "15.9.7",
"@coana-tech/cli": "15.9.9",
"@cyclonedx/cdxgen": "12.1.2",
"@dotenvx/dotenvx": "1.49.0",
"@eslint/compat": "1.3.2",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/commands/ci/handle-ci.mts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export async function handleCi(autoManifest: boolean): Promise<void> {
pendingHead: true,
pullRequest: 0,
reach: {
dynamicSbomInference: false,
excludePaths: [],
reachAnalysisMemoryLimit: '',
reachAnalysisTimeout: '',
Expand Down
4 changes: 2 additions & 2 deletions src/commands/manifest/scripts/assemble.mts
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ function buildArtifactPaths(
}
coords.add(coordKey)
const pi = projectsByGav.get(gav(c.group, c.name, c.version ?? ''))
const sources = (pi?.sources ?? []).filter(fileExists)
const targets = [...new Set([...fn.targets, ...(pi?.targets ?? [])])]
const sources = (pi?.sources ?? []).filter(fileExists).sort()
const targets = [...new Set(pi ? pi.targets : fn.targets)]
.filter(fileExists)
.sort()
if (sources.length) {
Expand Down
9 changes: 9 additions & 0 deletions src/commands/scan/cmd-scan-create.mts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ async function run(
committers,
cwd: cwdOverride,
defaultBranch,
dynamicSbomInference,
interactive = true,
json,
markdown,
Expand Down Expand Up @@ -275,6 +276,7 @@ async function run(
committers: string
cwd: string
defaultBranch: boolean
dynamicSbomInference: boolean
interactive: boolean
json: boolean
markdown: boolean
Expand Down Expand Up @@ -353,6 +355,11 @@ async function run(
autoManifest = false
}
}
// --dynamic-sbom-inference requires auto-manifest to generate the
// per-workspace facts it feeds to Coana.
if (dynamicSbomInference) {
autoManifest = true
}
if (!branchName) {
if (sockJson.defaults?.scan?.create?.branch) {
branchName = sockJson.defaults.scan.create.branch
Expand Down Expand Up @@ -505,6 +512,7 @@ async function run(
reachVersion !== reachabilityFlags['reachVersion']?.default

const isUsingAnyReachabilityFlags =
dynamicSbomInference ||
hasReachEcosystems ||
hasReachExcludePaths ||
isUsingNonDefaultAnalytics ||
Expand Down Expand Up @@ -625,6 +633,7 @@ async function run(
pendingHead: Boolean(pendingHead),
pullRequest: Number(pullRequest),
reach: {
dynamicSbomInference: Boolean(dynamicSbomInference),
excludePaths,
reachAnalysisMemoryLimit,
reachAnalysisTimeout,
Expand Down
3 changes: 3 additions & 0 deletions src/commands/scan/cmd-scan-reach.mts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ async function run(
outputKind,
outputPath: outputPath || '',
reachabilityOptions: {
// Not exposed here: it relies on --auto-manifest generating per-workspace
// Socket facts first, which `socket scan reach` never runs.
dynamicSbomInference: false,
excludePaths,
reachAnalysisMemoryLimit,
reachAnalysisTimeout,
Expand Down
1 change: 1 addition & 0 deletions src/commands/scan/create-scan-from-github.mts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ async function scanOneRepo(
pendingHead: true,
pullRequest: 0,
reach: {
dynamicSbomInference: false,
excludePaths: [],
reachAnalysisMemoryLimit: '',
reachAnalysisTimeout: '',
Expand Down
1 change: 1 addition & 0 deletions src/commands/scan/exclude-paths.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function makeReachOptions(
overrides: Partial<ReachabilityOptions> = {},
): ReachabilityOptions {
return {
dynamicSbomInference: false,
excludePaths: [],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down
6 changes: 6 additions & 0 deletions src/commands/scan/handle-create-new-scan.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function createConfig(
pendingHead: false,
pullRequest: 0,
reach: {
dynamicSbomInference: false,
excludePaths: [],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -198,6 +199,7 @@ describe('handleCreateNewScan excludePaths', () => {
pendingHead: false,
pullRequest: 0,
reach: {
dynamicSbomInference: false,
excludePaths: ['tests', 'packages/*'],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -261,6 +263,7 @@ describe('handleCreateNewScan excludePaths', () => {
pendingHead: false,
pullRequest: 0,
reach: {
dynamicSbomInference: false,
excludePaths: ['apps/api/tests', '**/dist'],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -330,6 +333,7 @@ describe('handleCreateNewScan excludePaths', () => {
pendingHead: false,
pullRequest: 0,
reach: {
dynamicSbomInference: false,
excludePaths: ['tests'],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -389,6 +393,7 @@ describe('handleCreateNewScan excludePaths', () => {
pendingHead: false,
pullRequest: 0,
reach: {
dynamicSbomInference: false,
excludePaths: ['apps/api'],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -448,6 +453,7 @@ describe('handleCreateNewScan excludePaths', () => {
pendingHead: false,
pullRequest: 0,
reach: {
dynamicSbomInference: false,
excludePaths: ['tests'],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down
7 changes: 7 additions & 0 deletions src/commands/scan/handle-scan-reach.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ describe('handleScanReach', () => {

it('applies excludePaths to manifest discovery and reachability analysis', async () => {
const reachabilityOptions = {
dynamicSbomInference: false,
excludePaths: ['tests', 'packages/*'],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -156,6 +157,7 @@ describe('handleScanReach', () => {

it('translates excludePaths from the scan root for nested targets', async () => {
const reachabilityOptions = {
dynamicSbomInference: false,
excludePaths: ['apps/api/tests', '**/dist'],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -218,6 +220,7 @@ describe('handleScanReach', () => {
checks.every(check => check.test),
)
const reachabilityOptions = {
dynamicSbomInference: false,
excludePaths: ['apps/api'],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -266,6 +269,7 @@ describe('handleScanReach', () => {
mockFindSocketYmlSync.mockReturnValueOnce({ ok: false })

const reachabilityOptions = {
dynamicSbomInference: false,
excludePaths: ['tests'],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -318,6 +322,7 @@ describe('handleScanReach', () => {
},
})
const reachabilityOptions = {
dynamicSbomInference: false,
excludePaths: [],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -355,6 +360,7 @@ describe('handleScanReach', () => {

it('does not call finalize when Coana did not return a full application reachability scan id', async () => {
const reachabilityOptions = {
dynamicSbomInference: false,
excludePaths: [],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down Expand Up @@ -405,6 +411,7 @@ describe('handleScanReach', () => {
cause: 'Socket API server error (503)',
})
const reachabilityOptions = {
dynamicSbomInference: false,
excludePaths: [],
reachAnalysisMemoryLimit: '8192',
reachAnalysisTimeout: '',
Expand Down
4 changes: 4 additions & 0 deletions src/commands/scan/perform-reachability-analysis.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type { Spinner } from '@socketsecurity/registry/lib/spinner'
import type { StdioOptions } from 'node:child_process'

export type ReachabilityOptions = {
dynamicSbomInference: boolean
excludePaths: string[]
reachAnalysisMemoryLimit: string
reachAnalysisTimeout: string
Expand Down Expand Up @@ -251,6 +252,9 @@ export async function performReachabilityAnalysis(
...(reachabilityOptions.reachExcludePaths.length
? ['--exclude-dirs', ...reachabilityOptions.reachExcludePaths]
: []),
...(reachabilityOptions.dynamicSbomInference
? ['--maven-use-only-root-socket-facts']
: []),
...(reachabilityOptions.reachLazyMode ? ['--lazy-mode'] : []),
...(reachabilityOptions.reachSkipCache ? ['--skip-cache-usage'] : []),
...(reachabilityOptions.reachUseOnlyPregeneratedSboms
Expand Down
1 change: 1 addition & 0 deletions src/commands/scan/perform-reachability-analysis.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ vi.mock('@socketsecurity/registry/lib/logger', () => ({

function makeReachabilityOptions(): ReachabilityOptions {
return {
dynamicSbomInference: false,
excludePaths: [],
reachAnalysisMemoryLimit: '',
reachAnalysisTimeout: '',
Expand Down
7 changes: 7 additions & 0 deletions src/commands/scan/reachability-flags.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { getReachabilityEcosystemChoices } from '../../utils/ecosystem.mts'
import type { MeowFlags } from '../../flags.mts'

export const reachabilityFlags: MeowFlags = {
dynamicSbomInference: {
type: 'boolean',
default: false,
hidden: true,
description:
'Internal: enables dynamic SBOM inference for full application reachability analysis. Passes --maven-use-only-root-socket-facts to Coana and implies --auto-manifest.',
},
reachVersion: {
type: 'string',
description: `Override the version of @coana-tech/cli used for reachability analysis. Default: ${constants.ENV.INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION}.`,
Expand Down