@atlasauth/cli 0.25.1 → 0.27.0
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 +49 -0
- package/README.md +26 -5
- package/dist/args.d.ts +30 -0
- package/dist/args.js +15 -0
- package/dist/args.js.map +1 -1
- package/dist/commands/config.d.ts +27 -2
- package/dist/commands/config.js +366 -44
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/doctor-scan.d.ts +29 -0
- package/dist/commands/doctor-scan.js +233 -0
- package/dist/commands/doctor-scan.js.map +1 -0
- package/dist/commands/golive.js +16 -4
- package/dist/commands/golive.js.map +1 -1
- package/dist/commands/import-jsonl.d.ts +51 -0
- package/dist/commands/import-jsonl.js +326 -0
- package/dist/commands/import-jsonl.js.map +1 -0
- package/dist/commands/import.js +22 -12
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/init-next.d.ts +4 -0
- package/dist/commands/init-next.js +86 -0
- package/dist/commands/init-next.js.map +1 -0
- package/dist/commands/init.js +119 -25
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/project-commands.js +74 -4
- package/dist/commands/project-commands.js.map +1 -1
- package/dist/commands/setup-guide.d.ts +3 -0
- package/dist/commands/setup-guide.js +38 -0
- package/dist/commands/setup-guide.js.map +1 -0
- package/dist/commands/users.js +12 -1
- package/dist/commands/users.js.map +1 -1
- package/dist/config-http.d.ts +9 -0
- package/dist/config-http.js +7 -1
- package/dist/config-http.js.map +1 -1
- package/dist/context.d.ts +18 -1
- package/dist/context.js +6 -1
- package/dist/context.js.map +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.js +79 -12
- package/dist/help.js.map +1 -1
- package/dist/redact.d.ts +41 -0
- package/dist/redact.js +115 -0
- package/dist/redact.js.map +1 -0
- package/dist/run.d.ts +2 -2
- package/dist/run.js +16 -4
- package/dist/run.js.map +1 -1
- package/package.json +4 -4
package/dist/help.js
CHANGED
|
@@ -63,6 +63,7 @@ Commands:
|
|
|
63
63
|
pages list|push|preview|promote|pull|discard
|
|
64
64
|
Code-defined hosted-page templates: draft, signed preview link, promote
|
|
65
65
|
init Create or complete an app's setup (idempotent); secrets to 0600 files
|
|
66
|
+
setup-guide The setup calls in order, with the read-back for each (--json for agents)
|
|
66
67
|
preflight Check an instance's setup; non-zero exit on errors (for CI)
|
|
67
68
|
doctor Integration health: webhooks, logout, referrals, email, consent (exit 1 on a failure)
|
|
68
69
|
golive --origin <url> Take an instance live for an app origin, step by step; stops at the first failure
|
|
@@ -236,14 +237,29 @@ configured instance (key prefixes only, never a key) and whether the app's
|
|
|
236
237
|
publishable key belongs to it; API reachability and latency; and the
|
|
237
238
|
instance's preflight summary. Network steps time out after 5 s and are
|
|
238
239
|
reported, not fatal. Anything shaped like a secret is redacted.`,
|
|
239
|
-
import: `atlas import — move users from another auth provider
|
|
240
|
+
import: `atlas import — move users from another auth provider, or from a JSONL file
|
|
240
241
|
|
|
241
242
|
Usage:
|
|
243
|
+
atlas import <users.jsonl> [--dry-run] [--since <ts>] [--on-conflict skip|update]
|
|
244
|
+
[--password-policy active|until_email_verified] [--json]
|
|
242
245
|
atlas import --from <vendor> <export-file> [--dry-run]
|
|
243
246
|
atlas import --from better-auth --bundle <file> [--dry-run] [--yes]
|
|
244
247
|
atlas import --from better-auth --import <id> [--confirm-conflicts]
|
|
245
248
|
atlas import --from better-auth (prints the import key and export command)
|
|
246
249
|
|
|
250
|
+
With no --from the file has one user per line: external_id and email (required),
|
|
251
|
+
email_verified, password_digest + algorithm, password_salt, password_hash_params,
|
|
252
|
+
oauth_identities [{provider, provider_user_id}], first_name, last_name, created_at,
|
|
253
|
+
updated_at. Any other key is an error, with the line and the nearest real key, and
|
|
254
|
+
nothing is sent. Each row is
|
|
255
|
+
matched by external_id, so running it again changes nothing. --since keeps rows
|
|
256
|
+
updated (or else created) at or after <ts>. --on-conflict skip (the default here)
|
|
257
|
+
leaves existing users alone; update applies rows that changed. It reports created,
|
|
258
|
+
updated, skipped and unverified-with-password counts, and never an email address.
|
|
259
|
+
A hash that cannot be checked is listed by external_id: warning ambiguous_scrypt_salt
|
|
260
|
+
for a hex-looking scrypt salt with no salt_encoding, and unsupported_password_hash for
|
|
261
|
+
a row the API refused.
|
|
262
|
+
|
|
247
263
|
Vendors and the file each one reads:
|
|
248
264
|
auth0 the user export job (NDJSON/JSON); --hashes <file> merges the password export
|
|
249
265
|
clerk the dashboard CSV export, or users JSON from the Backend API
|
|
@@ -261,6 +277,10 @@ Options:
|
|
|
261
277
|
--hash-config <file> Firebase hash parameters: {signer_key, salt_separator, rounds, mem_cost}
|
|
262
278
|
--hashes <file> Password hashes keyed by email, merged onto the users
|
|
263
279
|
--create-orgs Create organizations that memberships name but that do not exist yet
|
|
280
|
+
--since <ts> Only users created at or after <ts>
|
|
281
|
+
--on-conflict <mode> update (the default for --from) or skip a user who already exists
|
|
282
|
+
--password-policy <p> active (default), or until_email_verified: an imported hash signs in
|
|
283
|
+
only once the address is verified
|
|
264
284
|
--json Machine-readable summary
|
|
265
285
|
|
|
266
286
|
Better Auth bundle (npx atlas-better-auth-export --out <file> --public-key <key>):
|
|
@@ -431,7 +451,14 @@ Usage:
|
|
|
431
451
|
atlas users list [--limit <n>] [--starting-after <cursor>] [--json]
|
|
432
452
|
atlas users get <user-id> [--json]
|
|
433
453
|
atlas users create --email <address> [--first-name <n>] [--last-name <n>] [--password <p>] [--json]
|
|
454
|
+
atlas users clear-password <user-id> [--json]
|
|
434
455
|
atlas users delete <user-id> [--json]`,
|
|
456
|
+
'setup-guide': `atlas setup-guide — the setup calls in order, with the read-back for each
|
|
457
|
+
|
|
458
|
+
Usage: atlas setup-guide [--json]
|
|
459
|
+
|
|
460
|
+
Prints each step, the exact call or command, and what to read to prove it worked.
|
|
461
|
+
Full guide: https://atlasauth.net/docs/agent-setup`,
|
|
435
462
|
orgs: `atlas orgs — manage organizations
|
|
436
463
|
|
|
437
464
|
Usage:
|
|
@@ -628,7 +655,9 @@ Usage:
|
|
|
628
655
|
[--email-provider resend|brevo --email-key-file <path|->]
|
|
629
656
|
[--client-redirect <url>]... [--webhook-url <url>]
|
|
630
657
|
[--backchannel <url>]
|
|
658
|
+
[--with-dev] [--no-env-files --json]
|
|
631
659
|
[--yes] [--force] [--rotate-secret] [--json]
|
|
660
|
+
atlas init --next [--mount /atlas] [--dir <app-root>] [--force]
|
|
632
661
|
|
|
633
662
|
Needs a platform key (ATLAS_PLATFORM_KEY, or a psk_ profile from atlas login).
|
|
634
663
|
Finds the app by name and environment, or creates it, then sets strategies, the
|
|
@@ -649,18 +678,40 @@ reads stdin). It is never taken from argv and never printed.
|
|
|
649
678
|
Every secret goes to ~/.config/<product>/<env>*.env (dir 0700, files 0600) and
|
|
650
679
|
is never printed. An existing file is never overwritten without --force.
|
|
651
680
|
--rotate-secret mints a new secret key when the app exists but its file is gone.
|
|
652
|
-
Public values and file paths are kept in ~/.config/<product>/atlas.json
|
|
681
|
+
Public values and file paths are kept in ~/.config/<product>/atlas.json.
|
|
682
|
+
Turns on strict request bodies unless the instance has them or opted out.
|
|
683
|
+
|
|
684
|
+
--with-dev also creates the development sibling. A new setup then keeps each
|
|
685
|
+
environment in its own folder (~/.config/<product>/production/atlas.env and
|
|
686
|
+
development/atlas.env), so a script reading a folder's *.env files never mixes
|
|
687
|
+
keys. An existing <env>.env stays where it is.
|
|
688
|
+
Without --with-dev the same applies once the folder holds the other environment's
|
|
689
|
+
key: the new environment gets its own folder, and init prints a line saying so.
|
|
690
|
+
--no-env-files writes no secret file: each secret is handed over once in the
|
|
691
|
+
--json output on stdout. Without --json it is refused and names the paths it
|
|
692
|
+
would have written.
|
|
693
|
+
|
|
694
|
+
--next [--mount <path>] writes, with no key and no network: atlas.yaml, the
|
|
695
|
+
App Router mount and verify routes (src/app when that is where your app is), and
|
|
696
|
+
a .env.example saying which variables are build args (the publishable key only)
|
|
697
|
+
and which are runtime. With --product it sets up the instance as well.`,
|
|
653
698
|
preflight: `atlas preflight — check an instance's setup (a CI / deploy gate)
|
|
654
699
|
|
|
655
700
|
Usage: atlas preflight [--instance <id> | --product <name> [--instance-env <env>]]
|
|
656
|
-
[--fail-on error|warning] [--json]
|
|
701
|
+
[--fail-on error|warning] [--fix [--yes]] [--json]
|
|
657
702
|
|
|
658
|
-
Prints every finding (severity, code, message, fix
|
|
659
|
-
error, or with --fail-on warning
|
|
703
|
+
Prints every finding (severity, code, message, fix, and the exact call when there
|
|
704
|
+
is one). Exits 1 when there is an error, or with --fail-on warning
|
|
705
|
+
also on a warning.
|
|
706
|
+
|
|
707
|
+
--fix lists the findings the server marks safe to fix, asks before each call
|
|
708
|
+
(--yes skips the question; needed without a terminal), applies them, runs the
|
|
709
|
+
checks again and prints the result.`,
|
|
660
710
|
doctor: `atlas doctor — integration health (a CI / deploy gate)
|
|
661
711
|
|
|
662
712
|
Usage: atlas doctor [--instance <id> | --product <name> [--instance-env <env>]]
|
|
663
713
|
[--only <source,...>] [--no-probe] [--origin <url>] [--json]
|
|
714
|
+
atlas doctor --scan-dir <path> [--scan-image <ref>] [--json]
|
|
664
715
|
|
|
665
716
|
Prints every check: setup findings, webhook receivers (with the failing hop:
|
|
666
717
|
dns, tls, http, challenge or auth), back-channel logout, the referral
|
|
@@ -670,10 +721,16 @@ fails. --no-probe uses recorded deliveries only (no live calls).
|
|
|
670
721
|
--origin <url> adds the go-live checks for that app origin to the same report:
|
|
671
722
|
setup errors (preflight), login readiness (live), the path-mount verification
|
|
672
723
|
state on that host, and whether the consent declaration lists every cookie the
|
|
673
|
-
SDKs read (__session, __atlas_uat, __atlas_rt, __client)
|
|
724
|
+
SDKs read (__session, __atlas_uat, __atlas_rt, __client).
|
|
725
|
+
|
|
726
|
+
--scan-dir <path> and --scan-image <ref> need no key. They flag secret keys and
|
|
727
|
+
webhook or hook secrets in Dockerfile ARG / ENV lines, compose build.args, and an
|
|
728
|
+
image's docker history and environment, plus folders whose *.env files hold both
|
|
729
|
+
a development and a production key. Prints the file and line, never the value.
|
|
730
|
+
Exits 1 on a finding. Only the publishable key belongs in a build arg.`,
|
|
674
731
|
golive: `atlas golive — take an instance live for one app origin
|
|
675
732
|
|
|
676
|
-
Usage: atlas golive --origin <https://app.example.com> [--dry-run] [--json]
|
|
733
|
+
Usage: atlas golive --origin <https://app.example.com> [--dry-run] [--yes] [--json]
|
|
677
734
|
[--instance <id> | --product <name> [--instance-env <env>]]
|
|
678
735
|
|
|
679
736
|
Runs, in order, and stops at the first failure with its fix:
|
|
@@ -686,6 +743,9 @@ Runs, in order, and stops at the first failure with its fix:
|
|
|
686
743
|
login_readiness ready for the origin (live JWKS round-trip)
|
|
687
744
|
integrations referrals, privacy and identity integrations the instance declares
|
|
688
745
|
|
|
746
|
+
When verifying the domain would move the issuer, golive prints both issuers and
|
|
747
|
+
the previousIssuers value to add to your verifiers, then stops unless --yes.
|
|
748
|
+
|
|
689
749
|
--dry-run sends every write with ?dry_run=true: the server validates it and
|
|
690
750
|
nothing changes. Exits 0 when every step passes, 1 on the first failure.`,
|
|
691
751
|
env: `atlas env — print deploy variables without secrets
|
|
@@ -813,14 +873,14 @@ Object.assign(exports.COMMAND_HELP, {
|
|
|
813
873
|
apply: `atlas apply — make the instance match a config file (plan, confirm, apply)
|
|
814
874
|
|
|
815
875
|
Usage:
|
|
816
|
-
atlas apply [<file|dir>] [--yes] [--prune] [--force-hook] [--secrets-file <dotenv>] [--out <dir>] [--format json|yaml]
|
|
876
|
+
atlas apply [<file|dir>] [--yes] [--prune] [--force-hook] [--rotate-secret] [--show-secrets] [--secrets-file <dotenv>] [--out <dir>] [--format json|yaml]
|
|
817
877
|
atlas apply [<file|dir>] --check
|
|
818
878
|
|
|
819
879
|
<file> One JSON or YAML document keyed by resource type, for example:
|
|
820
880
|
instance: { auth_config: {...}, allowed_origins: [...] }
|
|
821
881
|
redirect_urls: [ { url: ... } ]
|
|
822
882
|
oauth_clients: [ { name: ..., redirect_uris: [...] } ]
|
|
823
|
-
webhook_endpoints: [ { url: ..., enabled_events: [...], active: false } ]
|
|
883
|
+
webhook_endpoints: [ { url: ..., enabled_events: [...], secret: "\${WEBHOOK_SECRET}", active: false } ]
|
|
824
884
|
email_provider: { transport: brevo, from_address: ..., config: { api_key: "\${BREVO_KEY}" } }
|
|
825
885
|
hooks: { before_user_create: { url: ..., timeout_ms, fail_closed, enabled } }
|
|
826
886
|
branding: { applicationName: ..., logoUrl: ... }
|
|
@@ -836,15 +896,22 @@ Without --prune the plan compares only the keys the file sets.
|
|
|
836
896
|
--check plan only; exit 2 when anything would change (CI)
|
|
837
897
|
--prune also delete live resources missing from the config, and compare every live key
|
|
838
898
|
--force-hook enable the before_user_create hook even when its test call fails (409)
|
|
899
|
+
--rotate-secret send again each secret Atlas cannot compare (it never returns them)
|
|
900
|
+
--show-secrets print secret values in the diff; refused without a terminal or when CI is set
|
|
839
901
|
--secrets-file dotenv file for \${VAR} placeholders; refused unless mode 0600
|
|
840
902
|
--out <dir> where a new client or webhook secret is saved (mode 0600;
|
|
841
903
|
default ~/.config/atlas). It is shown only once.
|
|
842
|
-
Applying stops if any \${VAR} is unresolved.
|
|
843
|
-
|
|
904
|
+
Applying stops if any \${VAR} is unresolved. A key the resource does not have is an
|
|
905
|
+
error, with the nearest real key. So is a provider mode other than native or redirect,
|
|
906
|
+
and a webhook secret that is not whsec_ plus 32 to 256 characters, checked whether or
|
|
907
|
+
not it can be compared. Secrets are never printed: a changed one shows as
|
|
908
|
+
"client_secret: <redacted> (changed)". Where Atlas cannot tell whether a secret changed
|
|
909
|
+
the plan says so instead of showing drift. A changed webhook secret is rotated with no
|
|
910
|
+
overlap: the old one stops signing at once.`,
|
|
844
911
|
plan: `atlas plan — read-only drift diff of a config file or directory
|
|
845
912
|
|
|
846
913
|
Usage:
|
|
847
|
-
atlas plan [<file|dir>] [--check|--exit-code] [--json] [--prune] [--secrets-file <dotenv>]
|
|
914
|
+
atlas plan [<file|dir>] [--check|--exit-code] [--json] [--prune] [--rotate-secret] [--show-secrets] [--secrets-file <dotenv>]
|
|
848
915
|
|
|
849
916
|
The same diff as 'atlas config plan', also for a single config file (see 'atlas
|
|
850
917
|
apply --help'). --check exits 2 when there is drift; nothing is ever written.`,
|
package/dist/help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":";;;AAAA,oDAA2M;AAC3M;;;;GAIG;AAEU,QAAA,QAAQ,GAAG
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":";;;AAAA,oDAA2M;AAC3M;;;;GAIG;AAEU,QAAA,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wDAyGgC,CAAC;AAEzD,oDAAoD;AACvC,QAAA,YAAY,GAA2B;IAClD,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CA8GmC;IAC5C,IAAI,EAAE;;;;;;;;;;gEAUwD;IAC9D,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAsDiE;IACzE,GAAG,EAAE;;;;;;;;;;;;;;;;;+CAiBwC;IAC7C,MAAM,EAAE;;;;;;;;;;;;sCAY4B;IACpC,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yEAyE4D;IAEvE,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;wEAoB+D;IAEtE,KAAK,EAAE;;;;;4CAKmC;IAE1C,IAAI,EAAE;;;;;;;;;;;;;;qBAca;IAEnB,MAAM,EAAE;;uCAE6B;IAErC,MAAM,EAAE;;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AAO,CAAC,OAAO,EAAE,qEAAqE,EAAE,iBAAK,CAAC;IACrG,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,oCAAoC,EAAE,sBAAU,CAAC;IACrF,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,EAAE,yCAAyC,EAAE,8BAAkB,CAAC;IAClH,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,qBAAqB,EAAE,oBAAQ,CAAC;IAC9D,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,8CAA8C,EAAE,kBAAM,CAAC;IACjF,SAAS,EAAE,OAAO,CAAC,WAAW,EAAE,wCAAwC,EAAE,qBAAS,CAAC;IACpF,GAAG,EAAE,OAAO,CAAC,KAAK,EAAE,uBAAuB,EAAE,eAAG,CAAC;IACjD,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,mCAAmC,EAAE,mBAAO,CAAC;IACzE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,mEAAmE,EAAE,iBAAK,CAAC;IACnG,UAAU,EAAE,OAAO,CAAC,YAAY,EAAE,mBAAmB,EAAE,sBAAU,CAAC;IAClE,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,yCAAyC,EAAE,cAAE,CAAC;CACjE,CAAC,CAAC"}
|
package/dist/redact.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's one output-side secret filter. Every change a plan prints, every
|
|
3
|
+
* `--json` report of plan / preflight / golive and every API error passes through
|
|
4
|
+
* here, so a resource added later cannot leak by forgetting to mask a field.
|
|
5
|
+
*
|
|
6
|
+
* - {@link isSecretKey}: a field name that holds a secret. Names that only mention
|
|
7
|
+
* the word (`token_endpoint`, `password_policy`, `secret_key_prefix`) are not.
|
|
8
|
+
* - {@link redactDeep}: masks secret-named strings at any depth, and scrubs the rest.
|
|
9
|
+
* - {@link scrubText}: removes known values, Atlas-key-shaped values and
|
|
10
|
+
* `name=value` pairs from free text.
|
|
11
|
+
* - {@link rememberResolved}: records what a `${VAR}` placeholder resolved to, so a
|
|
12
|
+
* secret under an unexpected key still cannot print. {@link scrubbingIO} applies
|
|
13
|
+
* those values to everything the command writes.
|
|
14
|
+
*
|
|
15
|
+
* The state is per `run()`; {@link resetRedaction} clears it.
|
|
16
|
+
*/
|
|
17
|
+
import type { IO } from './io';
|
|
18
|
+
export declare const REDACTED = "<redacted>";
|
|
19
|
+
/** True for a field name whose string value is a secret. */
|
|
20
|
+
export declare function isSecretKey(key: string): boolean;
|
|
21
|
+
/** An unresolved `${VAR}` is a name, not a value: it stays visible (apply refuses it). */
|
|
22
|
+
export declare const isPlaceholder: (v: unknown) => boolean;
|
|
23
|
+
/** The secret formats Atlas mints: `atlas_<env>_<kind>_…`, and the legacy `sk_<env>_`, `psk_`, `dsk_`, `whsec_`. */
|
|
24
|
+
export declare const SECRET_VALUE_SOURCE = "\\b(?:atlas_(?:live|test)_(?:sk|psk|dsk|whsec|pl|at)_[A-Za-z0-9]+|(?:sk_(?:live|test)|psk|dsk|whsec)_[A-Za-z0-9_\\-+/=]+)";
|
|
25
|
+
/** Forget the remembered values and leave `--show-secrets` off. */
|
|
26
|
+
export declare function resetRedaction(): void;
|
|
27
|
+
/** `--show-secrets`: the caller has checked it is allowed here. */
|
|
28
|
+
export declare function setRevealSecrets(on: boolean): void;
|
|
29
|
+
export declare const revealingSecrets: () => boolean;
|
|
30
|
+
/** Remember what a `${VAR}` under `key` resolved to. Public values (a client id, a plain URL) stay printable. */
|
|
31
|
+
export declare function rememberResolved(key: string | undefined, value: string): void;
|
|
32
|
+
/** Remove known values, key-shaped values and secret `name=value` pairs from free text. */
|
|
33
|
+
export declare function scrubText(text: string): string;
|
|
34
|
+
/** A copy with every secret-named string masked and every other string scrubbed. */
|
|
35
|
+
export declare function redactDeep<T>(value: T, key?: string): T;
|
|
36
|
+
/**
|
|
37
|
+
* The sinks every command writes through, without any value `${VAR}` resolved to.
|
|
38
|
+
* Only remembered values: a secret a command prints on purpose (`--print-secret`)
|
|
39
|
+
* was never remembered, so it still prints.
|
|
40
|
+
*/
|
|
41
|
+
export declare function scrubbingIO(io: IO): IO;
|
package/dist/redact.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.revealingSecrets = exports.SECRET_VALUE_SOURCE = exports.isPlaceholder = exports.REDACTED = void 0;
|
|
4
|
+
exports.isSecretKey = isSecretKey;
|
|
5
|
+
exports.resetRedaction = resetRedaction;
|
|
6
|
+
exports.setRevealSecrets = setRevealSecrets;
|
|
7
|
+
exports.rememberResolved = rememberResolved;
|
|
8
|
+
exports.scrubText = scrubText;
|
|
9
|
+
exports.redactDeep = redactDeep;
|
|
10
|
+
exports.scrubbingIO = scrubbingIO;
|
|
11
|
+
exports.REDACTED = '<redacted>';
|
|
12
|
+
const SECRET_WORD = /secret|token|password|passwd|api_?key|private_?key|signing_?key|encryption_?key|access_?key|credential|authorization/;
|
|
13
|
+
/** The name describes the secret rather than holding it. */
|
|
14
|
+
const DESCRIBES_IT = /_(endpoint|url|uri|method|policy|prefix|format|ttl|seconds|lifetimes?|params|set|file|files|at|type|name|id|ref|hint|hasher|alg|algorithm|enabled|required|source|length|mode|count|version)$/;
|
|
15
|
+
/** True for a field name whose string value is a secret. */
|
|
16
|
+
function isSecretKey(key) {
|
|
17
|
+
const snake = key.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toLowerCase();
|
|
18
|
+
// `has_secret`, `is_token`: a flag about the secret, never the secret.
|
|
19
|
+
return SECRET_WORD.test(snake) && !DESCRIBES_IT.test(snake) && !/^(has|is)_/.test(snake);
|
|
20
|
+
}
|
|
21
|
+
const PLACEHOLDER = /^\$\{[A-Z0-9_]+\}$/;
|
|
22
|
+
/** An unresolved `${VAR}` is a name, not a value: it stays visible (apply refuses it). */
|
|
23
|
+
const isPlaceholder = (v) => typeof v === 'string' && PLACEHOLDER.test(v);
|
|
24
|
+
exports.isPlaceholder = isPlaceholder;
|
|
25
|
+
/** The secret formats Atlas mints: `atlas_<env>_<kind>_…`, and the legacy `sk_<env>_`, `psk_`, `dsk_`, `whsec_`. */
|
|
26
|
+
exports.SECRET_VALUE_SOURCE = '\\b(?:atlas_(?:live|test)_(?:sk|psk|dsk|whsec|pl|at)_[A-Za-z0-9]+|(?:sk_(?:live|test)|psk|dsk|whsec)_[A-Za-z0-9_\\-+/=]+)';
|
|
27
|
+
const SECRET_VALUE = new RegExp(exports.SECRET_VALUE_SOURCE, 'g');
|
|
28
|
+
const KEY_VALUE = /(["']?)([A-Za-z][\w-]*)\1(\s*[:=]\s*)("(?:[^"\\]|\\.)*"|'[^']*'|[^\s,&;}"']+)/g;
|
|
29
|
+
const BEARER = /\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/g;
|
|
30
|
+
const known = new Set();
|
|
31
|
+
let reveal = false;
|
|
32
|
+
/** Forget the remembered values and leave `--show-secrets` off. */
|
|
33
|
+
function resetRedaction() {
|
|
34
|
+
known.clear();
|
|
35
|
+
reveal = false;
|
|
36
|
+
}
|
|
37
|
+
/** `--show-secrets`: the caller has checked it is allowed here. */
|
|
38
|
+
function setRevealSecrets(on) {
|
|
39
|
+
reveal = on;
|
|
40
|
+
}
|
|
41
|
+
const revealingSecrets = () => reveal;
|
|
42
|
+
exports.revealingSecrets = revealingSecrets;
|
|
43
|
+
/** Below this a value is too short to scrub without mangling ordinary words; a secret-named key is masked anyway. */
|
|
44
|
+
const MIN_SCRUB_LENGTH = 6;
|
|
45
|
+
const PUBLIC_KEY = /(^|_)client_id$|^provider$|^from_address$/i;
|
|
46
|
+
function isPlainUrl(v) {
|
|
47
|
+
try {
|
|
48
|
+
const u = new URL(v);
|
|
49
|
+
return (u.protocol === 'https:' || u.protocol === 'http:') && !u.username && !u.password && !u.search;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Remember what a `${VAR}` under `key` resolved to. Public values (a client id, a plain URL) stay printable. */
|
|
56
|
+
function rememberResolved(key, value) {
|
|
57
|
+
if (value.length < MIN_SCRUB_LENGTH)
|
|
58
|
+
return;
|
|
59
|
+
if (!(key && isSecretKey(key)) && ((key && PUBLIC_KEY.test(key)) || isPlainUrl(value)))
|
|
60
|
+
return;
|
|
61
|
+
known.add(value);
|
|
62
|
+
known.add(JSON.stringify(value).slice(1, -1));
|
|
63
|
+
}
|
|
64
|
+
function scrubKnown(text) {
|
|
65
|
+
if (reveal || known.size === 0)
|
|
66
|
+
return text;
|
|
67
|
+
let out = text;
|
|
68
|
+
for (const v of [...known].sort((a, b) => b.length - a.length))
|
|
69
|
+
out = out.split(v).join(exports.REDACTED);
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
/** Remove known values, key-shaped values and secret `name=value` pairs from free text. */
|
|
73
|
+
function scrubText(text) {
|
|
74
|
+
if (reveal)
|
|
75
|
+
return text;
|
|
76
|
+
return scrubKnown(text)
|
|
77
|
+
.replace(SECRET_VALUE, exports.REDACTED)
|
|
78
|
+
.replace(BEARER, `Bearer ${exports.REDACTED}`)
|
|
79
|
+
.replace(KEY_VALUE, (match, _q, name, sep, value) => {
|
|
80
|
+
// `<value>` in a help line is a placeholder too.
|
|
81
|
+
if (!isSecretKey(name) || (0, exports.isPlaceholder)(value) || /^<[\w-]+>$/.test(value))
|
|
82
|
+
return match;
|
|
83
|
+
const quoted = value.startsWith('"') || value.startsWith("'");
|
|
84
|
+
// `client_secret: missing` is prose; `client_secret: 8f3a91c2…` and `token=abc` are not.
|
|
85
|
+
if (!quoted && sep.includes(':') && value.length < 8)
|
|
86
|
+
return match;
|
|
87
|
+
const q = quoted ? value[0] : '';
|
|
88
|
+
return `${match.slice(0, match.length - value.length)}${q}${exports.REDACTED}${q}`;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/** A copy with every secret-named string masked and every other string scrubbed. */
|
|
92
|
+
function redactDeep(value, key) {
|
|
93
|
+
if (reveal)
|
|
94
|
+
return value;
|
|
95
|
+
if (typeof value === 'string') {
|
|
96
|
+
if (key && isSecretKey(key) && value !== '' && !(0, exports.isPlaceholder)(value))
|
|
97
|
+
return exports.REDACTED;
|
|
98
|
+
return scrubText(value);
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(value))
|
|
101
|
+
return value.map((v) => redactDeep(v, key));
|
|
102
|
+
if (value !== null && typeof value === 'object') {
|
|
103
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, redactDeep(v, k)]));
|
|
104
|
+
}
|
|
105
|
+
return value;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The sinks every command writes through, without any value `${VAR}` resolved to.
|
|
109
|
+
* Only remembered values: a secret a command prints on purpose (`--print-secret`)
|
|
110
|
+
* was never remembered, so it still prints.
|
|
111
|
+
*/
|
|
112
|
+
function scrubbingIO(io) {
|
|
113
|
+
return { out: (t) => io.out(scrubKnown(t)), err: (t) => io.err(scrubKnown(t)) };
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=redact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":";;;AAyBA,kCAIC;AAiBD,wCAGC;AAGD,4CAEC;AAiBD,4CAKC;AAUD,8BAcC;AAGD,gCAWC;AAOD,kCAEC;AAzGY,QAAA,QAAQ,GAAG,YAAY,CAAC;AAErC,MAAM,WAAW,GAAG,sHAAsH,CAAC;AAC3I,4DAA4D;AAC5D,MAAM,YAAY,GAAG,+LAA+L,CAAC;AAErN,4DAA4D;AAC5D,SAAgB,WAAW,CAAC,GAAW;IACrC,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IACvE,uEAAuE;IACvE,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAA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CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAM,CAAC;IAC3E,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAM,CAAC;IAC/F,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAC,EAAM;IAChC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClF,CAAC"}
|
package/dist/run.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ParsedArgs } from './args';
|
|
2
|
-
import type
|
|
2
|
+
import { type RunContext } from './context';
|
|
3
3
|
/** A command handler: given the context and parsed args, do the work; return an exit code. */
|
|
4
4
|
export type Handler = (ctx: RunContext, args: ParsedArgs) => Promise<number>;
|
|
5
5
|
/**
|
|
@@ -9,4 +9,4 @@ export type Handler = (ctx: RunContext, args: ParsedArgs) => Promise<number>;
|
|
|
9
9
|
* captured IO. All error reporting funnels through the one try/catch so a user
|
|
10
10
|
* sees a clean message and a non-zero code — never a stack trace.
|
|
11
11
|
*/
|
|
12
|
-
export declare function run(argv: string[],
|
|
12
|
+
export declare function run(argv: string[], rawCtx: RunContext): Promise<number>;
|
package/dist/run.js
CHANGED
|
@@ -32,8 +32,11 @@ const id_accounts_1 = require("./commands/id-accounts");
|
|
|
32
32
|
const admin_1 = require("./commands/admin");
|
|
33
33
|
const partner_platforms_1 = require("./commands/partner-platforms");
|
|
34
34
|
const resources_1 = require("./commands/resources");
|
|
35
|
+
const context_1 = require("./context");
|
|
35
36
|
const errors_1 = require("./errors");
|
|
36
37
|
const help_1 = require("./help");
|
|
38
|
+
const redact_1 = require("./redact");
|
|
39
|
+
const setup_guide_1 = require("./commands/setup-guide");
|
|
37
40
|
const version_1 = require("./version");
|
|
38
41
|
/** The command table — the single place every top-level command is registered. */
|
|
39
42
|
const COMMANDS = {
|
|
@@ -57,6 +60,7 @@ const COMMANDS = {
|
|
|
57
60
|
actions: actions_1.actions,
|
|
58
61
|
pages: pages_1.pages,
|
|
59
62
|
init: init_1.init,
|
|
63
|
+
'setup-guide': setup_guide_1.setupGuide,
|
|
60
64
|
preflight: project_commands_1.preflight,
|
|
61
65
|
doctor: project_commands_1.doctor,
|
|
62
66
|
golive: golive_1.golive,
|
|
@@ -97,7 +101,9 @@ const COMMANDS = {
|
|
|
97
101
|
* captured IO. All error reporting funnels through the one try/catch so a user
|
|
98
102
|
* sees a clean message and a non-zero code — never a stack trace.
|
|
99
103
|
*/
|
|
100
|
-
async function run(argv,
|
|
104
|
+
async function run(argv, rawCtx) {
|
|
105
|
+
(0, redact_1.resetRedaction)();
|
|
106
|
+
const ctx = { ...rawCtx, io: (0, redact_1.scrubbingIO)(rawCtx.io) };
|
|
101
107
|
let args;
|
|
102
108
|
try {
|
|
103
109
|
args = (0, args_1.parse)(argv);
|
|
@@ -110,6 +116,12 @@ async function run(argv, ctx) {
|
|
|
110
116
|
ctx.io.out((0, version_1.getVersion)());
|
|
111
117
|
return 0;
|
|
112
118
|
}
|
|
119
|
+
if (args.values['show-secrets']) {
|
|
120
|
+
if (!(0, context_1.ttyOf)(ctx).stdout || ctx.env.CI) {
|
|
121
|
+
return report(ctx, new errors_1.CliError('--show-secrets needs a terminal: it is refused when stdout is not a TTY or CI is set.'));
|
|
122
|
+
}
|
|
123
|
+
(0, redact_1.setRevealSecrets)(true);
|
|
124
|
+
}
|
|
113
125
|
const command = args.positionals[0];
|
|
114
126
|
// Bare `atlas` or `atlas --help`: top-level help on stdout, success.
|
|
115
127
|
if (!command) {
|
|
@@ -143,15 +155,15 @@ async function run(argv, ctx) {
|
|
|
143
155
|
function report(ctx, err) {
|
|
144
156
|
if (err instanceof backend_1.AtlasApiError) {
|
|
145
157
|
const code = err.code ? ` [${err.code}]` : '';
|
|
146
|
-
ctx.io.err(`atlas: API error (HTTP ${err.status})${code}: ${err.message}`);
|
|
158
|
+
ctx.io.err(`atlas: API error (HTTP ${err.status})${code}: ${(0, redact_1.scrubText)(err.message)}`);
|
|
147
159
|
return 1;
|
|
148
160
|
}
|
|
149
161
|
if (err instanceof errors_1.CliError) {
|
|
150
|
-
ctx.io.err(`atlas: ${err.message}`);
|
|
162
|
+
ctx.io.err(`atlas: ${(0, redact_1.scrubText)(err.message)}`);
|
|
151
163
|
return err.exitCode;
|
|
152
164
|
}
|
|
153
165
|
const message = err instanceof Error ? err.message : String(err);
|
|
154
|
-
ctx.io.err(`atlas: ${message}`);
|
|
166
|
+
ctx.io.err(`atlas: ${(0, redact_1.scrubText)(message)}`);
|
|
155
167
|
return 1;
|
|
156
168
|
}
|
|
157
169
|
//# sourceMappingURL=run.js.map
|
package/dist/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":";;AA4GA,kBAiDC;AA7JD,gDAAmD;AACnD,iCAAgD;AAChD,gDAA6C;AAC7C,4CAAyC;AACzC,kDAA8C;AAC9C,0CAAwD;AACxD,kDAAkD;AAClD,8CAAsE;AACtE,0CAAuC;AACvC,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AAC,UAAU,IAAA,kBAAS,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "atlas — manage an Atlas instance from the terminal via the Backend API.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"atlas": "dist/cli.js"
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"yaml": "^2.6.0",
|
|
19
|
+
"@atlasauth/emulator": "0.1.0",
|
|
19
20
|
"@atlasauth/actions": "0.5.0",
|
|
20
|
-
"@atlasauth/backend": "0.35.0",
|
|
21
21
|
"@atlasauth/migrate": "0.2.0",
|
|
22
|
-
"@atlasauth/
|
|
22
|
+
"@atlasauth/backend": "0.37.0",
|
|
23
23
|
"@atlasauth/referral-conformance": "0.2.1",
|
|
24
|
-
"@atlasauth/
|
|
24
|
+
"@atlasauth/upgrade": "0.7.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^22.9.0",
|