@socketsecurity/cli 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [1.4.2](https://github.com/SocketDev/socket-cli/releases/tag/v1.4.2) - 2026-10-05
8
+
9
+ ### Changed
10
+ - Updated the Coana CLI to v `15.11.6`.
11
+
12
+ ## [1.4.1](https://github.com/SocketDev/socket-cli/releases/tag/v1.4.1) - 2026-09-30
13
+
14
+ ### Changed
15
+ - Updated the Coana CLI to v `15.11.5`.
16
+
17
+ ### Fixed
18
+ - `socket fix` pull requests now include every file a fix changes, such as `package.json` override bumps, and work when run from a subdirectory of the repository.
19
+
7
20
  ## [1.4.0](https://github.com/SocketDev/socket-cli/releases/tag/v1.4.0) - 2026-09-29
8
21
 
9
22
  ### Changed
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Socket CLI
2
2
 
3
3
  [![Socket Badge](https://socket.dev/api/badge/npm/package/socket)](https://socket.dev/npm/package/socket)
4
- [![Follow @SocketSecurity](https://raw.githubusercontent.com/SocketDev/socket-cli/v1.4.0/assets/fleet/badge-follow-x.svg)](https://twitter.com/SocketSecurity)
5
- [![Follow @socket.dev on Bluesky](https://raw.githubusercontent.com/SocketDev/socket-cli/v1.4.0/assets/fleet/badge-follow-bluesky.svg)](https://bsky.app/profile/socket.dev)
4
+ [![Follow @SocketSecurity](https://raw.githubusercontent.com/SocketDev/socket-cli/v1.4.2/assets/fleet/badge-follow-x.svg)](https://twitter.com/SocketSecurity)
5
+ [![Follow @socket.dev on Bluesky](https://raw.githubusercontent.com/SocketDev/socket-cli/v1.4.2/assets/fleet/badge-follow-bluesky.svg)](https://bsky.app/profile/socket.dev)
6
6
 
7
7
  CLI for [Socket.dev](https://socket.dev) — scan dependencies, audit packages, apply security patches, and gate installs from your terminal or CI. This is the 1.x line of the published `socket` package on npm.
8
8
 
@@ -171,8 +171,8 @@ MIT
171
171
  <br/>
172
172
  <div align="center">
173
173
  <picture>
174
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/SocketDev/socket-cli/v1.4.0/assets/fleet/socket-combomark-dark.svg">
175
- <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/SocketDev/socket-cli/v1.4.0/assets/fleet/socket-combomark-light.svg">
176
- <img width="324" height="104" alt="Socket" src="https://raw.githubusercontent.com/SocketDev/socket-cli/v1.4.0/assets/fleet/socket-combomark-light.svg">
174
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/SocketDev/socket-cli/v1.4.2/assets/fleet/socket-combomark-dark.svg">
175
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/SocketDev/socket-cli/v1.4.2/assets/fleet/socket-combomark-light.svg">
176
+ <img width="324" height="104" alt="Socket" src="https://raw.githubusercontent.com/SocketDev/socket-cli/v1.4.2/assets/fleet/socket-combomark-light.svg">
177
177
  </picture>
178
178
  </div>
package/dist/cli.js CHANGED
@@ -8973,6 +8973,24 @@ async function discoverGhsaIds(orgSlug, tarHash, options) {
8973
8973
  function isFactsFile(filepath) {
8974
8974
  return path.basename(filepath).toLowerCase() === constants.DOT_SOCKET_DOT_FACTS_JSON;
8975
8975
  }
8976
+ async function gitWorkingTreeChanges(cwd) {
8977
+ const {
8978
+ 0: modifiedCResult,
8979
+ 1: untrackedCResult
8980
+ } = await Promise.all([utils.gitUnstagedModifiedFiles(cwd), utils.gitUntrackedFiles(cwd)]);
8981
+ return {
8982
+ modified: modifiedCResult.ok ? modifiedCResult.data : [],
8983
+ untracked: untrackedCResult.ok ? untrackedCResult.data : []
8984
+ };
8985
+ }
8986
+
8987
+ // Coana's modifiedFiles may under-report; untracked files still need it or a
8988
+ // manifest name, so build output in repos without a .gitignore stays out.
8989
+ function selectFixedFiles(before, after, writtenFiles, scanBaseNames) {
8990
+ const dirtyBefore = new Set([...before.modified, ...before.untracked]);
8991
+ const isFromFix = relPath => !!writtenFiles?.has(relPath) || !dirtyBefore.has(relPath);
8992
+ return [...after.modified.filter(isFromFix), ...after.untracked.filter(relPath => isFromFix(relPath) && (!!writtenFiles?.has(relPath) || scanBaseNames.has(path.basename(relPath))))];
8993
+ }
8976
8994
  function readWrittenFiles(outputFile) {
8977
8995
  const result = fs$2.readJsonSync(outputFile, {
8978
8996
  throws: false
@@ -9308,6 +9326,9 @@ async function coanaFixWithFacts(fixConfig, factsSlot) {
9308
9326
  // eslint-disable-next-line no-await-in-loop
9309
9327
  await factsSlot?.generated?.restore();
9310
9328
 
9329
+ // eslint-disable-next-line no-await-in-loop
9330
+ const changesBefore = await gitWorkingTreeChanges(cwd);
9331
+
9311
9332
  // Create a temporary file for Coana output.
9312
9333
  const tmpDir = os.tmpdir();
9313
9334
  const tmpFile = path.join(tmpDir, `socket-fix-${ghsaId}-${Date.now()}.json`);
@@ -9333,16 +9354,9 @@ async function coanaFixWithFacts(fixConfig, factsSlot) {
9333
9354
  }
9334
9355
  continue ghsaLoop;
9335
9356
  }
9336
-
9337
- // Check for modified files after applying the fix.
9338
- // eslint-disable-next-line no-await-in-loop
9339
- const unstagedCResult = await utils.gitUnstagedModifiedFiles(cwd);
9340
- // Build scripts the fix edits need not be manifests the scan uploads,
9341
- // and files it creates are untracked.
9342
- const writtenFiles = readWrittenFiles(tmpFile);
9357
+ const modifiedFiles = selectFixedFiles(changesBefore,
9343
9358
  // eslint-disable-next-line no-await-in-loop
9344
- const untrackedCResult = await utils.gitUntrackedFiles(cwd);
9345
- const modifiedFiles = writtenFiles ? [...(unstagedCResult.ok ? unstagedCResult.data : []), ...(untrackedCResult.ok ? untrackedCResult.data : [])].filter(relPath => writtenFiles.has(relPath)) : unstagedCResult.ok ? unstagedCResult.data.filter(relPath => scanBaseNames.has(path.basename(relPath))) : [];
9359
+ await gitWorkingTreeChanges(cwd), readWrittenFiles(tmpFile), scanBaseNames);
9346
9360
  if (!modifiedFiles.length) {
9347
9361
  debug.debugFn('notice', `skip: no changes for ${ghsaId}`);
9348
9362
  // Clean up temp file before continuing.
@@ -24406,5 +24420,5 @@ process.on('unhandledRejection', async (reason, promise) => {
24406
24420
  // eslint-disable-next-line n/no-process-exit
24407
24421
  process.exit(1);
24408
24422
  });
24409
- //# debugId=df6cd218-d465-449e-b81a-890e662d0baf
24423
+ //# debugId=71bcae26-79e9-4006-9570-248817c517a
24410
24424
  //# sourceMappingURL=cli.js.map