Skip to content

Conversation

@jdalton
Copy link
Contributor

@jdalton jdalton commented Jan 12, 2026

Migrate patch command to use external socket-patch@1.2.0 package.


Note

Shifts patch functionality to the external Socket Patch CLI and wires up version/env plumbing.

  • socket patch now forwards all args to @socketsecurity/socket-patch@1.2.0 via spawnSocketPatch (DLX or local override)
  • Adds socket-patch to external-tools.json and inlined build metadata INLINED_SOCKET_CLI_SOCKET_PATCH_VERSION
  • New env helpers: getSocketPatchVersion, SOCKET_CLI_SOCKET_PATCH_LOCAL_PATH; exports integrated in constants/env.mts
  • New spawn util utils/socket-patch/spawn.mts passes org slug, API token, and proxy to the external CLI
  • Tightens env getters for Coana/SFW to throw if versions are missing
  • Moves prior patch implementation to commands/patch-old/* for reference/compatibility
  • Changelog updated under Unreleased to reflect the migration

Written by Cursor Bugbot for commit 69011b8. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment @cursor review or bugbot run to trigger another review on this PR


if (!result.ok) {
process.exitCode = 1
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error messages silently discarded on spawn failure

Medium Severity

When spawnSocketPatch fails (e.g., network error downloading the package, invalid local path, permission issues), the error message is captured in result.message but never displayed to the user. The code only sets process.exitCode = 1 without outputting the error. Other commands in the codebase properly handle this by calling logger.fail() with the message. Users will experience silent failures with exit code 1 but no explanation of what went wrong.

Fix in Cursor Fix in Web

@jdalton jdalton force-pushed the feat/migrate-to-socket-patch branch 7 times, most recently from ba8a337 to aee59b7 Compare January 12, 2026 20:19
@jdalton jdalton force-pushed the feat/migrate-to-socket-patch branch 2 times, most recently from 453e76a to 174fe73 Compare January 12, 2026 20:59
@jdalton jdalton force-pushed the feat/migrate-to-socket-patch branch from 174fe73 to 92f1cca Compare January 12, 2026 21:11
- Replace 'info' test (removed command) with 'scan' (renamed from discover)
- Replace 'discover' test with 'scan' (renamed)
- Replace 'download' test with 'get' (download is alias)
- Replace 'cleanup' test with 'repair' (renamed)
- Replace 'rm' test with 'remove' (renamed)

These changes align tests with socket-patch v1.2.0 command structure.
Resolved conflict in CHANGELOG.md by keeping all changes:
- Changed: Updated to @socketsecurity/socket-patch@1.2.0
- Changed: Updated Coana CLI to v14.12.148
- Fixed: Heap overflow prevention in large monorepo scans
Version getters should fail if environment variables aren't set,
even in test mode, because values should be properly defined in
external-tools.json.
Removed tests for commands not in socket-patch v1.2.0:
- cleanup (obsolete, repair is the actual command)
- discover (obsolete, scan is the actual command)
- info (obsolete, merged into get command)
- download (obsolete, alias of get command)

Renamed:
- cmd-patch-rm.test.mts → cmd-patch-remove.test.mts

socket-patch v1.2.0 actual commands: get, apply, rollback, remove, list, scan, setup, repair
Added INLINED_SOCKET_CLI_COANA_VERSION, INLINED_SOCKET_CLI_SFW_VERSION,
and INLINED_SOCKET_CLI_SOCKET_PATCH_VERSION to .env.test so unit tests
can access these values without going through the build process.
@jdalton jdalton force-pushed the feat/migrate-to-socket-patch branch from 0d338b4 to 85db681 Compare January 13, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants