@salesforce/plugin-auth 4.4.5 → 4.4.7

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/README.md CHANGED
@@ -107,7 +107,7 @@ EXAMPLES
107
107
  $ sf org list auth
108
108
  ```
109
109
 
110
- _See code: [src/commands/org/list/auth.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.5/src/commands/org/list/auth.ts)_
110
+ _See code: [src/commands/org/list/auth.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.7/src/commands/org/list/auth.ts)_
111
111
 
112
112
  ## `sf org login access-token`
113
113
 
@@ -134,6 +134,9 @@ DESCRIPTION
134
134
  By default, the command runs interactively and asks you for the access token. If you previously authorized the org,
135
135
  the command prompts whether you want to overwrite the local file. Specify --no-prompt to not be prompted.
136
136
 
137
+ If you pipe the access token to the command (so stdin isn't an interactive terminal), the command reads the token from
138
+ stdin and doesn't prompt to overwrite an existing file.
139
+
137
140
  To use the command in a CI/CD script, set the SF_ACCESS_TOKEN environment variable to the access token. Then run the
138
141
  command with the --no-prompt parameter.
139
142
 
@@ -161,7 +164,7 @@ FLAG DESCRIPTIONS
161
164
  To specify a sandbox, set --instance-url to "https://<MyDomainName>--<SandboxName>.sandbox.my.salesforce.com".
162
165
  ```
163
166
 
164
- _See code: [src/commands/org/login/access-token.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.5/src/commands/org/login/access-token.ts)_
167
+ _See code: [src/commands/org/login/access-token.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.7/src/commands/org/login/access-token.ts)_
165
168
 
166
169
  ## `sf org login jwt`
167
170
 
@@ -252,7 +255,7 @@ FLAG DESCRIPTIONS
252
255
  To specify a sandbox, set --instance-url to "https://<MyDomainName>--<SandboxName>.sandbox.my.salesforce.com".
253
256
  ```
254
257
 
255
- _See code: [src/commands/org/login/jwt.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.5/src/commands/org/login/jwt.ts)_
258
+ _See code: [src/commands/org/login/jwt.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.7/src/commands/org/login/jwt.ts)_
256
259
 
257
260
  ## `sf org login sfdx-url`
258
261
 
@@ -322,7 +325,7 @@ EXAMPLES
322
325
  $ echo url | sf org login sfdx-url --sfdx-url-stdin
323
326
  ```
324
327
 
325
- _See code: [src/commands/org/login/sfdx-url.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.5/src/commands/org/login/sfdx-url.ts)_
328
+ _See code: [src/commands/org/login/sfdx-url.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.7/src/commands/org/login/sfdx-url.ts)_
326
329
 
327
330
  ## `sf org login web`
328
331
 
@@ -427,7 +430,7 @@ FLAG DESCRIPTIONS
427
430
  To specify a sandbox, set --instance-url to "https://<MyDomainName>--<SandboxName>.sandbox.my.salesforce.com".
428
431
  ```
429
432
 
430
- _See code: [src/commands/org/login/web.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.5/src/commands/org/login/web.ts)_
433
+ _See code: [src/commands/org/login/web.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.7/src/commands/org/login/web.ts)_
431
434
 
432
435
  ## `sf org logout`
433
436
 
@@ -493,6 +496,6 @@ FLAG DESCRIPTIONS
493
496
  All orgs includes Dev Hubs, sandboxes, DE orgs, and expired, deleted, and unknown-status scratch orgs.
494
497
  ```
495
498
 
496
- _See code: [src/commands/org/logout.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.5/src/commands/org/logout.ts)_
499
+ _See code: [src/commands/org/logout.ts](https://github.com/salesforcecli/plugin-auth/blob/4.4.7/src/commands/org/logout.ts)_
497
500
 
498
501
  <!-- commandsstop -->
@@ -21,4 +21,5 @@ export default class LoginAccessToken extends SfCommand<AuthFields> {
21
21
  private saveAuthInfo;
22
22
  private overwriteAuthInfo;
23
23
  private getAccessToken;
24
+ private resolveAccessToken;
24
25
  }
@@ -111,7 +111,10 @@ export default class LoginAccessToken extends SfCommand {
111
111
  await AuthInfo.identifyPossibleScratchOrgs(authInfo.getFields(true), authInfo);
112
112
  }
113
113
  async overwriteAuthInfo(username) {
114
- if (!this.flags['no-prompt']) {
114
+ // Only prompt to overwrite when we can actually receive an answer. When stdin is not a
115
+ // TTY (e.g. the token was piped in) the interactive prompt has no input to read and would
116
+ // reject with "User force closed the prompt with 13 null", so treat it like --no-prompt.
117
+ if (!this.flags['no-prompt'] && process.stdin.isTTY) {
115
118
  const stateAggregator = await StateAggregator.getInstance();
116
119
  if (await stateAggregator.orgs.exists(username)) {
117
120
  return this.confirm({ message: messages.getMessage('overwriteAccessTokenAuthUserFile', [username]) });
@@ -120,15 +123,62 @@ export default class LoginAccessToken extends SfCommand {
120
123
  return true;
121
124
  }
122
125
  async getAccessToken() {
123
- const accessToken = env.getString('SF_ACCESS_TOKEN') ??
124
- env.getString('SFDX_ACCESS_TOKEN') ??
125
- (this.flags['no-prompt'] === true
126
- ? '' // will throw when validating
127
- : await this.secretPrompt({ message: commonMessages.getMessage('accessTokenStdin') }));
126
+ const accessToken = env.getString('SF_ACCESS_TOKEN') ?? env.getString('SFDX_ACCESS_TOKEN') ?? (await this.resolveAccessToken());
128
127
  if (!matchesAccessToken(accessToken)) {
129
128
  throw new SfError(messages.getMessage('invalidAccessTokenFormat', [ACCESS_TOKEN_FORMAT]));
130
129
  }
131
130
  return accessToken;
132
131
  }
132
+ async resolveAccessToken() {
133
+ if (this.flags['no-prompt']) {
134
+ // will throw when validating
135
+ return '';
136
+ }
137
+ // When stdin is piped (not a TTY) the interactive secret prompt can't be used reliably,
138
+ // so read the token directly from the stream. This is the CI/CD "pipe the token" workflow.
139
+ if (!process.stdin.isTTY) {
140
+ return readPipedStdin();
141
+ }
142
+ return this.secretPrompt({ message: commonMessages.getMessage('accessTokenStdin') });
143
+ }
144
+ }
145
+ /**
146
+ * Read all data piped to stdin and return it trimmed. Returns '' if nothing was piped.
147
+ *
148
+ * A timeout guards against a stdin stream that is opened but never sends data or EOF (e.g. a
149
+ * pipe inherited from a supervisor process, or a terminal that reports a non-TTY stdin such as
150
+ * Git Bash/mintty on Windows), which would otherwise hang the command forever. On timeout the
151
+ * stream listeners are removed so no read is left dangling.
152
+ */
153
+ async function readPipedStdin(ms = 60_000) {
154
+ const stdin = process.stdin;
155
+ const chunks = [];
156
+ return new Promise((resolve, reject) => {
157
+ const onData = (chunk) => {
158
+ chunks.push(typeof chunk === 'string' ? chunk : chunk.toString('utf8'));
159
+ };
160
+ const cleanup = () => {
161
+ clearTimeout(timer);
162
+ stdin.removeListener('data', onData);
163
+ stdin.removeListener('end', onEnd);
164
+ stdin.removeListener('error', onError);
165
+ };
166
+ const onEnd = () => {
167
+ cleanup();
168
+ resolve(chunks.join('').trim());
169
+ };
170
+ const onError = (err) => {
171
+ cleanup();
172
+ reject(err);
173
+ };
174
+ const timer = setTimeout(() => {
175
+ cleanup();
176
+ reject(new SfError(messages.getMessage('stdinTimeout')));
177
+ }, ms);
178
+ timer.unref();
179
+ stdin.on('data', onData);
180
+ stdin.once('end', onEnd);
181
+ stdin.once('error', onError);
182
+ });
133
183
  }
134
184
  //# sourceMappingURL=access-token.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"access-token.js","sourceRoot":"","sources":["../../../../src/commands/org/login/access-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAEL,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB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AAK,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACrC,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACnC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,GAAS,EAAE;YACvB,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAClC,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,CAAC,GAAU,EAAQ,EAAE;YACnC,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,KAAK,CAAC,KAAK,EAAE,CAAC;QAEd,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -6,6 +6,8 @@ Authorize an org using an existing Salesforce access token.
6
6
 
7
7
  By default, the command runs interactively and asks you for the access token. If you previously authorized the org, the command prompts whether you want to overwrite the local file. Specify --no-prompt to not be prompted.
8
8
 
9
+ If you pipe the access token to the command (so stdin isn't an interactive terminal), the command reads the token from stdin and doesn't prompt to overwrite an existing file.
10
+
9
11
  To use the command in a CI/CD script, set the SF_ACCESS_TOKEN environment variable to the access token. Then run the command with the --no-prompt parameter.
10
12
 
11
13
  # examples
@@ -27,3 +29,8 @@ It should follow this pattern: %s.
27
29
 
28
30
  A file already exists for user "%s", which is associated with the access token you provided.
29
31
  Are you sure you want to overwrite the existing file?
32
+
33
+ # stdinTimeout
34
+
35
+ Timed out while reading the access token from stdin.
36
+ Pipe the access token to the command, or set the SF_ACCESS_TOKEN environment variable and use --no-prompt.
@@ -201,7 +201,7 @@
201
201
  ],
202
202
  "args": {},
203
203
  "deprecateAliases": true,
204
- "description": "By default, the command runs interactively and asks you for the access token. If you previously authorized the org, the command prompts whether you want to overwrite the local file. Specify --no-prompt to not be prompted.\n\nTo use the command in a CI/CD script, set the SF_ACCESS_TOKEN environment variable to the access token. Then run the command with the --no-prompt parameter.",
204
+ "description": "By default, the command runs interactively and asks you for the access token. If you previously authorized the org, the command prompts whether you want to overwrite the local file. Specify --no-prompt to not be prompted.\n\nIf you pipe the access token to the command (so stdin isn't an interactive terminal), the command reads the token from stdin and doesn't prompt to overwrite an existing file.\n\nTo use the command in a CI/CD script, set the SF_ACCESS_TOKEN environment variable to the access token. Then run the command with the --no-prompt parameter.",
205
205
  "examples": [
206
206
  "Authorize an org on https://mycompany.my.salesforce.com; the command prompts you for the access token:\n<%= config.bin %> <%= command.id %> --instance-url https://mycompany.my.salesforce.com",
207
207
  "Authorize the org without being prompted; you must have previously set the SF_ACCESS_TOKEN environment variable to the access token:\n<%= config.bin %> <%= command.id %> --instance-url https://dev-hub.my.salesforce.com --no-prompt"
@@ -944,5 +944,5 @@
944
944
  ]
945
945
  }
946
946
  },
947
- "version": "4.4.5"
947
+ "version": "4.4.7"
948
948
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-auth",
3
3
  "description": "plugin for sf auth commands",
4
- "version": "4.4.5",
4
+ "version": "4.4.7",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/forcedotcom/cli/issues",
7
7
  "enableO11y": true,
@@ -24,7 +24,7 @@
24
24
  "@salesforce/plugin-command-reference": "^3.1.101",
25
25
  "@salesforce/ts-sinon": "^1.4.34",
26
26
  "eslint-plugin-sf-plugin": "^1.20.33",
27
- "oclif": "^4.23.8",
27
+ "oclif": "^4.23.16",
28
28
  "ts-node": "^10.9.2",
29
29
  "typescript": "^5.5.4"
30
30
  },
@@ -233,7 +233,7 @@
233
233
  "exports": "./lib/index.js",
234
234
  "type": "module",
235
235
  "sfdx": {
236
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-auth/4.4.5.crt",
237
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-auth/4.4.5.sig"
236
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-auth/4.4.7.crt",
237
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-auth/4.4.7.sig"
238
238
  }
239
239
  }