@jacebenson/jsn 5.5.5-dev.191.1 → 5.5.5-dev.193.1
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/package.json +1 -1
- package/src/auth/credential-store.js +1 -1
- package/src/auth.js +3 -3
- package/src/commands/auth.js +1 -1
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import { globalConfigDir } from '../config.js';
|
|
|
10
10
|
*
|
|
11
11
|
* Whitelist approach (issue #143 findings #2/#3): first map the `://`
|
|
12
12
|
* protocol separator to `_` exactly as the Go version's encoding does
|
|
13
|
-
* (so existing keyring keys like `
|
|
13
|
+
* (so existing keyring keys like `https_example.service-now.com` keep
|
|
14
14
|
* matching), then drop everything outside [a-zA-Z0-9._-]. Blacklist
|
|
15
15
|
* stripping of just `/` and `:` left quotes, `$()`, backticks, `;`,
|
|
16
16
|
* spaces, and backslashes — which broke out of double-quoted shell args
|
package/src/auth.js
CHANGED
|
@@ -26,11 +26,11 @@ export { classifyCredentialState } from './auth/credential-state.js';
|
|
|
26
26
|
|
|
27
27
|
// ─── Basic auth from environment variables ───
|
|
28
28
|
// SN_USERNAME / SN_PASSWORD — global credentials
|
|
29
|
-
// SN_<INSTANCE>_USERNAME / SN_<INSTANCE>_PASSWORD — instance-specific (e.g.
|
|
29
|
+
// SN_<INSTANCE>_USERNAME / SN_<INSTANCE>_PASSWORD — instance-specific (e.g. SN_EXAMPLE_USERNAME)
|
|
30
30
|
|
|
31
31
|
function envVarName(instance) {
|
|
32
32
|
// Normalize instance URL to an env-var-safe name
|
|
33
|
-
// e.g. https://
|
|
33
|
+
// e.g. https://example.service-now.com → EXAMPLE
|
|
34
34
|
const host = instance.replace(/https?:\/\//, '').replace(/\/.*$/, '').replace(/\.service-now\.com.*/, '').replace(/[^a-zA-Z0-9]/g, '').toUpperCase();
|
|
35
35
|
return host;
|
|
36
36
|
}
|
|
@@ -44,7 +44,7 @@ function getBasicAuthFromEnv(instance) {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// Try instance-specific env vars first (e.g.
|
|
47
|
+
// Try instance-specific env vars first (e.g. SN_EXAMPLE_USERNAME)
|
|
48
48
|
const host = envVarName(instance);
|
|
49
49
|
const instanceUser = process.env[`SN_${host}_USERNAME`];
|
|
50
50
|
const instancePass = process.env[`SN_${host}_PASSWORD`];
|
package/src/commands/auth.js
CHANGED
|
@@ -602,7 +602,7 @@ export async function loginProfile(argv, app, { concise = false } = {}) {
|
|
|
602
602
|
Examples:
|
|
603
603
|
jsn auth login https://dev12345.service-now.com
|
|
604
604
|
jsn auth login dev373698
|
|
605
|
-
jsn auth login --basic https://
|
|
605
|
+
jsn auth login --basic https://example.service-now.com
|
|
606
606
|
|
|
607
607
|
Find your instance URL in your browser's address bar when logged into ServiceNow.`);
|
|
608
608
|
}
|