socket 1.1.120 → 1.1.121

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,12 @@ 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.1.121](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.121) - 2026-06-17
8
+
9
+ ### Fixed
10
+ - `socket config set` now persists correctly when a Socket API token is supplied via an environment variable. Previously, setting `SOCKET_CLI_API_TOKEN` / `SOCKET_SECURITY_API_TOKEN` put the entire config into read-only mode, so `socket config set <key> <value>` silently failed to save (and a later `socket config get` showed nothing) while still printing `OK`. A token from the environment now overrides authentication only: unrelated keys such as `defaultOrg` are written to disk as expected, and the env-supplied token itself is still never persisted.
11
+ - `socket config set` no longer reports a misleading `OK` when the value genuinely cannot be saved. When the config is fully overridden (and therefore ephemeral) via `--config`, `SOCKET_CLI_CONFIG`, or `SOCKET_CLI_NO_API_TOKEN`, the command now fails with a clear error explaining that the value was not saved, instead of pretending it succeeded.
12
+
7
13
  ## [1.1.120](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.120) - 2026-06-12
8
14
 
9
15
  ### Changed
package/dist/cli.js CHANGED
@@ -5667,7 +5667,19 @@ async function handleConfigGet({
5667
5667
  key,
5668
5668
  outputKind
5669
5669
  }) {
5670
- const result = utils.getConfigValue(key);
5670
+ // A Socket API token supplied via the environment (SOCKET_CLI_API_TOKEN /
5671
+ // SOCKET_SECURITY_API_TOKEN and legacy aliases, all aggregated into
5672
+ // constants.ENV.SOCKET_CLI_API_TOKEN) takes precedence over any persisted or
5673
+ // --config value. The env token is no longer mirrored into the in-memory
5674
+ // config (so unrelated keys stay persistable via `config set`), so surface it
5675
+ // explicitly here to preserve "env token wins" for `config get apiToken`.
5676
+ const {
5677
+ ENV
5678
+ } = constants.default;
5679
+ const result = key === constants.CONFIG_KEY_API_TOKEN && !ENV.SOCKET_CLI_NO_API_TOKEN && ENV.SOCKET_CLI_API_TOKEN ? {
5680
+ ok: true,
5681
+ data: ENV.SOCKET_CLI_API_TOKEN
5682
+ } : utils.getConfigValue(key);
5671
5683
  await outputConfigGet(key, result, outputKind);
5672
5684
  }
5673
5685
 
@@ -5892,18 +5904,10 @@ async function outputConfigSet(result, outputKind) {
5892
5904
  logger.logger.log(`# Update config`);
5893
5905
  logger.logger.log('');
5894
5906
  logger.logger.log(result.message);
5895
- if (result.data) {
5896
- logger.logger.log('');
5897
- logger.logger.log(result.data);
5898
- }
5899
- } else {
5900
- logger.logger.log(`OK`);
5901
- logger.logger.log(result.message);
5902
- if (result.data) {
5903
- logger.logger.log('');
5904
- logger.logger.log(result.data);
5905
- }
5907
+ return;
5906
5908
  }
5909
+ logger.logger.log(`OK`);
5910
+ logger.logger.log(result.message);
5907
5911
  }
5908
5912
 
5909
5913
  async function handleConfigSet({
@@ -5918,11 +5922,24 @@ async function handleConfigSet({
5918
5922
  outputKind
5919
5923
  });
5920
5924
  const result = utils.updateConfigValue(key, value);
5921
- require$$9.debugFn('notice', `Config update ${result.ok ? 'succeeded' : 'failed'}`);
5925
+
5926
+ // `config set` is a one-shot command: an in-memory-only change is a no-op
5927
+ // because the process exits before anything reads it. updateConfigValue only
5928
+ // populates `data` when the config is read-only (a full --config /
5929
+ // SOCKET_CLI_CONFIG / SOCKET_CLI_NO_API_TOKEN override), so in that case
5930
+ // report a failure instead of a misleading success.
5931
+ const outcome = result.ok && result.data ? {
5932
+ ok: false,
5933
+ code: 1,
5934
+ message: `Config key '${key}' was not saved`,
5935
+ cause: result.data
5936
+ } : result;
5937
+ require$$9.debugFn('notice', `Config update ${outcome.ok ? 'succeeded' : 'failed'}`);
5922
5938
  require$$9.debugDir('inspect', {
5939
+ outcome,
5923
5940
  result
5924
5941
  });
5925
- await outputConfigSet(result, outputKind);
5942
+ await outputConfigSet(outcome, outputKind);
5926
5943
  }
5927
5944
 
5928
5945
  const CMD_NAME$u = 'set';
@@ -20249,5 +20266,5 @@ process.on('unhandledRejection', async (reason, promise) => {
20249
20266
  // eslint-disable-next-line n/no-process-exit
20250
20267
  process.exit(1);
20251
20268
  });
20252
- //# debugId=c95bf38d-6368-425f-b593-0afd21e07f62
20269
+ //# debugId=85257911-3f47-4452-8e33-51ee5c9c6b59
20253
20270
  //# sourceMappingURL=cli.js.map