@mnemonik/cli 7.141.0 → 7.141.2

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.
Files changed (40) hide show
  1. package/dist/auth/credentials.js +266 -3
  2. package/dist/auth/index.js +266 -3
  3. package/dist/auth/installSession.js +262 -0
  4. package/dist/auth/status.js +262 -0
  5. package/dist/authorizationWords.js +262 -0
  6. package/dist/diagnostics.js +266 -3
  7. package/dist/digests.json +38 -38
  8. package/dist/hooksLog.js +4 -0
  9. package/dist/identity/migrate.js +266 -3
  10. package/dist/install/hosts.js +262 -0
  11. package/dist/install/journal.js +266 -3
  12. package/dist/install/journey.js +266 -3
  13. package/dist/install/ownership.js +266 -3
  14. package/dist/install/transaction.js +266 -3
  15. package/dist/install/ui.js +266 -3
  16. package/dist/installSession.js +262 -0
  17. package/dist/installation.js +266 -3
  18. package/dist/launcher.js +266 -3
  19. package/dist/preflight.js +354 -92
  20. package/dist/project/eligibility.js +266 -3
  21. package/dist/project/records.js +266 -3
  22. package/dist/project.js +270 -7
  23. package/dist/router.js +270 -7
  24. package/dist/runtime/releaseSource.js +266 -3
  25. package/dist/runtime/selfUpdate.js +266 -3
  26. package/dist/runtime/signers.js +67 -7
  27. package/dist/runtime/store.js +4 -0
  28. package/dist/runtime/updateCheck.js +266 -3
  29. package/dist/sbom.json +21 -21
  30. package/dist/scanner/control.js +266 -3
  31. package/dist/scanner/data.js +262 -0
  32. package/dist/scanner/discover.js +354 -92
  33. package/dist/scanner/enable.js +270 -7
  34. package/dist/scanner/picker.js +325 -63
  35. package/dist/scanner/service.js +266 -3
  36. package/dist/scanner/update.js +266 -3
  37. package/dist/scanner-release.json +24 -24
  38. package/dist/status.js +266 -3
  39. package/dist/vendor/local-setup.js +266 -3
  40. package/package.json +31 -31
@@ -886,9 +886,13 @@ var require_ignore = __commonJS({
886
886
  });
887
887
 
888
888
  // packages/shared/dist/secretPatterns.js
889
+ var SECRET_LABEL, SECRET_LABEL_RE, LABELED_VALUE_RE;
889
890
  var init_secretPatterns = __esm({
890
891
  "packages/shared/dist/secretPatterns.js"() {
891
892
  "use strict";
893
+ SECRET_LABEL = String.raw`[\w$-]*(?:api[_-]?key|secret|token|password|credential|auth)|aws_secret_access_key`;
894
+ SECRET_LABEL_RE = new RegExp(`^(?:${SECRET_LABEL}|MYSQL_PWD|SSHPASS)$`, "i");
895
+ LABELED_VALUE_RE = new RegExp(String.raw`(?<![\w$-])((["']?)(?:${SECRET_LABEL})\2\s*[:=]\s*)(?=\S)`, "gi");
892
896
  }
893
897
  });
894
898
 
@@ -901,7 +905,7 @@ var init_protectedPaths = __esm({
901
905
 
902
906
  // packages/shared/dist/projectIdentityFile.js
903
907
  import { lstat, readFile } from "node:fs/promises";
904
- import { join } from "node:path";
908
+ import { join as join2 } from "node:path";
905
909
  function parseIdentityFile(text) {
906
910
  let value;
907
911
  try {
@@ -962,7 +966,7 @@ function isConfigurationOnly(text) {
962
966
  }
963
967
  }
964
968
  async function readIdentityFile(dir, options = {}) {
965
- const path = join(dir, ".mnemonik.json");
969
+ const path = join2(dir, ".mnemonik.json");
966
970
  try {
967
971
  const stat = await lstat(path);
968
972
  if (stat.isSymbolicLink())
@@ -3055,9 +3059,6 @@ var MCP_INSTRUCTIONS = getMcpInstructions();
3055
3059
 
3056
3060
  // packages/shared/dist/codeScanner.js
3057
3061
  var import_ignore = __toESM(require_ignore(), 1);
3058
- init_secretPatterns();
3059
- init_protectedPaths();
3060
- init_projectIdentityFile();
3061
3062
 
3062
3063
  // node_modules/web-tree-sitter/web-tree-sitter.js
3063
3064
  var __defProp2 = Object.defineProperty;
@@ -7103,14 +7104,276 @@ var Query = class {
7103
7104
  };
7104
7105
 
7105
7106
  // packages/shared/dist/ast/grammars.js
7106
- import { dirname, extname, join as join2 } from "node:path";
7107
+ import { dirname, extname, join } from "node:path";
7107
7108
  import { fileURLToPath } from "node:url";
7108
- var WASM_DIR = join2(dirname(fileURLToPath(import.meta.url)), "..", "..", "wasm");
7109
+ var WASM_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "wasm");
7109
7110
 
7110
7111
  // packages/shared/dist/ast/astChunker.js
7111
7112
  var MAX_AST_PARSE_BYTES = 2 * 1024 * 1024;
7112
7113
 
7114
+ // packages/shared/dist/redactCredentials.js
7115
+ var REDACTED = "<redacted credential>";
7116
+ var MAX_PEM_BODY_LENGTH = 8 * 1024;
7117
+ var LETTER_OR_DIGIT = /[A-Za-z0-9]/;
7118
+ function hasLetterOrDigit(value) {
7119
+ return LETTER_OR_DIGIT.test(value);
7120
+ }
7121
+ function redactContextValue(match, head = "", value = "") {
7122
+ return hasLetterOrDigit(value) ? `${head}${REDACTED}` : match;
7123
+ }
7124
+ var PLACEHOLDER_PASSWORD = /^(?:\[REDACTED(?::[A-Za-z0-9_-]+)?\]|redacted|<[^<>]*>|\{\{[^{}]*\}\}|\$\{[^{}]+\}|%[A-Za-z_][A-Za-z0-9_]*%|\*+|x{3,}|\.\.\.|\u2026|password|passwd|pass|pwd|pw|secret|changeme|change[_-]me|example|test|(?:your|my)[a-z_-]*?(?:password|passwd|pass|pwd|secret|key|token|here))$/i;
7125
+ var PLACEHOLDER_ENV_VAR = /^\$[A-Z_][A-Z0-9_]*$/;
7126
+ function isPlaceholderPassword(password) {
7127
+ return PLACEHOLDER_PASSWORD.test(password) || PLACEHOLDER_ENV_VAR.test(password);
7128
+ }
7129
+ function redactUrlPassword(match, head = "", password = "") {
7130
+ return isPlaceholderPassword(password) || !hasLetterOrDigit(password) ? match : `${head}${REDACTED}@`;
7131
+ }
7132
+ var SHELL_WORD = String.raw`'[^'\n]*'|"[^"\n]*"|(?!${REDACTED})[^\s'"\`;|&()[\]{}\\,/][^\s'"\`;|&]*`;
7133
+ var OPENING_QUOTE = String.raw`(["'\`]?)`;
7134
+ var TRAILING_PUNCTUATION = /[.,:;!?)\]}]+$/;
7135
+ var PROSE_WORDS = /* @__PURE__ */ new Set([
7136
+ "a",
7137
+ "an",
7138
+ "and",
7139
+ "as",
7140
+ "for",
7141
+ "in",
7142
+ "is",
7143
+ "it",
7144
+ "on",
7145
+ "or",
7146
+ "the",
7147
+ "to",
7148
+ "with",
7149
+ "flag",
7150
+ "option",
7151
+ "argument",
7152
+ "instead",
7153
+ "which",
7154
+ "that",
7155
+ "this",
7156
+ "puts",
7157
+ "passes",
7158
+ "leaks",
7159
+ "exposes"
7160
+ ]);
7161
+ var REGEX_DELIMITER = /\/(?:[{}()[\];]|$)/;
7162
+ function shellWordSecret(word) {
7163
+ const quote = word[0];
7164
+ if ((quote === "'" || quote === '"') && word.length >= 2 && word.endsWith(quote)) {
7165
+ const inner = word.slice(1, -1);
7166
+ if (!hasLetterOrDigit(inner) || quote === '"' && inner.startsWith("$"))
7167
+ return null;
7168
+ if (inner !== inner.trim())
7169
+ return null;
7170
+ return isPlaceholderPassword(inner) ? null : inner;
7171
+ }
7172
+ if (word.startsWith("$"))
7173
+ return null;
7174
+ const core = word.replace(TRAILING_PUNCTUATION, "");
7175
+ if (!hasLetterOrDigit(core) || isPlaceholderPassword(core))
7176
+ return null;
7177
+ if (REGEX_DELIMITER.test(core))
7178
+ return null;
7179
+ return PROSE_WORDS.has(core.toLowerCase()) ? null : core;
7180
+ }
7181
+ function redactShellWord(match, head = "", word = "", tail = "") {
7182
+ return shellWordSecret(word) === null ? match : `${head}${REDACTED}${tail}`;
7183
+ }
7184
+ function redactQuotedShellWord(match, head = "", openingQuote = "", word = "", tail = "") {
7185
+ if (openingQuote !== "" && word.startsWith(openingQuote))
7186
+ return match;
7187
+ return redactShellWord(match, head, word, tail);
7188
+ }
7189
+ var SSHPASS_COMMAND = String.raw`ssh|scp|sftp|rsync|ssh-copy-id|ansible[\w-]*`;
7190
+ function redactSshpassWord(match, head = "", openingQuote = "", word = "", tail = "", command = "") {
7191
+ if (openingQuote !== "" && word.startsWith(openingQuote))
7192
+ return match;
7193
+ const secret = shellWordSecret(word);
7194
+ if (secret === null)
7195
+ return match;
7196
+ const bare = word[0] !== "'" && word[0] !== '"';
7197
+ if (bare && /^[a-z]+$/.test(secret) && command === "")
7198
+ return match;
7199
+ return `${head}${REDACTED}${tail}`;
7200
+ }
7201
+ var PATTERNS = [
7202
+ {
7203
+ kind: "bearer",
7204
+ pattern: /(\bBearer\s+)([^\s]{40,})/gi,
7205
+ replacement: redactContextValue,
7206
+ secretGroup: 2
7207
+ },
7208
+ {
7209
+ // Before openai, whose sk- shape would otherwise claim these keys.
7210
+ kind: "anthropic",
7211
+ pattern: /(?<![A-Za-z0-9_-])sk-ant-(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g,
7212
+ replacement: REDACTED
7213
+ },
7214
+ {
7215
+ kind: "openai",
7216
+ pattern: /(?<![A-Za-z0-9_-])sk-(?:proj-)?(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
7217
+ replacement: REDACTED
7218
+ },
7219
+ {
7220
+ kind: "shopify",
7221
+ pattern: /(?<![A-Za-z0-9_])shp(?:at|ss|ca)_[A-Za-z0-9]{16,}(?![A-Za-z0-9])/g,
7222
+ replacement: REDACTED
7223
+ },
7224
+ {
7225
+ kind: "aws_access_key",
7226
+ pattern: /(?<![A-Z0-9])AKIA[A-Z0-9]{16}(?![A-Z0-9])/g,
7227
+ replacement: REDACTED
7228
+ },
7229
+ {
7230
+ kind: "github",
7231
+ pattern: /(?<![A-Za-z0-9_])gh[opu]_[A-Za-z0-9]{20,}(?![A-Za-z0-9])/g,
7232
+ replacement: REDACTED
7233
+ },
7234
+ {
7235
+ kind: "slack",
7236
+ pattern: /(?<![A-Za-z0-9-])xox[abp]-(?=-*[A-Za-z0-9])[A-Za-z0-9-]{10,}(?![A-Za-z0-9-])/g,
7237
+ replacement: REDACTED
7238
+ },
7239
+ {
7240
+ kind: "sentry",
7241
+ pattern: /(?<![A-Za-z0-9_])sntry[us]_(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
7242
+ replacement: REDACTED
7243
+ },
7244
+ {
7245
+ kind: "fly",
7246
+ pattern: /(?<![A-Za-z0-9_])(?:FlyV1\s+)?fm2_(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
7247
+ replacement: REDACTED
7248
+ },
7249
+ {
7250
+ kind: "google_api_key",
7251
+ pattern: /(?<![A-Za-z0-9_-])AIza(?=[_-]*[A-Za-z0-9])[0-9A-Za-z_-]{35}(?![A-Za-z0-9_-])/g,
7252
+ replacement: REDACTED
7253
+ },
7254
+ {
7255
+ kind: "jwt",
7256
+ // header.payload.signature, both JSON segments starting eyJ. The length
7257
+ // floors keep `eyJ...` prose and signature-less examples out.
7258
+ pattern: /(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
7259
+ replacement: REDACTED
7260
+ },
7261
+ {
7262
+ kind: "mnemonik_component_token",
7263
+ // mnc_ / mncr_ + 43 base64url (oauth/components.ts); 32+ also catches a
7264
+ // partial token. The body must contain an upper-case letter or digit, so a
7265
+ // snake_case identifier is not mistaken for one; the 8-character
7266
+ // display prefix (mnc_ + 8) is too short.
7267
+ pattern: /(?<![A-Za-z0-9_])mncr?_(?=[A-Za-z0-9_-]*[A-Z0-9])[A-Za-z0-9_-]{32,}/g,
7268
+ replacement: REDACTED
7269
+ },
7270
+ {
7271
+ kind: "stripe",
7272
+ // Secret and restricted keys (sk_/rk_ live|test) and webhook signing secrets.
7273
+ pattern: /(?<![A-Za-z0-9_])(?:(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}|whsec_[A-Za-z0-9]{20,})(?![A-Za-z0-9])/g,
7274
+ replacement: REDACTED
7275
+ },
7276
+ {
7277
+ kind: "mnemonik_proxy_token",
7278
+ // pxt_ + 32 hex (the format server.ts validates). A bare prefix in prose is left.
7279
+ pattern: /(?<![A-Za-z0-9_])pxt_[0-9a-f]{32,}/g,
7280
+ replacement: REDACTED
7281
+ },
7282
+ {
7283
+ kind: "mnemonik_api_key",
7284
+ // mnk_ + 64 hex (AuthManager.generateApiKey); 32+ also catches a half key.
7285
+ // The stored 12-character key_prefix (mnk_ + 8 hex) is not a credential.
7286
+ pattern: /(?<![A-Za-z0-9_])mnk_[0-9a-f]{32,}/g,
7287
+ replacement: REDACTED
7288
+ },
7289
+ {
7290
+ kind: "mnemonik_api_key_legacy",
7291
+ // mnk_ + 43 base64url: keys minted by hand before AuthManager's hex form
7292
+ // (production's only key in 2026-10 has this shape, and one stored memory
7293
+ // held a development key in it). Authentication accepts any mnk_ bearer.
7294
+ // The body needs upper and lower case and a digit, so a snake_case
7295
+ // identifier that starts mnk_ is not taken for one.
7296
+ pattern: /(?<![A-Za-z0-9_])mnk_(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*[a-z])(?=[A-Za-z0-9_-]*[0-9])[A-Za-z0-9_-]{40,}(?![A-Za-z0-9_-])/g,
7297
+ replacement: REDACTED
7298
+ },
7299
+ {
7300
+ kind: "named_value",
7301
+ pattern: /(\b[A-Za-z_][A-Za-z0-9_]*(?:_TOKEN|_KEY|_SECRET|_PASSWORD|_PASS|APIKEY|API_KEY)\s*(?:=|:)\s*)([^\s]{16,})/gi,
7302
+ replacement: redactContextValue,
7303
+ secretGroup: 2
7304
+ },
7305
+ {
7306
+ kind: "connection_string",
7307
+ // scheme://user:password@host: only the password is replaced; scheme,
7308
+ // user, host and database stay readable. The user may be empty
7309
+ // (redis://:password@host). The password runs to the last `@` before a
7310
+ // path, query, fragment, quote or whitespace, so an unencoded `@` inside
7311
+ // it is still covered. Runs after named_value, which already replaces a
7312
+ // whole URL assigned to a secret-named variable.
7313
+ pattern: /\b((?:postgres(?:ql)?|mysql|mariadb|mongodb|rediss?|amqps?|mssql|sqlserver)(?:\+[a-z0-9]+)?:\/\/[^\s:/?#@'"`<>]{0,256}:)([^\s/?#'"`]{1,512})@/gi,
7314
+ replacement: redactUrlPassword,
7315
+ secretGroup: 2
7316
+ },
7317
+ {
7318
+ kind: "url_basic_auth",
7319
+ // https://user:password@host: same shape and placeholder rules as a
7320
+ // connection string; only the password is replaced.
7321
+ pattern: /\b(https?:\/\/[^\s:/?#@'"`<>]{0,256}:)([^\s/?#'"`]{1,512})@/gi,
7322
+ replacement: redactUrlPassword,
7323
+ secretGroup: 2
7324
+ },
7325
+ // Command-line passwords. Each keeps the command and replaces only the
7326
+ // password word; an expansion or placeholder in that position is left.
7327
+ {
7328
+ // sshpass -p <password> (also -p'<password>' and -p"<password>"), after
7329
+ // any other sshpass flags. 13 memories, 11 scanner chunks, 15 versions and
7330
+ // 6 dated facts in production held one on 2026-10-12.
7331
+ kind: "sshpass_password",
7332
+ pattern: new RegExp(String.raw`(${OPENING_QUOTE}\bsshpass(?:[ \t]+-[a-oq-zA-Z]\S*)*[ \t]+-p[ \t]*)(${SHELL_WORD})()(?=((?:[ \t]+(?:${SSHPASS_COMMAND})(?![\w-]))?))`, "g"),
7333
+ replacement: redactSshpassWord,
7334
+ secretGroup: 3,
7335
+ commandLine: true
7336
+ },
7337
+ {
7338
+ // Environment variables whose only purpose is a password, in shell
7339
+ // assignment form (no space around `=`): libpq's PGPASSWORD (one memory,
7340
+ // version and fact in production), MySQL's MYSQL_PWD, sshpass -e's
7341
+ // SSHPASS. named_value needs an `_PASSWORD`-style suffix and 16
7342
+ // characters, so it misses all three. Not an awk program that matches or
7343
+ // prints the assignment: `/^PGPASSWORD=/ { print "PGPASSWORD=" pw }`.
7344
+ kind: "password_env_var",
7345
+ pattern: new RegExp(String.raw`(${OPENING_QUOTE}\b(?:PGPASSWORD|MYSQL_PWD|SSHPASS)=)(${SHELL_WORD})()`, "g"),
7346
+ replacement: redactQuotedShellWord,
7347
+ secretGroup: 3,
7348
+ commandLine: true
7349
+ },
7350
+ {
7351
+ // --password=<value>, the long option every CLI that takes one spells
7352
+ // this way. The `=` keeps prose about the option ("--password is
7353
+ // required") out; the spaced form is not matched for that reason.
7354
+ kind: "password_option",
7355
+ pattern: new RegExp(String.raw`(${OPENING_QUOTE}(?<![\w-])--password=)(${SHELL_WORD})()`, "g"),
7356
+ replacement: redactQuotedShellWord,
7357
+ secretGroup: 3,
7358
+ commandLine: true
7359
+ },
7360
+ {
7361
+ // echo <password> | sudo -S: sudo reads the password from stdin. One
7362
+ // memory, two versions and two facts in production.
7363
+ kind: "sudo_password",
7364
+ pattern: new RegExp(String.raw`(\becho[ \t]+(?:-[neE]+[ \t]+)?)(${SHELL_WORD})([ \t]*\|[ \t]*sudo\b[^|\n]*?[ \t](?:-[A-Za-z]*S[A-Za-z]*|--stdin)\b)`, "g"),
7365
+ replacement: redactShellWord,
7366
+ secretGroup: 2,
7367
+ commandLine: true
7368
+ }
7369
+ ];
7370
+
7371
+ // packages/shared/dist/sourceRedaction.js
7372
+ init_secretPatterns();
7373
+
7113
7374
  // packages/shared/dist/codeScanner.js
7375
+ init_protectedPaths();
7376
+ init_projectIdentityFile();
7114
7377
  var MAX_SCANNED_FILE_BYTES = 10 * 1024 * 1024;
7115
7378
  var BUILT_IN_IGNORE_DIRS = [
7116
7379
  // JS / web