Skip to content

Commit db0261b

Browse files
authored
fix: respect projectIgnorePaths from socket.yml in scan create (#1137)
* fix: respect projectIgnorePaths from socket.yml in scan create The scan create command had all the downstream infrastructure to honor projectIgnorePaths from socket.yml but never actually loaded the config. Read socket.yml via findSocketYmlSync and pass the parsed config to getPackageFilesForScan so globWithGitIgnore applies the ignore patterns. * fix: respect projectIgnorePaths from socket.yml in scan reach * v1.1.78 * fix: respect projectIgnorePaths from socket.yml in socket fix * docs: update changelog to include socket fix
1 parent 33c017a commit db0261b

File tree

6 files changed

+33
-2
lines changed

6 files changed

+33
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ 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.78](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.78) - 2026-04-01
8+
9+
### Fixed
10+
- `socket scan create`, `socket scan reach`, and `socket fix` now respect `projectIgnorePaths` from `socket.yml` when collecting files
11+
712
## [1.1.77](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.77) - 2026-04-01
813

914
### Fixed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "socket",
3-
"version": "1.1.77",
3+
"version": "1.1.78",
44
"description": "CLI for Socket.dev",
55
"homepage": "https://github.com/SocketDev/socket-cli",
66
"license": "MIT AND OFL-1.1",

src/commands/fix/coana-fix.mts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
fetchGhsaDetails,
4545
setGitRemoteGithubRepoUrl,
4646
} from '../../utils/github.mts'
47+
import { findSocketYmlSync } from '../../utils/config.mts'
4748
import { getPackageFilesForScan } from '../../utils/path-resolve.mts'
4849
import { setupSdk } from '../../utils/sdk.mts'
4950
import { fetchSupportedScanFileNames } from '../scan/fetch-supported-scan-file-names.mts'
@@ -157,7 +158,15 @@ export async function coanaFix(
157158
}
158159

159160
const supportedFiles = supportedFilesCResult.data
161+
162+
// Load socket.yml to respect projectIgnorePaths when collecting files.
163+
const socketYmlResult = findSocketYmlSync(cwd)
164+
const socketConfig = socketYmlResult.ok
165+
? socketYmlResult.data?.parsed
166+
: undefined
167+
160168
const scanFilepaths = await getPackageFilesForScan(['.'], supportedFiles, {
169+
config: socketConfig,
161170
cwd,
162171
})
163172
// Exclude any .socket.facts.json files that happen to be in the scan

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ async function run(
173173
...generalFlags,
174174
...reachabilityFlags,
175175
},
176-
// TODO: Your project's "socket.yml" file's "projectIgnorePaths".
177176
help: command => `
178177
Usage
179178
$ ${command} [options] [TARGET...]

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { outputCreateNewScan } from './output-create-new-scan.mts'
1414
import { performReachabilityAnalysis } from './perform-reachability-analysis.mts'
1515
import constants from '../../constants.mts'
1616
import { checkCommandInput } from '../../utils/check-input.mts'
17+
import { findSocketYmlSync } from '../../utils/config.mts'
1718
import { getPackageFilesForScan } from '../../utils/path-resolve.mts'
1819
import { readOrDefaultSocketJson } from '../../utils/socket-json.mts'
1920
import { socketDocsLink } from '../../utils/terminal-link.mts'
@@ -164,7 +165,15 @@ export async function handleCreateNewScan({
164165
spinner.start('Searching for local files to include in scan...')
165166

166167
const supportedFiles = supportedFilesCResult.data
168+
169+
// Load socket.yml to respect projectIgnorePaths when collecting files.
170+
const socketYmlResult = findSocketYmlSync(cwd)
171+
const socketConfig = socketYmlResult.ok
172+
? socketYmlResult.data?.parsed
173+
: undefined
174+
167175
const packagePaths = await getPackageFilesForScan(targets, supportedFiles, {
176+
config: socketConfig,
168177
cwd,
169178
})
170179

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { outputScanReach } from './output-scan-reach.mts'
66
import { performReachabilityAnalysis } from './perform-reachability-analysis.mts'
77
import constants from '../../constants.mts'
88
import { checkCommandInput } from '../../utils/check-input.mts'
9+
import { findSocketYmlSync } from '../../utils/config.mts'
910
import { getPackageFilesForScan } from '../../utils/path-resolve.mts'
1011

1112
import type { ReachabilityOptions } from './perform-reachability-analysis.mts'
@@ -47,7 +48,15 @@ export async function handleScanReach({
4748
)
4849

4950
const supportedFiles = supportedFilesCResult.data
51+
52+
// Load socket.yml to respect projectIgnorePaths when collecting files.
53+
const socketYmlResult = findSocketYmlSync(cwd)
54+
const socketConfig = socketYmlResult.ok
55+
? socketYmlResult.data?.parsed
56+
: undefined
57+
5058
const packagePaths = await getPackageFilesForScan(targets, supportedFiles, {
59+
config: socketConfig,
5160
cwd,
5261
})
5362

0 commit comments

Comments
 (0)