@mnemonik/cli 7.141.0 → 7.141.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/dist/auth/credentials.js +266 -3
- package/dist/auth/index.js +266 -3
- package/dist/auth/installSession.js +262 -0
- package/dist/auth/status.js +262 -0
- package/dist/authorizationWords.js +262 -0
- package/dist/diagnostics.js +266 -3
- package/dist/digests.json +38 -38
- package/dist/hooksLog.js +4 -0
- package/dist/identity/migrate.js +266 -3
- package/dist/install/hosts.js +262 -0
- package/dist/install/journal.js +266 -3
- package/dist/install/journey.js +266 -3
- package/dist/install/ownership.js +266 -3
- package/dist/install/transaction.js +266 -3
- package/dist/install/ui.js +266 -3
- package/dist/installSession.js +262 -0
- package/dist/installation.js +266 -3
- package/dist/launcher.js +266 -3
- package/dist/preflight.js +354 -92
- package/dist/project/eligibility.js +266 -3
- package/dist/project/records.js +266 -3
- package/dist/project.js +270 -7
- package/dist/router.js +270 -7
- package/dist/runtime/releaseSource.js +266 -3
- package/dist/runtime/selfUpdate.js +266 -3
- package/dist/runtime/signers.js +67 -7
- package/dist/runtime/store.js +4 -0
- package/dist/runtime/updateCheck.js +266 -3
- package/dist/sbom.json +21 -21
- package/dist/scanner/control.js +266 -3
- package/dist/scanner/data.js +262 -0
- package/dist/scanner/discover.js +354 -92
- package/dist/scanner/enable.js +270 -7
- package/dist/scanner/picker.js +325 -63
- package/dist/scanner/service.js +266 -3
- package/dist/scanner/update.js +266 -3
- package/dist/scanner-release.json +24 -24
- package/dist/status.js +266 -3
- package/dist/vendor/local-setup.js +266 -3
- package/package.json +31 -31
package/dist/install/journey.js
CHANGED
|
@@ -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
|
|
|
@@ -2724,9 +2728,6 @@ var MCP_INSTRUCTIONS = getMcpInstructions();
|
|
|
2724
2728
|
|
|
2725
2729
|
// packages/shared/dist/codeScanner.js
|
|
2726
2730
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
2727
|
-
init_secretPatterns();
|
|
2728
|
-
init_protectedPaths();
|
|
2729
|
-
init_projectIdentityFile();
|
|
2730
2731
|
|
|
2731
2732
|
// node_modules/web-tree-sitter/web-tree-sitter.js
|
|
2732
2733
|
var __defProp2 = Object.defineProperty;
|
|
@@ -6779,7 +6780,269 @@ var WASM_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "wasm")
|
|
|
6779
6780
|
// packages/shared/dist/ast/astChunker.js
|
|
6780
6781
|
var MAX_AST_PARSE_BYTES = 2 * 1024 * 1024;
|
|
6781
6782
|
|
|
6783
|
+
// packages/shared/dist/redactCredentials.js
|
|
6784
|
+
var REDACTED = "<redacted credential>";
|
|
6785
|
+
var MAX_PEM_BODY_LENGTH = 8 * 1024;
|
|
6786
|
+
var LETTER_OR_DIGIT = /[A-Za-z0-9]/;
|
|
6787
|
+
function hasLetterOrDigit(value) {
|
|
6788
|
+
return LETTER_OR_DIGIT.test(value);
|
|
6789
|
+
}
|
|
6790
|
+
function redactContextValue(match, head = "", value = "") {
|
|
6791
|
+
return hasLetterOrDigit(value) ? `${head}${REDACTED}` : match;
|
|
6792
|
+
}
|
|
6793
|
+
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;
|
|
6794
|
+
var PLACEHOLDER_ENV_VAR = /^\$[A-Z_][A-Z0-9_]*$/;
|
|
6795
|
+
function isPlaceholderPassword(password) {
|
|
6796
|
+
return PLACEHOLDER_PASSWORD.test(password) || PLACEHOLDER_ENV_VAR.test(password);
|
|
6797
|
+
}
|
|
6798
|
+
function redactUrlPassword(match, head = "", password = "") {
|
|
6799
|
+
return isPlaceholderPassword(password) || !hasLetterOrDigit(password) ? match : `${head}${REDACTED}@`;
|
|
6800
|
+
}
|
|
6801
|
+
var SHELL_WORD = String.raw`'[^'\n]*'|"[^"\n]*"|(?!${REDACTED})[^\s'"\`;|&()[\]{}\\,/][^\s'"\`;|&]*`;
|
|
6802
|
+
var OPENING_QUOTE = String.raw`(["'\`]?)`;
|
|
6803
|
+
var TRAILING_PUNCTUATION = /[.,:;!?)\]}]+$/;
|
|
6804
|
+
var PROSE_WORDS = /* @__PURE__ */ new Set([
|
|
6805
|
+
"a",
|
|
6806
|
+
"an",
|
|
6807
|
+
"and",
|
|
6808
|
+
"as",
|
|
6809
|
+
"for",
|
|
6810
|
+
"in",
|
|
6811
|
+
"is",
|
|
6812
|
+
"it",
|
|
6813
|
+
"on",
|
|
6814
|
+
"or",
|
|
6815
|
+
"the",
|
|
6816
|
+
"to",
|
|
6817
|
+
"with",
|
|
6818
|
+
"flag",
|
|
6819
|
+
"option",
|
|
6820
|
+
"argument",
|
|
6821
|
+
"instead",
|
|
6822
|
+
"which",
|
|
6823
|
+
"that",
|
|
6824
|
+
"this",
|
|
6825
|
+
"puts",
|
|
6826
|
+
"passes",
|
|
6827
|
+
"leaks",
|
|
6828
|
+
"exposes"
|
|
6829
|
+
]);
|
|
6830
|
+
var REGEX_DELIMITER = /\/(?:[{}()[\];]|$)/;
|
|
6831
|
+
function shellWordSecret(word) {
|
|
6832
|
+
const quote = word[0];
|
|
6833
|
+
if ((quote === "'" || quote === '"') && word.length >= 2 && word.endsWith(quote)) {
|
|
6834
|
+
const inner = word.slice(1, -1);
|
|
6835
|
+
if (!hasLetterOrDigit(inner) || quote === '"' && inner.startsWith("$"))
|
|
6836
|
+
return null;
|
|
6837
|
+
if (inner !== inner.trim())
|
|
6838
|
+
return null;
|
|
6839
|
+
return isPlaceholderPassword(inner) ? null : inner;
|
|
6840
|
+
}
|
|
6841
|
+
if (word.startsWith("$"))
|
|
6842
|
+
return null;
|
|
6843
|
+
const core = word.replace(TRAILING_PUNCTUATION, "");
|
|
6844
|
+
if (!hasLetterOrDigit(core) || isPlaceholderPassword(core))
|
|
6845
|
+
return null;
|
|
6846
|
+
if (REGEX_DELIMITER.test(core))
|
|
6847
|
+
return null;
|
|
6848
|
+
return PROSE_WORDS.has(core.toLowerCase()) ? null : core;
|
|
6849
|
+
}
|
|
6850
|
+
function redactShellWord(match, head = "", word = "", tail = "") {
|
|
6851
|
+
return shellWordSecret(word) === null ? match : `${head}${REDACTED}${tail}`;
|
|
6852
|
+
}
|
|
6853
|
+
function redactQuotedShellWord(match, head = "", openingQuote = "", word = "", tail = "") {
|
|
6854
|
+
if (openingQuote !== "" && word.startsWith(openingQuote))
|
|
6855
|
+
return match;
|
|
6856
|
+
return redactShellWord(match, head, word, tail);
|
|
6857
|
+
}
|
|
6858
|
+
var SSHPASS_COMMAND = String.raw`ssh|scp|sftp|rsync|ssh-copy-id|ansible[\w-]*`;
|
|
6859
|
+
function redactSshpassWord(match, head = "", openingQuote = "", word = "", tail = "", command = "") {
|
|
6860
|
+
if (openingQuote !== "" && word.startsWith(openingQuote))
|
|
6861
|
+
return match;
|
|
6862
|
+
const secret = shellWordSecret(word);
|
|
6863
|
+
if (secret === null)
|
|
6864
|
+
return match;
|
|
6865
|
+
const bare = word[0] !== "'" && word[0] !== '"';
|
|
6866
|
+
if (bare && /^[a-z]+$/.test(secret) && command === "")
|
|
6867
|
+
return match;
|
|
6868
|
+
return `${head}${REDACTED}${tail}`;
|
|
6869
|
+
}
|
|
6870
|
+
var PATTERNS = [
|
|
6871
|
+
{
|
|
6872
|
+
kind: "bearer",
|
|
6873
|
+
pattern: /(\bBearer\s+)([^\s]{40,})/gi,
|
|
6874
|
+
replacement: redactContextValue,
|
|
6875
|
+
secretGroup: 2
|
|
6876
|
+
},
|
|
6877
|
+
{
|
|
6878
|
+
// Before openai, whose sk- shape would otherwise claim these keys.
|
|
6879
|
+
kind: "anthropic",
|
|
6880
|
+
pattern: /(?<![A-Za-z0-9_-])sk-ant-(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g,
|
|
6881
|
+
replacement: REDACTED
|
|
6882
|
+
},
|
|
6883
|
+
{
|
|
6884
|
+
kind: "openai",
|
|
6885
|
+
pattern: /(?<![A-Za-z0-9_-])sk-(?:proj-)?(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
|
|
6886
|
+
replacement: REDACTED
|
|
6887
|
+
},
|
|
6888
|
+
{
|
|
6889
|
+
kind: "shopify",
|
|
6890
|
+
pattern: /(?<![A-Za-z0-9_])shp(?:at|ss|ca)_[A-Za-z0-9]{16,}(?![A-Za-z0-9])/g,
|
|
6891
|
+
replacement: REDACTED
|
|
6892
|
+
},
|
|
6893
|
+
{
|
|
6894
|
+
kind: "aws_access_key",
|
|
6895
|
+
pattern: /(?<![A-Z0-9])AKIA[A-Z0-9]{16}(?![A-Z0-9])/g,
|
|
6896
|
+
replacement: REDACTED
|
|
6897
|
+
},
|
|
6898
|
+
{
|
|
6899
|
+
kind: "github",
|
|
6900
|
+
pattern: /(?<![A-Za-z0-9_])gh[opu]_[A-Za-z0-9]{20,}(?![A-Za-z0-9])/g,
|
|
6901
|
+
replacement: REDACTED
|
|
6902
|
+
},
|
|
6903
|
+
{
|
|
6904
|
+
kind: "slack",
|
|
6905
|
+
pattern: /(?<![A-Za-z0-9-])xox[abp]-(?=-*[A-Za-z0-9])[A-Za-z0-9-]{10,}(?![A-Za-z0-9-])/g,
|
|
6906
|
+
replacement: REDACTED
|
|
6907
|
+
},
|
|
6908
|
+
{
|
|
6909
|
+
kind: "sentry",
|
|
6910
|
+
pattern: /(?<![A-Za-z0-9_])sntry[us]_(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
|
|
6911
|
+
replacement: REDACTED
|
|
6912
|
+
},
|
|
6913
|
+
{
|
|
6914
|
+
kind: "fly",
|
|
6915
|
+
pattern: /(?<![A-Za-z0-9_])(?:FlyV1\s+)?fm2_(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
|
|
6916
|
+
replacement: REDACTED
|
|
6917
|
+
},
|
|
6918
|
+
{
|
|
6919
|
+
kind: "google_api_key",
|
|
6920
|
+
pattern: /(?<![A-Za-z0-9_-])AIza(?=[_-]*[A-Za-z0-9])[0-9A-Za-z_-]{35}(?![A-Za-z0-9_-])/g,
|
|
6921
|
+
replacement: REDACTED
|
|
6922
|
+
},
|
|
6923
|
+
{
|
|
6924
|
+
kind: "jwt",
|
|
6925
|
+
// header.payload.signature, both JSON segments starting eyJ. The length
|
|
6926
|
+
// floors keep `eyJ...` prose and signature-less examples out.
|
|
6927
|
+
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,
|
|
6928
|
+
replacement: REDACTED
|
|
6929
|
+
},
|
|
6930
|
+
{
|
|
6931
|
+
kind: "mnemonik_component_token",
|
|
6932
|
+
// mnc_ / mncr_ + 43 base64url (oauth/components.ts); 32+ also catches a
|
|
6933
|
+
// partial token. The body must contain an upper-case letter or digit, so a
|
|
6934
|
+
// snake_case identifier is not mistaken for one; the 8-character
|
|
6935
|
+
// display prefix (mnc_ + 8) is too short.
|
|
6936
|
+
pattern: /(?<![A-Za-z0-9_])mncr?_(?=[A-Za-z0-9_-]*[A-Z0-9])[A-Za-z0-9_-]{32,}/g,
|
|
6937
|
+
replacement: REDACTED
|
|
6938
|
+
},
|
|
6939
|
+
{
|
|
6940
|
+
kind: "stripe",
|
|
6941
|
+
// Secret and restricted keys (sk_/rk_ live|test) and webhook signing secrets.
|
|
6942
|
+
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,
|
|
6943
|
+
replacement: REDACTED
|
|
6944
|
+
},
|
|
6945
|
+
{
|
|
6946
|
+
kind: "mnemonik_proxy_token",
|
|
6947
|
+
// pxt_ + 32 hex (the format server.ts validates). A bare prefix in prose is left.
|
|
6948
|
+
pattern: /(?<![A-Za-z0-9_])pxt_[0-9a-f]{32,}/g,
|
|
6949
|
+
replacement: REDACTED
|
|
6950
|
+
},
|
|
6951
|
+
{
|
|
6952
|
+
kind: "mnemonik_api_key",
|
|
6953
|
+
// mnk_ + 64 hex (AuthManager.generateApiKey); 32+ also catches a half key.
|
|
6954
|
+
// The stored 12-character key_prefix (mnk_ + 8 hex) is not a credential.
|
|
6955
|
+
pattern: /(?<![A-Za-z0-9_])mnk_[0-9a-f]{32,}/g,
|
|
6956
|
+
replacement: REDACTED
|
|
6957
|
+
},
|
|
6958
|
+
{
|
|
6959
|
+
kind: "mnemonik_api_key_legacy",
|
|
6960
|
+
// mnk_ + 43 base64url: keys minted by hand before AuthManager's hex form
|
|
6961
|
+
// (production's only key in 2026-10 has this shape, and one stored memory
|
|
6962
|
+
// held a development key in it). Authentication accepts any mnk_ bearer.
|
|
6963
|
+
// The body needs upper and lower case and a digit, so a snake_case
|
|
6964
|
+
// identifier that starts mnk_ is not taken for one.
|
|
6965
|
+
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,
|
|
6966
|
+
replacement: REDACTED
|
|
6967
|
+
},
|
|
6968
|
+
{
|
|
6969
|
+
kind: "named_value",
|
|
6970
|
+
pattern: /(\b[A-Za-z_][A-Za-z0-9_]*(?:_TOKEN|_KEY|_SECRET|_PASSWORD|_PASS|APIKEY|API_KEY)\s*(?:=|:)\s*)([^\s]{16,})/gi,
|
|
6971
|
+
replacement: redactContextValue,
|
|
6972
|
+
secretGroup: 2
|
|
6973
|
+
},
|
|
6974
|
+
{
|
|
6975
|
+
kind: "connection_string",
|
|
6976
|
+
// scheme://user:password@host: only the password is replaced; scheme,
|
|
6977
|
+
// user, host and database stay readable. The user may be empty
|
|
6978
|
+
// (redis://:password@host). The password runs to the last `@` before a
|
|
6979
|
+
// path, query, fragment, quote or whitespace, so an unencoded `@` inside
|
|
6980
|
+
// it is still covered. Runs after named_value, which already replaces a
|
|
6981
|
+
// whole URL assigned to a secret-named variable.
|
|
6982
|
+
pattern: /\b((?:postgres(?:ql)?|mysql|mariadb|mongodb|rediss?|amqps?|mssql|sqlserver)(?:\+[a-z0-9]+)?:\/\/[^\s:/?#@'"`<>]{0,256}:)([^\s/?#'"`]{1,512})@/gi,
|
|
6983
|
+
replacement: redactUrlPassword,
|
|
6984
|
+
secretGroup: 2
|
|
6985
|
+
},
|
|
6986
|
+
{
|
|
6987
|
+
kind: "url_basic_auth",
|
|
6988
|
+
// https://user:password@host: same shape and placeholder rules as a
|
|
6989
|
+
// connection string; only the password is replaced.
|
|
6990
|
+
pattern: /\b(https?:\/\/[^\s:/?#@'"`<>]{0,256}:)([^\s/?#'"`]{1,512})@/gi,
|
|
6991
|
+
replacement: redactUrlPassword,
|
|
6992
|
+
secretGroup: 2
|
|
6993
|
+
},
|
|
6994
|
+
// Command-line passwords. Each keeps the command and replaces only the
|
|
6995
|
+
// password word; an expansion or placeholder in that position is left.
|
|
6996
|
+
{
|
|
6997
|
+
// sshpass -p <password> (also -p'<password>' and -p"<password>"), after
|
|
6998
|
+
// any other sshpass flags. 13 memories, 11 scanner chunks, 15 versions and
|
|
6999
|
+
// 6 dated facts in production held one on 2026-10-12.
|
|
7000
|
+
kind: "sshpass_password",
|
|
7001
|
+
pattern: new RegExp(String.raw`(${OPENING_QUOTE}\bsshpass(?:[ \t]+-[a-oq-zA-Z]\S*)*[ \t]+-p[ \t]*)(${SHELL_WORD})()(?=((?:[ \t]+(?:${SSHPASS_COMMAND})(?![\w-]))?))`, "g"),
|
|
7002
|
+
replacement: redactSshpassWord,
|
|
7003
|
+
secretGroup: 3,
|
|
7004
|
+
commandLine: true
|
|
7005
|
+
},
|
|
7006
|
+
{
|
|
7007
|
+
// Environment variables whose only purpose is a password, in shell
|
|
7008
|
+
// assignment form (no space around `=`): libpq's PGPASSWORD (one memory,
|
|
7009
|
+
// version and fact in production), MySQL's MYSQL_PWD, sshpass -e's
|
|
7010
|
+
// SSHPASS. named_value needs an `_PASSWORD`-style suffix and 16
|
|
7011
|
+
// characters, so it misses all three. Not an awk program that matches or
|
|
7012
|
+
// prints the assignment: `/^PGPASSWORD=/ { print "PGPASSWORD=" pw }`.
|
|
7013
|
+
kind: "password_env_var",
|
|
7014
|
+
pattern: new RegExp(String.raw`(${OPENING_QUOTE}\b(?:PGPASSWORD|MYSQL_PWD|SSHPASS)=)(${SHELL_WORD})()`, "g"),
|
|
7015
|
+
replacement: redactQuotedShellWord,
|
|
7016
|
+
secretGroup: 3,
|
|
7017
|
+
commandLine: true
|
|
7018
|
+
},
|
|
7019
|
+
{
|
|
7020
|
+
// --password=<value>, the long option every CLI that takes one spells
|
|
7021
|
+
// this way. The `=` keeps prose about the option ("--password is
|
|
7022
|
+
// required") out; the spaced form is not matched for that reason.
|
|
7023
|
+
kind: "password_option",
|
|
7024
|
+
pattern: new RegExp(String.raw`(${OPENING_QUOTE}(?<![\w-])--password=)(${SHELL_WORD})()`, "g"),
|
|
7025
|
+
replacement: redactQuotedShellWord,
|
|
7026
|
+
secretGroup: 3,
|
|
7027
|
+
commandLine: true
|
|
7028
|
+
},
|
|
7029
|
+
{
|
|
7030
|
+
// echo <password> | sudo -S: sudo reads the password from stdin. One
|
|
7031
|
+
// memory, two versions and two facts in production.
|
|
7032
|
+
kind: "sudo_password",
|
|
7033
|
+
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"),
|
|
7034
|
+
replacement: redactShellWord,
|
|
7035
|
+
secretGroup: 2,
|
|
7036
|
+
commandLine: true
|
|
7037
|
+
}
|
|
7038
|
+
];
|
|
7039
|
+
|
|
7040
|
+
// packages/shared/dist/sourceRedaction.js
|
|
7041
|
+
init_secretPatterns();
|
|
7042
|
+
|
|
6782
7043
|
// packages/shared/dist/codeScanner.js
|
|
7044
|
+
init_protectedPaths();
|
|
7045
|
+
init_projectIdentityFile();
|
|
6783
7046
|
var MAX_SCANNED_FILE_BYTES = 10 * 1024 * 1024;
|
|
6784
7047
|
var BUILT_IN_IGNORE_DIRS = [
|
|
6785
7048
|
// JS / web
|
|
@@ -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
|
|
|
@@ -2725,9 +2729,6 @@ var MCP_INSTRUCTIONS = getMcpInstructions();
|
|
|
2725
2729
|
|
|
2726
2730
|
// packages/shared/dist/codeScanner.js
|
|
2727
2731
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
2728
|
-
init_secretPatterns();
|
|
2729
|
-
init_protectedPaths();
|
|
2730
|
-
init_projectIdentityFile();
|
|
2731
2732
|
|
|
2732
2733
|
// node_modules/web-tree-sitter/web-tree-sitter.js
|
|
2733
2734
|
var __defProp2 = Object.defineProperty;
|
|
@@ -6780,7 +6781,269 @@ var WASM_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "wasm")
|
|
|
6780
6781
|
// packages/shared/dist/ast/astChunker.js
|
|
6781
6782
|
var MAX_AST_PARSE_BYTES = 2 * 1024 * 1024;
|
|
6782
6783
|
|
|
6784
|
+
// packages/shared/dist/redactCredentials.js
|
|
6785
|
+
var REDACTED = "<redacted credential>";
|
|
6786
|
+
var MAX_PEM_BODY_LENGTH = 8 * 1024;
|
|
6787
|
+
var LETTER_OR_DIGIT = /[A-Za-z0-9]/;
|
|
6788
|
+
function hasLetterOrDigit(value) {
|
|
6789
|
+
return LETTER_OR_DIGIT.test(value);
|
|
6790
|
+
}
|
|
6791
|
+
function redactContextValue(match, head = "", value = "") {
|
|
6792
|
+
return hasLetterOrDigit(value) ? `${head}${REDACTED}` : match;
|
|
6793
|
+
}
|
|
6794
|
+
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;
|
|
6795
|
+
var PLACEHOLDER_ENV_VAR = /^\$[A-Z_][A-Z0-9_]*$/;
|
|
6796
|
+
function isPlaceholderPassword(password) {
|
|
6797
|
+
return PLACEHOLDER_PASSWORD.test(password) || PLACEHOLDER_ENV_VAR.test(password);
|
|
6798
|
+
}
|
|
6799
|
+
function redactUrlPassword(match, head = "", password = "") {
|
|
6800
|
+
return isPlaceholderPassword(password) || !hasLetterOrDigit(password) ? match : `${head}${REDACTED}@`;
|
|
6801
|
+
}
|
|
6802
|
+
var SHELL_WORD = String.raw`'[^'\n]*'|"[^"\n]*"|(?!${REDACTED})[^\s'"\`;|&()[\]{}\\,/][^\s'"\`;|&]*`;
|
|
6803
|
+
var OPENING_QUOTE = String.raw`(["'\`]?)`;
|
|
6804
|
+
var TRAILING_PUNCTUATION = /[.,:;!?)\]}]+$/;
|
|
6805
|
+
var PROSE_WORDS = /* @__PURE__ */ new Set([
|
|
6806
|
+
"a",
|
|
6807
|
+
"an",
|
|
6808
|
+
"and",
|
|
6809
|
+
"as",
|
|
6810
|
+
"for",
|
|
6811
|
+
"in",
|
|
6812
|
+
"is",
|
|
6813
|
+
"it",
|
|
6814
|
+
"on",
|
|
6815
|
+
"or",
|
|
6816
|
+
"the",
|
|
6817
|
+
"to",
|
|
6818
|
+
"with",
|
|
6819
|
+
"flag",
|
|
6820
|
+
"option",
|
|
6821
|
+
"argument",
|
|
6822
|
+
"instead",
|
|
6823
|
+
"which",
|
|
6824
|
+
"that",
|
|
6825
|
+
"this",
|
|
6826
|
+
"puts",
|
|
6827
|
+
"passes",
|
|
6828
|
+
"leaks",
|
|
6829
|
+
"exposes"
|
|
6830
|
+
]);
|
|
6831
|
+
var REGEX_DELIMITER = /\/(?:[{}()[\];]|$)/;
|
|
6832
|
+
function shellWordSecret(word) {
|
|
6833
|
+
const quote = word[0];
|
|
6834
|
+
if ((quote === "'" || quote === '"') && word.length >= 2 && word.endsWith(quote)) {
|
|
6835
|
+
const inner = word.slice(1, -1);
|
|
6836
|
+
if (!hasLetterOrDigit(inner) || quote === '"' && inner.startsWith("$"))
|
|
6837
|
+
return null;
|
|
6838
|
+
if (inner !== inner.trim())
|
|
6839
|
+
return null;
|
|
6840
|
+
return isPlaceholderPassword(inner) ? null : inner;
|
|
6841
|
+
}
|
|
6842
|
+
if (word.startsWith("$"))
|
|
6843
|
+
return null;
|
|
6844
|
+
const core = word.replace(TRAILING_PUNCTUATION, "");
|
|
6845
|
+
if (!hasLetterOrDigit(core) || isPlaceholderPassword(core))
|
|
6846
|
+
return null;
|
|
6847
|
+
if (REGEX_DELIMITER.test(core))
|
|
6848
|
+
return null;
|
|
6849
|
+
return PROSE_WORDS.has(core.toLowerCase()) ? null : core;
|
|
6850
|
+
}
|
|
6851
|
+
function redactShellWord(match, head = "", word = "", tail = "") {
|
|
6852
|
+
return shellWordSecret(word) === null ? match : `${head}${REDACTED}${tail}`;
|
|
6853
|
+
}
|
|
6854
|
+
function redactQuotedShellWord(match, head = "", openingQuote = "", word = "", tail = "") {
|
|
6855
|
+
if (openingQuote !== "" && word.startsWith(openingQuote))
|
|
6856
|
+
return match;
|
|
6857
|
+
return redactShellWord(match, head, word, tail);
|
|
6858
|
+
}
|
|
6859
|
+
var SSHPASS_COMMAND = String.raw`ssh|scp|sftp|rsync|ssh-copy-id|ansible[\w-]*`;
|
|
6860
|
+
function redactSshpassWord(match, head = "", openingQuote = "", word = "", tail = "", command = "") {
|
|
6861
|
+
if (openingQuote !== "" && word.startsWith(openingQuote))
|
|
6862
|
+
return match;
|
|
6863
|
+
const secret = shellWordSecret(word);
|
|
6864
|
+
if (secret === null)
|
|
6865
|
+
return match;
|
|
6866
|
+
const bare = word[0] !== "'" && word[0] !== '"';
|
|
6867
|
+
if (bare && /^[a-z]+$/.test(secret) && command === "")
|
|
6868
|
+
return match;
|
|
6869
|
+
return `${head}${REDACTED}${tail}`;
|
|
6870
|
+
}
|
|
6871
|
+
var PATTERNS = [
|
|
6872
|
+
{
|
|
6873
|
+
kind: "bearer",
|
|
6874
|
+
pattern: /(\bBearer\s+)([^\s]{40,})/gi,
|
|
6875
|
+
replacement: redactContextValue,
|
|
6876
|
+
secretGroup: 2
|
|
6877
|
+
},
|
|
6878
|
+
{
|
|
6879
|
+
// Before openai, whose sk- shape would otherwise claim these keys.
|
|
6880
|
+
kind: "anthropic",
|
|
6881
|
+
pattern: /(?<![A-Za-z0-9_-])sk-ant-(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g,
|
|
6882
|
+
replacement: REDACTED
|
|
6883
|
+
},
|
|
6884
|
+
{
|
|
6885
|
+
kind: "openai",
|
|
6886
|
+
pattern: /(?<![A-Za-z0-9_-])sk-(?:proj-)?(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
|
|
6887
|
+
replacement: REDACTED
|
|
6888
|
+
},
|
|
6889
|
+
{
|
|
6890
|
+
kind: "shopify",
|
|
6891
|
+
pattern: /(?<![A-Za-z0-9_])shp(?:at|ss|ca)_[A-Za-z0-9]{16,}(?![A-Za-z0-9])/g,
|
|
6892
|
+
replacement: REDACTED
|
|
6893
|
+
},
|
|
6894
|
+
{
|
|
6895
|
+
kind: "aws_access_key",
|
|
6896
|
+
pattern: /(?<![A-Z0-9])AKIA[A-Z0-9]{16}(?![A-Z0-9])/g,
|
|
6897
|
+
replacement: REDACTED
|
|
6898
|
+
},
|
|
6899
|
+
{
|
|
6900
|
+
kind: "github",
|
|
6901
|
+
pattern: /(?<![A-Za-z0-9_])gh[opu]_[A-Za-z0-9]{20,}(?![A-Za-z0-9])/g,
|
|
6902
|
+
replacement: REDACTED
|
|
6903
|
+
},
|
|
6904
|
+
{
|
|
6905
|
+
kind: "slack",
|
|
6906
|
+
pattern: /(?<![A-Za-z0-9-])xox[abp]-(?=-*[A-Za-z0-9])[A-Za-z0-9-]{10,}(?![A-Za-z0-9-])/g,
|
|
6907
|
+
replacement: REDACTED
|
|
6908
|
+
},
|
|
6909
|
+
{
|
|
6910
|
+
kind: "sentry",
|
|
6911
|
+
pattern: /(?<![A-Za-z0-9_])sntry[us]_(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
|
|
6912
|
+
replacement: REDACTED
|
|
6913
|
+
},
|
|
6914
|
+
{
|
|
6915
|
+
kind: "fly",
|
|
6916
|
+
pattern: /(?<![A-Za-z0-9_])(?:FlyV1\s+)?fm2_(?=[_-]*[A-Za-z0-9])[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
|
|
6917
|
+
replacement: REDACTED
|
|
6918
|
+
},
|
|
6919
|
+
{
|
|
6920
|
+
kind: "google_api_key",
|
|
6921
|
+
pattern: /(?<![A-Za-z0-9_-])AIza(?=[_-]*[A-Za-z0-9])[0-9A-Za-z_-]{35}(?![A-Za-z0-9_-])/g,
|
|
6922
|
+
replacement: REDACTED
|
|
6923
|
+
},
|
|
6924
|
+
{
|
|
6925
|
+
kind: "jwt",
|
|
6926
|
+
// header.payload.signature, both JSON segments starting eyJ. The length
|
|
6927
|
+
// floors keep `eyJ...` prose and signature-less examples out.
|
|
6928
|
+
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,
|
|
6929
|
+
replacement: REDACTED
|
|
6930
|
+
},
|
|
6931
|
+
{
|
|
6932
|
+
kind: "mnemonik_component_token",
|
|
6933
|
+
// mnc_ / mncr_ + 43 base64url (oauth/components.ts); 32+ also catches a
|
|
6934
|
+
// partial token. The body must contain an upper-case letter or digit, so a
|
|
6935
|
+
// snake_case identifier is not mistaken for one; the 8-character
|
|
6936
|
+
// display prefix (mnc_ + 8) is too short.
|
|
6937
|
+
pattern: /(?<![A-Za-z0-9_])mncr?_(?=[A-Za-z0-9_-]*[A-Z0-9])[A-Za-z0-9_-]{32,}/g,
|
|
6938
|
+
replacement: REDACTED
|
|
6939
|
+
},
|
|
6940
|
+
{
|
|
6941
|
+
kind: "stripe",
|
|
6942
|
+
// Secret and restricted keys (sk_/rk_ live|test) and webhook signing secrets.
|
|
6943
|
+
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,
|
|
6944
|
+
replacement: REDACTED
|
|
6945
|
+
},
|
|
6946
|
+
{
|
|
6947
|
+
kind: "mnemonik_proxy_token",
|
|
6948
|
+
// pxt_ + 32 hex (the format server.ts validates). A bare prefix in prose is left.
|
|
6949
|
+
pattern: /(?<![A-Za-z0-9_])pxt_[0-9a-f]{32,}/g,
|
|
6950
|
+
replacement: REDACTED
|
|
6951
|
+
},
|
|
6952
|
+
{
|
|
6953
|
+
kind: "mnemonik_api_key",
|
|
6954
|
+
// mnk_ + 64 hex (AuthManager.generateApiKey); 32+ also catches a half key.
|
|
6955
|
+
// The stored 12-character key_prefix (mnk_ + 8 hex) is not a credential.
|
|
6956
|
+
pattern: /(?<![A-Za-z0-9_])mnk_[0-9a-f]{32,}/g,
|
|
6957
|
+
replacement: REDACTED
|
|
6958
|
+
},
|
|
6959
|
+
{
|
|
6960
|
+
kind: "mnemonik_api_key_legacy",
|
|
6961
|
+
// mnk_ + 43 base64url: keys minted by hand before AuthManager's hex form
|
|
6962
|
+
// (production's only key in 2026-10 has this shape, and one stored memory
|
|
6963
|
+
// held a development key in it). Authentication accepts any mnk_ bearer.
|
|
6964
|
+
// The body needs upper and lower case and a digit, so a snake_case
|
|
6965
|
+
// identifier that starts mnk_ is not taken for one.
|
|
6966
|
+
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,
|
|
6967
|
+
replacement: REDACTED
|
|
6968
|
+
},
|
|
6969
|
+
{
|
|
6970
|
+
kind: "named_value",
|
|
6971
|
+
pattern: /(\b[A-Za-z_][A-Za-z0-9_]*(?:_TOKEN|_KEY|_SECRET|_PASSWORD|_PASS|APIKEY|API_KEY)\s*(?:=|:)\s*)([^\s]{16,})/gi,
|
|
6972
|
+
replacement: redactContextValue,
|
|
6973
|
+
secretGroup: 2
|
|
6974
|
+
},
|
|
6975
|
+
{
|
|
6976
|
+
kind: "connection_string",
|
|
6977
|
+
// scheme://user:password@host: only the password is replaced; scheme,
|
|
6978
|
+
// user, host and database stay readable. The user may be empty
|
|
6979
|
+
// (redis://:password@host). The password runs to the last `@` before a
|
|
6980
|
+
// path, query, fragment, quote or whitespace, so an unencoded `@` inside
|
|
6981
|
+
// it is still covered. Runs after named_value, which already replaces a
|
|
6982
|
+
// whole URL assigned to a secret-named variable.
|
|
6983
|
+
pattern: /\b((?:postgres(?:ql)?|mysql|mariadb|mongodb|rediss?|amqps?|mssql|sqlserver)(?:\+[a-z0-9]+)?:\/\/[^\s:/?#@'"`<>]{0,256}:)([^\s/?#'"`]{1,512})@/gi,
|
|
6984
|
+
replacement: redactUrlPassword,
|
|
6985
|
+
secretGroup: 2
|
|
6986
|
+
},
|
|
6987
|
+
{
|
|
6988
|
+
kind: "url_basic_auth",
|
|
6989
|
+
// https://user:password@host: same shape and placeholder rules as a
|
|
6990
|
+
// connection string; only the password is replaced.
|
|
6991
|
+
pattern: /\b(https?:\/\/[^\s:/?#@'"`<>]{0,256}:)([^\s/?#'"`]{1,512})@/gi,
|
|
6992
|
+
replacement: redactUrlPassword,
|
|
6993
|
+
secretGroup: 2
|
|
6994
|
+
},
|
|
6995
|
+
// Command-line passwords. Each keeps the command and replaces only the
|
|
6996
|
+
// password word; an expansion or placeholder in that position is left.
|
|
6997
|
+
{
|
|
6998
|
+
// sshpass -p <password> (also -p'<password>' and -p"<password>"), after
|
|
6999
|
+
// any other sshpass flags. 13 memories, 11 scanner chunks, 15 versions and
|
|
7000
|
+
// 6 dated facts in production held one on 2026-10-12.
|
|
7001
|
+
kind: "sshpass_password",
|
|
7002
|
+
pattern: new RegExp(String.raw`(${OPENING_QUOTE}\bsshpass(?:[ \t]+-[a-oq-zA-Z]\S*)*[ \t]+-p[ \t]*)(${SHELL_WORD})()(?=((?:[ \t]+(?:${SSHPASS_COMMAND})(?![\w-]))?))`, "g"),
|
|
7003
|
+
replacement: redactSshpassWord,
|
|
7004
|
+
secretGroup: 3,
|
|
7005
|
+
commandLine: true
|
|
7006
|
+
},
|
|
7007
|
+
{
|
|
7008
|
+
// Environment variables whose only purpose is a password, in shell
|
|
7009
|
+
// assignment form (no space around `=`): libpq's PGPASSWORD (one memory,
|
|
7010
|
+
// version and fact in production), MySQL's MYSQL_PWD, sshpass -e's
|
|
7011
|
+
// SSHPASS. named_value needs an `_PASSWORD`-style suffix and 16
|
|
7012
|
+
// characters, so it misses all three. Not an awk program that matches or
|
|
7013
|
+
// prints the assignment: `/^PGPASSWORD=/ { print "PGPASSWORD=" pw }`.
|
|
7014
|
+
kind: "password_env_var",
|
|
7015
|
+
pattern: new RegExp(String.raw`(${OPENING_QUOTE}\b(?:PGPASSWORD|MYSQL_PWD|SSHPASS)=)(${SHELL_WORD})()`, "g"),
|
|
7016
|
+
replacement: redactQuotedShellWord,
|
|
7017
|
+
secretGroup: 3,
|
|
7018
|
+
commandLine: true
|
|
7019
|
+
},
|
|
7020
|
+
{
|
|
7021
|
+
// --password=<value>, the long option every CLI that takes one spells
|
|
7022
|
+
// this way. The `=` keeps prose about the option ("--password is
|
|
7023
|
+
// required") out; the spaced form is not matched for that reason.
|
|
7024
|
+
kind: "password_option",
|
|
7025
|
+
pattern: new RegExp(String.raw`(${OPENING_QUOTE}(?<![\w-])--password=)(${SHELL_WORD})()`, "g"),
|
|
7026
|
+
replacement: redactQuotedShellWord,
|
|
7027
|
+
secretGroup: 3,
|
|
7028
|
+
commandLine: true
|
|
7029
|
+
},
|
|
7030
|
+
{
|
|
7031
|
+
// echo <password> | sudo -S: sudo reads the password from stdin. One
|
|
7032
|
+
// memory, two versions and two facts in production.
|
|
7033
|
+
kind: "sudo_password",
|
|
7034
|
+
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"),
|
|
7035
|
+
replacement: redactShellWord,
|
|
7036
|
+
secretGroup: 2,
|
|
7037
|
+
commandLine: true
|
|
7038
|
+
}
|
|
7039
|
+
];
|
|
7040
|
+
|
|
7041
|
+
// packages/shared/dist/sourceRedaction.js
|
|
7042
|
+
init_secretPatterns();
|
|
7043
|
+
|
|
6783
7044
|
// packages/shared/dist/codeScanner.js
|
|
7045
|
+
init_protectedPaths();
|
|
7046
|
+
init_projectIdentityFile();
|
|
6784
7047
|
var MAX_SCANNED_FILE_BYTES = 10 * 1024 * 1024;
|
|
6785
7048
|
var BUILT_IN_IGNORE_DIRS = [
|
|
6786
7049
|
// JS / web
|