@pinta-ai/mcp-logger 0.4.0 → 0.4.2-dev.1010
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 +12 -0
- package/dist/cli/index.js +1 -1
- package/node_modules/@pinta-ai/core/README.md +180 -0
- package/node_modules/@pinta-ai/core/dist/atomic-write.d.ts +9 -0
- package/node_modules/@pinta-ai/core/dist/atomic-write.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/atomic-write.js +20 -0
- package/node_modules/@pinta-ai/core/dist/atomic-write.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/credential-semantics.d.ts +20 -0
- package/node_modules/@pinta-ai/core/dist/credential-semantics.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/credential-semantics.js +156 -0
- package/node_modules/@pinta-ai/core/dist/credential-semantics.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/env-file.d.ts +17 -0
- package/node_modules/@pinta-ai/core/dist/env-file.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/env-file.js +81 -0
- package/node_modules/@pinta-ai/core/dist/env-file.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/export-mask.d.ts +26 -0
- package/node_modules/@pinta-ai/core/dist/export-mask.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/export-mask.js +202 -0
- package/node_modules/@pinta-ai/core/dist/export-mask.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/guard.d.ts +196 -0
- package/node_modules/@pinta-ai/core/dist/guard.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/guard.js +275 -0
- package/node_modules/@pinta-ai/core/dist/guard.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/index.d.ts +23 -0
- package/node_modules/@pinta-ai/core/dist/index.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/index.js +85 -0
- package/node_modules/@pinta-ai/core/dist/index.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/json-text.d.ts +45 -0
- package/node_modules/@pinta-ai/core/dist/json-text.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/json-text.js +116 -0
- package/node_modules/@pinta-ai/core/dist/json-text.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/lifecycle.d.ts +143 -0
- package/node_modules/@pinta-ai/core/dist/lifecycle.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/lifecycle.js +20 -0
- package/node_modules/@pinta-ai/core/dist/lifecycle.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/matches.d.ts +24 -0
- package/node_modules/@pinta-ai/core/dist/matches.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/matches.js +39 -0
- package/node_modules/@pinta-ai/core/dist/matches.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/mysql-password.d.ts +15 -0
- package/node_modules/@pinta-ai/core/dist/mysql-password.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/mysql-password.js +375 -0
- package/node_modules/@pinta-ai/core/dist/mysql-password.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/otlp-types.d.ts +41 -0
- package/node_modules/@pinta-ai/core/dist/otlp-types.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/otlp-types.js +7 -0
- package/node_modules/@pinta-ai/core/dist/otlp-types.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/otlp.d.ts +142 -0
- package/node_modules/@pinta-ai/core/dist/otlp.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/otlp.js +638 -0
- package/node_modules/@pinta-ai/core/dist/otlp.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/output-denial.d.ts +69 -0
- package/node_modules/@pinta-ai/core/dist/output-denial.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/output-denial.js +105 -0
- package/node_modules/@pinta-ai/core/dist/output-denial.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/redact.d.ts +65 -0
- package/node_modules/@pinta-ai/core/dist/redact.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/redact.js +193 -0
- package/node_modules/@pinta-ai/core/dist/redact.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/retry-queue.d.ts +47 -0
- package/node_modules/@pinta-ai/core/dist/retry-queue.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/retry-queue.js +177 -0
- package/node_modules/@pinta-ai/core/dist/retry-queue.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/secret-shapes.d.ts +47 -0
- package/node_modules/@pinta-ai/core/dist/secret-shapes.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/secret-shapes.js +377 -0
- package/node_modules/@pinta-ai/core/dist/secret-shapes.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/session-trace.d.ts +50 -0
- package/node_modules/@pinta-ai/core/dist/session-trace.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/session-trace.js +103 -0
- package/node_modules/@pinta-ai/core/dist/session-trace.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/shape-rules.d.ts +117 -0
- package/node_modules/@pinta-ai/core/dist/shape-rules.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/shape-rules.js +592 -0
- package/node_modules/@pinta-ai/core/dist/shape-rules.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/trace.d.ts +17 -0
- package/node_modules/@pinta-ai/core/dist/trace.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/trace.js +78 -0
- package/node_modules/@pinta-ai/core/dist/trace.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/transport.d.ts +75 -0
- package/node_modules/@pinta-ai/core/dist/transport.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/transport.js +260 -0
- package/node_modules/@pinta-ai/core/dist/transport.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/value-copies.d.ts +46 -0
- package/node_modules/@pinta-ai/core/dist/value-copies.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/value-copies.js +279 -0
- package/node_modules/@pinta-ai/core/dist/value-copies.js.map +1 -0
- package/node_modules/@pinta-ai/core/dist/value-masking.d.ts +22 -0
- package/node_modules/@pinta-ai/core/dist/value-masking.d.ts.map +1 -0
- package/node_modules/@pinta-ai/core/dist/value-masking.js +243 -0
- package/node_modules/@pinta-ai/core/dist/value-masking.js.map +1 -0
- package/node_modules/@pinta-ai/core/package.json +50 -0
- package/package.json +3 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inspectCredentialSemantics = inspectCredentialSemantics;
|
|
4
|
+
const acorn_1 = require("acorn");
|
|
5
|
+
const MAX_SOURCE = 64_000;
|
|
6
|
+
const MAX_NODES = 8_000;
|
|
7
|
+
const MAX_DEPTH = 64;
|
|
8
|
+
const GLOBALS = new Set(["window", "globalThis", "self", "global"]);
|
|
9
|
+
const MODES = new Set(["omit", "same-origin", "include"]);
|
|
10
|
+
const REFLECTIVE_MEMBERS = new Set(["constructor", "prototype", "__proto__", "eval", "Function"]);
|
|
11
|
+
function isNode(value) {
|
|
12
|
+
return value !== null && typeof value === "object" &&
|
|
13
|
+
"type" in value && typeof value.type === "string" &&
|
|
14
|
+
"start" in value && typeof value.start === "number" &&
|
|
15
|
+
"end" in value && typeof value.end === "number";
|
|
16
|
+
}
|
|
17
|
+
function isPropertyName(node, parent) {
|
|
18
|
+
return (parent?.type === "MemberExpression" && parent.property === node && !parent.computed) ||
|
|
19
|
+
(parent?.type === "Property" && parent.key === node && !parent.computed && !parent.shorthand);
|
|
20
|
+
}
|
|
21
|
+
function nativeFetch(node) {
|
|
22
|
+
return node.type === "Identifier" ? node.name === "fetch" :
|
|
23
|
+
node.type === "MemberExpression" && !node.computed && !node.optional &&
|
|
24
|
+
node.object.type === "Identifier" && GLOBALS.has(node.object.name) &&
|
|
25
|
+
node.property.type === "Identifier" && node.property.name === "fetch";
|
|
26
|
+
}
|
|
27
|
+
function memberName(node) {
|
|
28
|
+
if (node.type !== "MemberExpression")
|
|
29
|
+
return null;
|
|
30
|
+
return !node.computed && node.property.type === "Identifier" ? node.property.name :
|
|
31
|
+
node.computed && node.property.type === "Literal" && typeof node.property.value === "string"
|
|
32
|
+
? node.property.value : null;
|
|
33
|
+
}
|
|
34
|
+
function writesFetchBinding(node) {
|
|
35
|
+
let target = node.type === "AssignmentExpression" ? node.left :
|
|
36
|
+
node.type === "UpdateExpression" || (node.type === "UnaryExpression" && node.operator === "delete")
|
|
37
|
+
? node.argument : null;
|
|
38
|
+
let member = false;
|
|
39
|
+
let affected = false;
|
|
40
|
+
while (target?.type === "MemberExpression") {
|
|
41
|
+
const name = memberName(target);
|
|
42
|
+
member = true;
|
|
43
|
+
affected ||= target.computed || name === null || name === "fetch" ||
|
|
44
|
+
GLOBALS.has(name) || REFLECTIVE_MEMBERS.has(name);
|
|
45
|
+
target = target.object;
|
|
46
|
+
}
|
|
47
|
+
return target?.type === "Identifier" && GLOBALS.has(target.name) && (!member || affected);
|
|
48
|
+
}
|
|
49
|
+
function credentialProperty(call) {
|
|
50
|
+
if (call.optional || !nativeFetch(call.callee) || call.arguments.length !== 2)
|
|
51
|
+
return null;
|
|
52
|
+
const options = call.arguments[1];
|
|
53
|
+
if (options?.type !== "ObjectExpression")
|
|
54
|
+
return null;
|
|
55
|
+
let result = null;
|
|
56
|
+
for (const property of options.properties) {
|
|
57
|
+
if (property.type !== "Property" || property.computed || property.kind !== "init" ||
|
|
58
|
+
property.method || property.shorthand)
|
|
59
|
+
return null;
|
|
60
|
+
const name = property.key.type === "Identifier" ? property.key.name :
|
|
61
|
+
property.key.type === "Literal" ? property.key.value : undefined;
|
|
62
|
+
if (name !== "credentials")
|
|
63
|
+
continue;
|
|
64
|
+
if (result)
|
|
65
|
+
return null;
|
|
66
|
+
result = property;
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Syntax/binding evidence only: this does not attest the ambient browser or
|
|
72
|
+
* recover a protected value. A producer may exclude only observed standard
|
|
73
|
+
* modes; retrospective review must keep `protected` distinct from those modes.
|
|
74
|
+
*/
|
|
75
|
+
function inspectCredentialSemantics(source) {
|
|
76
|
+
const result = (status, options = []) => ({ contractVersion: 1, status, options });
|
|
77
|
+
if (source.length > MAX_SOURCE)
|
|
78
|
+
return result("source_limit");
|
|
79
|
+
if (/\[TRUNCATED(?::|\])/.test(source))
|
|
80
|
+
return result("source_limit");
|
|
81
|
+
let root;
|
|
82
|
+
try {
|
|
83
|
+
root = (0, acorn_1.parse)(source, {
|
|
84
|
+
ecmaVersion: 2022,
|
|
85
|
+
sourceType: "module",
|
|
86
|
+
allowAwaitOutsideFunction: true,
|
|
87
|
+
allowReturnOutsideFunction: true,
|
|
88
|
+
locations: true,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (error instanceof SyntaxError)
|
|
93
|
+
return result("invalid_syntax");
|
|
94
|
+
if (error instanceof RangeError)
|
|
95
|
+
return result("source_limit");
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
const stack = [{ node: root, parent: null, depth: 0 }];
|
|
99
|
+
const calls = [];
|
|
100
|
+
let visited = 0;
|
|
101
|
+
while (stack.length) {
|
|
102
|
+
const { node, parent, depth } = stack.pop();
|
|
103
|
+
if (++visited > MAX_NODES || depth > MAX_DEPTH)
|
|
104
|
+
return result("source_limit");
|
|
105
|
+
if (node.type === "ThisExpression" || node.type === "WithStatement" || node.type === "ImportDeclaration" ||
|
|
106
|
+
node.type === "ImportExpression" || writesFetchBinding(node))
|
|
107
|
+
return result("unresolved_binding");
|
|
108
|
+
if (node.type === "Identifier" && !isPropertyName(node, parent)) {
|
|
109
|
+
if (node.name === "eval" || node.name === "Function")
|
|
110
|
+
return result("unresolved_binding");
|
|
111
|
+
if (node.name === "fetch" &&
|
|
112
|
+
!(parent?.type === "CallExpression" && parent.callee === node && !parent.optional))
|
|
113
|
+
return result("unresolved_binding");
|
|
114
|
+
// Passing/aliasing the global object, declaring it, or using a computed
|
|
115
|
+
// member can change the consumer; do not prove a role through that gap.
|
|
116
|
+
if (GLOBALS.has(node.name) &&
|
|
117
|
+
!(parent?.type === "MemberExpression" && parent.object === node && !parent.computed))
|
|
118
|
+
return result("unresolved_binding");
|
|
119
|
+
}
|
|
120
|
+
if (node.type === "MemberExpression" && nativeFetch(node) &&
|
|
121
|
+
!(parent?.type === "CallExpression" && parent.callee === node && !parent.optional))
|
|
122
|
+
return result("unresolved_binding");
|
|
123
|
+
const name = memberName(node);
|
|
124
|
+
if (node.type === "MemberExpression" && name !== null && (REFLECTIVE_MEMBERS.has(name) ||
|
|
125
|
+
(GLOBALS.has(name) && node.object.type === "Identifier" && GLOBALS.has(node.object.name))))
|
|
126
|
+
return result("unresolved_binding");
|
|
127
|
+
if (node.type === "CallExpression")
|
|
128
|
+
calls.push(node);
|
|
129
|
+
for (const value of Object.values(node)) {
|
|
130
|
+
if (isNode(value))
|
|
131
|
+
stack.push({ node: value, parent: node, depth: depth + 1 });
|
|
132
|
+
else if (Array.isArray(value)) {
|
|
133
|
+
for (const child of value)
|
|
134
|
+
if (isNode(child))
|
|
135
|
+
stack.push({ node: child, parent: node, depth: depth + 1 });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const options = [];
|
|
140
|
+
for (const call of calls) {
|
|
141
|
+
const property = credentialProperty(call);
|
|
142
|
+
const value = property?.value;
|
|
143
|
+
if (value?.type !== "Literal" || typeof value.value !== "string")
|
|
144
|
+
continue;
|
|
145
|
+
options.push({
|
|
146
|
+
start: value.start + 1,
|
|
147
|
+
end: value.end - 1,
|
|
148
|
+
line: value.loc.start.line,
|
|
149
|
+
role: "fetch_credentials_option",
|
|
150
|
+
valueEvidence: MODES.has(value.value) ? "standard_mode" :
|
|
151
|
+
value.value === "[REDACTED:credential_field]" ? "protected" : "other",
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return result("complete", options.sort((a, b) => a.start - b.start));
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=credential-semantics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-semantics.js","sourceRoot":"","sources":["../src/credential-semantics.ts"],"names":[],"mappings":";;AAwFA,gEAsEC;AA9JD,iCAAgF;AAiBhF,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1B,MAAM,SAAS,GAAG,KAAK,CAAC;AACxB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC;AAC1D,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAElG,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAChD,MAAM,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QACjD,OAAO,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QACnD,KAAK,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC;AACpD,CAAC;AAED,SAAS,cAAc,CAAC,IAAa,EAAE,MAAsB;IAC3D,OAAO,CAAC,MAAM,EAAE,IAAI,KAAK,kBAAkB,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC1F,CAAC,MAAM,EAAE,IAAI,KAAK,UAAU,IAAI,MAAM,CAAC,GAAG,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
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the env-file path. By default it is `~/<dir>/<filename>` (e.g.
|
|
3
|
+
* `.claude` + `pinta-cc.env`). If `overrideEnvVar` is given and that env var is
|
|
4
|
+
* set, its value is used as the base directory instead of `~/<dir>` — this lets
|
|
5
|
+
* adapters honor a host-specific override like `$COPILOT_HOME`, `$GEMINI_HOME`,
|
|
6
|
+
* or `$OPENCODE_CONFIG_DIR`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function envFilePath(dir: string, filename: string, overrideEnvVar?: string): string;
|
|
9
|
+
export declare function parseEnvFile(content: string): Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Load the env file at `filePath` (if it exists) and merge any keys NOT already
|
|
12
|
+
* set into `process.env`. Returns silently on missing file or any read/parse
|
|
13
|
+
* error — this is startup-time best-effort and must not break the adapter when
|
|
14
|
+
* the manager still injects env via a shell prefix.
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadEnvFile(filePath: string): void;
|
|
17
|
+
//# sourceMappingURL=env-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-file.d.ts","sourceRoot":"","sources":["../src/env-file.ts"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,CAIR;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkBpE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAalD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.envFilePath = envFilePath;
|
|
7
|
+
exports.parseEnvFile = parseEnvFile;
|
|
8
|
+
exports.loadEnvFile = loadEnvFile;
|
|
9
|
+
/**
|
|
10
|
+
* Graceful env-file loader, shared by all Pinta adapters.
|
|
11
|
+
*
|
|
12
|
+
* Pinta Manager writes `~/<dir>/<name>.env` (KEY=VALUE per line) instead of
|
|
13
|
+
* prefixing the hook command with a POSIX shell env prefix (`KEY='val' node …`),
|
|
14
|
+
* which is broken on native Windows shells (cmd.exe / PowerShell). Each adapter
|
|
15
|
+
* supplies its own directory + filename (e.g. ".claude" + "pinta-cc.env",
|
|
16
|
+
* ".gemini" + "pinta-gemini.env").
|
|
17
|
+
*
|
|
18
|
+
* Parser format:
|
|
19
|
+
* - `KEY=VALUE` per line
|
|
20
|
+
* - Blank lines and lines starting with `#` are ignored
|
|
21
|
+
* - Lines without `=` are skipped (no throw)
|
|
22
|
+
* - Surrounding single/double quotes on the value are stripped
|
|
23
|
+
* - No escape handling — the manager guarantees tokens don't contain `=` or newline
|
|
24
|
+
*/
|
|
25
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
26
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
27
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
28
|
+
/**
|
|
29
|
+
* Build the env-file path. By default it is `~/<dir>/<filename>` (e.g.
|
|
30
|
+
* `.claude` + `pinta-cc.env`). If `overrideEnvVar` is given and that env var is
|
|
31
|
+
* set, its value is used as the base directory instead of `~/<dir>` — this lets
|
|
32
|
+
* adapters honor a host-specific override like `$COPILOT_HOME`, `$GEMINI_HOME`,
|
|
33
|
+
* or `$OPENCODE_CONFIG_DIR`.
|
|
34
|
+
*/
|
|
35
|
+
function envFilePath(dir, filename, overrideEnvVar) {
|
|
36
|
+
const override = overrideEnvVar ? process.env[overrideEnvVar] : undefined;
|
|
37
|
+
const base = override && override.length > 0 ? override : node_path_1.default.join(node_os_1.default.homedir(), dir);
|
|
38
|
+
return node_path_1.default.join(base, filename);
|
|
39
|
+
}
|
|
40
|
+
function parseEnvFile(content) {
|
|
41
|
+
const out = {};
|
|
42
|
+
for (const raw of content.split("\n")) {
|
|
43
|
+
const line = raw.trim();
|
|
44
|
+
if (!line || line.startsWith("#"))
|
|
45
|
+
continue;
|
|
46
|
+
const idx = line.indexOf("=");
|
|
47
|
+
if (idx < 0)
|
|
48
|
+
continue;
|
|
49
|
+
const key = line.slice(0, idx).trim();
|
|
50
|
+
let value = line.slice(idx + 1).trim();
|
|
51
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
52
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
53
|
+
value = value.slice(1, -1);
|
|
54
|
+
}
|
|
55
|
+
if (key)
|
|
56
|
+
out[key] = value;
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Load the env file at `filePath` (if it exists) and merge any keys NOT already
|
|
62
|
+
* set into `process.env`. Returns silently on missing file or any read/parse
|
|
63
|
+
* error — this is startup-time best-effort and must not break the adapter when
|
|
64
|
+
* the manager still injects env via a shell prefix.
|
|
65
|
+
*/
|
|
66
|
+
function loadEnvFile(filePath) {
|
|
67
|
+
let content;
|
|
68
|
+
try {
|
|
69
|
+
content = node_fs_1.default.readFileSync(filePath, "utf-8");
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return; // missing/unreadable — silent no-op
|
|
73
|
+
}
|
|
74
|
+
const parsed = parseEnvFile(content);
|
|
75
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
76
|
+
if (process.env[key] === undefined) {
|
|
77
|
+
process.env[key] = value;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=env-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-file.js","sourceRoot":"","sources":["../src/env-file.ts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I,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC9C,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAC9C,CAAC;YACD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,GAAG;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC5B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,QAAgB;IAC1C,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,iBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,oCAAoC;IAC9C,CAAC;IACD,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC3B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type DetectedValue, type Match } from "./matches.js";
|
|
2
|
+
/** New-shape values shorter than this are masked at their own place only, never as a literal everywhere. */
|
|
3
|
+
export declare const MIN_COPY_LENGTH = 8;
|
|
4
|
+
export interface ShapeValue extends DetectedValue {
|
|
5
|
+
/** The value is long enough to be masked as a literal copy elsewhere. */
|
|
6
|
+
copy: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ExportScan {
|
|
9
|
+
/** Ranges of the new shapes, replaced at their own place. */
|
|
10
|
+
placed: Match[];
|
|
11
|
+
/**
|
|
12
|
+
* Places main found in the text as written (the part of a value main's own text could not replace). The caller
|
|
13
|
+
* keeps one only if the guard text did not already replace a part of it: a range main replaced stays as main has it (⑤).
|
|
14
|
+
*/
|
|
15
|
+
own: Match[];
|
|
16
|
+
/** The values of the new shapes, for copies elsewhere and for the findings. */
|
|
17
|
+
values: ShapeValue[];
|
|
18
|
+
}
|
|
19
|
+
export declare const NO_EXPORT_SCAN: ExportScan;
|
|
20
|
+
/**
|
|
21
|
+
* Read one attribute text. `main` are the matches `collectMatches` found in it
|
|
22
|
+
* (the text as written, or the JSON text of an object); `json` says the text is
|
|
23
|
+
* JSON (known when the caller serialized an object).
|
|
24
|
+
*/
|
|
25
|
+
export declare function scanExport(raw: string, main: readonly Match[], json: boolean, context: "bash" | undefined): ExportScan;
|
|
26
|
+
//# sourceMappingURL=export-mask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-mask.d.ts","sourceRoot":"","sources":["../src/export-mask.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAmB,KAAK,aAAa,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAK/E,4GAA4G;AAC5G,eAAO,MAAM,eAAe,IAAI,CAAC;AAMjC,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,yEAAyE;IACzE,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB;;;OAGG;IACH,GAAG,EAAE,KAAK,EAAE,CAAC;IACb,+EAA+E;IAC/E,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,eAAO,MAAM,cAAc,EAAE,UAAgD,CAAC;AA+B9E;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAwEtH"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NO_EXPORT_SCAN = exports.MIN_COPY_LENGTH = void 0;
|
|
4
|
+
exports.scanExport = scanExport;
|
|
5
|
+
/**
|
|
6
|
+
* What the stored span masks beyond what main masks (PTA-735, design contract
|
|
7
|
+
* 4, "내보낼 벌").
|
|
8
|
+
*
|
|
9
|
+
* The stored span is the original text with ranges replaced, and only the ranges
|
|
10
|
+
* of values change. For one attribute text this module finds
|
|
11
|
+
*
|
|
12
|
+
* - the three new shapes (`secret-shapes.ts`), read from the decoded strings of
|
|
13
|
+
* a JSON text so a line start is a line start and a quote is a quote, then
|
|
14
|
+
* mapped back to the exact characters of the text as written, and
|
|
15
|
+
* - the places main found in the text as written: main's masker reads the
|
|
16
|
+
* decoded strings, so a value main found with an escape inside it, or the
|
|
17
|
+
* rest of a value it replaced in part, is never replaced there. Those places
|
|
18
|
+
* are replaced at their own place (shrunk to whole escapes, within one string).
|
|
19
|
+
*
|
|
20
|
+
* The values of the new shapes (8 characters or more) are also looked for as
|
|
21
|
+
* literal copies by the caller (`createCopyEditor`), after each copy's place
|
|
22
|
+
* passes the same checks.
|
|
23
|
+
*/
|
|
24
|
+
const mysql_password_js_1 = require("./mysql-password.js");
|
|
25
|
+
const matches_js_1 = require("./matches.js");
|
|
26
|
+
const json_text_js_1 = require("./json-text.js");
|
|
27
|
+
const secret_shapes_js_1 = require("./secret-shapes.js");
|
|
28
|
+
const shape_rules_js_1 = require("./shape-rules.js");
|
|
29
|
+
/** New-shape values shorter than this are masked at their own place only, never as a literal everywhere. */
|
|
30
|
+
exports.MIN_COPY_LENGTH = 8;
|
|
31
|
+
/** A string can hold one of the new shapes only if it names a credential. */
|
|
32
|
+
const SHAPE_HINT = /pass|pwd|secret|token|key|auth|cred|bearer|basic/i;
|
|
33
|
+
const MYSQL_HINT = /mysql|mariadb/i;
|
|
34
|
+
exports.NO_EXPORT_SCAN = { placed: [], own: [], values: [] };
|
|
35
|
+
/** Merged, sorted ranges and a question: does `[s, e)` lie inside none, part, or all of them? */
|
|
36
|
+
function overlapOf(ranges) {
|
|
37
|
+
const merged = (0, matches_js_1.resolveOverlaps)(ranges.map((r) => ({ ...r })));
|
|
38
|
+
return (start, end) => {
|
|
39
|
+
let lo = 0;
|
|
40
|
+
let hi = merged.length - 1;
|
|
41
|
+
let at = -1;
|
|
42
|
+
while (lo <= hi) {
|
|
43
|
+
const mid = (lo + hi) >> 1;
|
|
44
|
+
if (merged[mid].replaceStart < end) {
|
|
45
|
+
at = mid;
|
|
46
|
+
lo = mid + 1;
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
hi = mid - 1;
|
|
50
|
+
}
|
|
51
|
+
// Merged ranges are disjoint and sorted: walk back over those that can reach `start`.
|
|
52
|
+
let covered = 0;
|
|
53
|
+
for (let i = at; i >= 0 && merged[i].replaceEnd > start; i--) {
|
|
54
|
+
covered += Math.min(end, merged[i].replaceEnd) - Math.max(start, merged[i].replaceStart);
|
|
55
|
+
}
|
|
56
|
+
if (covered <= 0)
|
|
57
|
+
return "none";
|
|
58
|
+
return covered >= end - start ? "all" : "part";
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Read one attribute text. `main` are the matches `collectMatches` found in it
|
|
63
|
+
* (the text as written, or the JSON text of an object); `json` says the text is
|
|
64
|
+
* JSON (known when the caller serialized an object).
|
|
65
|
+
*/
|
|
66
|
+
function scanExport(raw, main, json, context) {
|
|
67
|
+
const placed = [];
|
|
68
|
+
const own = [];
|
|
69
|
+
const values = [];
|
|
70
|
+
const real = main.filter((m) => !m.fake && m.replaceEnd > m.replaceStart);
|
|
71
|
+
const mainCover = overlapOf(main.filter((m) => !m.fake));
|
|
72
|
+
const keep = (start, end, value, type, nonstandardFetchMode) => {
|
|
73
|
+
const where = mainCover(start, end);
|
|
74
|
+
if (where === "all")
|
|
75
|
+
return;
|
|
76
|
+
// A value that goes beyond what main found is looked at again where it stands (⑤): one that holds a
|
|
77
|
+
// command substitution is not a value, wherever it was read from.
|
|
78
|
+
if (where === "part" && /\$\(|`/.test(value))
|
|
79
|
+
return;
|
|
80
|
+
placed.push({ start, end, replaceStart: start, replaceEnd: end, type,
|
|
81
|
+
...(nonstandardFetchMode ? { nonstandardFetchMode } : {}) });
|
|
82
|
+
values.push({ value, type, copy: value.length >= exports.MIN_COPY_LENGTH });
|
|
83
|
+
};
|
|
84
|
+
if (json) {
|
|
85
|
+
const tokens = (0, json_text_js_1.jsonTokens)(raw);
|
|
86
|
+
const cache = new Map();
|
|
87
|
+
const locate = (token) => {
|
|
88
|
+
let found = cache.get(token.start);
|
|
89
|
+
if (!found) {
|
|
90
|
+
found = { token, decoded: (0, json_text_js_1.decodeToken)(raw, token.start, token.end) };
|
|
91
|
+
cache.set(token.start, found);
|
|
92
|
+
}
|
|
93
|
+
return found;
|
|
94
|
+
};
|
|
95
|
+
// (1) The places main found, within one string, whole escapes only.
|
|
96
|
+
for (const m of real) {
|
|
97
|
+
const token = tokenAt(tokens, m.replaceStart);
|
|
98
|
+
if (!token || token.kind !== "string" || token.isKey)
|
|
99
|
+
continue;
|
|
100
|
+
const base = token.start + 1;
|
|
101
|
+
if (m.replaceStart < base || m.replaceEnd > token.end - 1)
|
|
102
|
+
continue;
|
|
103
|
+
const { decoded } = locate(token);
|
|
104
|
+
const from = firstAtOrAfter(decoded.map, decoded.text.length, m.replaceStart - base);
|
|
105
|
+
const to = lastAtOrBefore(decoded.map, decoded.text.length, m.replaceEnd - base);
|
|
106
|
+
if (from < 0 || to < 0 || to <= from)
|
|
107
|
+
continue;
|
|
108
|
+
const start = base + decoded.map[from];
|
|
109
|
+
const end = base + decoded.map[to];
|
|
110
|
+
own.push({ start, end, replaceStart: start, replaceEnd: end, type: m.type });
|
|
111
|
+
}
|
|
112
|
+
// (2) The new shapes, read from the strings as they decode.
|
|
113
|
+
for (const token of tokens) {
|
|
114
|
+
if (token.kind !== "string" || token.isKey)
|
|
115
|
+
continue;
|
|
116
|
+
if (token.end - token.start - 2 < exports.MIN_COPY_LENGTH)
|
|
117
|
+
continue;
|
|
118
|
+
const body = raw.slice(token.start + 1, token.end - 1);
|
|
119
|
+
if (!SHAPE_HINT.test(body))
|
|
120
|
+
continue;
|
|
121
|
+
const { decoded } = locate(token);
|
|
122
|
+
const text = new shape_rules_js_1.ShapeText(decoded.text, token.isCommand);
|
|
123
|
+
for (const hit of (0, secret_shapes_js_1.scanSecretShapes)(decoded.text, text)) {
|
|
124
|
+
keep(token.start + 1 + decoded.map[hit.start], token.start + 1 + decoded.map[hit.end], decoded.text.slice(hit.start, hit.end), hit.type, hit.nonstandardFetchMode);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else if (raw.length >= exports.MIN_COPY_LENGTH && SHAPE_HINT.test(raw)) {
|
|
129
|
+
const text = new shape_rules_js_1.ShapeText(raw, false);
|
|
130
|
+
for (const hit of (0, secret_shapes_js_1.scanSecretShapes)(raw, text))
|
|
131
|
+
keep(hit.start, hit.end, raw.slice(hit.start, hit.end), hit.type, hit.nonstandardFetchMode);
|
|
132
|
+
}
|
|
133
|
+
// `mysql -p"v"`: main reads it as Bash text only; a quoted value is a password in any text.
|
|
134
|
+
if (context !== "bash" && MYSQL_HINT.test(raw)) {
|
|
135
|
+
const text = new shape_rules_js_1.ShapeText(raw, false);
|
|
136
|
+
for (const range of (0, mysql_password_js_1.mysqlPasswordRanges)(raw)) {
|
|
137
|
+
const inner = quotedInside(raw, range.start + 2, range.end);
|
|
138
|
+
if (!inner || raw.slice(range.start, range.start + 2) !== "-p")
|
|
139
|
+
continue;
|
|
140
|
+
const placedAt = text.evalShape(inner.start, inner.end);
|
|
141
|
+
if (placedAt.shape === null || placedAt.violation !== null)
|
|
142
|
+
continue;
|
|
143
|
+
keep(inner.start, inner.end, raw.slice(inner.start, inner.end), "cli_password_short");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return { placed, own, values };
|
|
147
|
+
}
|
|
148
|
+
/** The inside of a quoted word at `[from, to)` (a JSON-escaped quote counts as one), or null. */
|
|
149
|
+
function quotedInside(text, from, to) {
|
|
150
|
+
const open = text.startsWith('\\"', from) ? 2 : text[from] === '"' || text[from] === "'" ? 1 : 0;
|
|
151
|
+
if (open === 0)
|
|
152
|
+
return null;
|
|
153
|
+
const quote = text[from + open - 1];
|
|
154
|
+
const close = text.endsWith('\\"', to) && quote === '"' && open === 2 ? 2 : text[to - 1] === quote ? 1 : 0;
|
|
155
|
+
if (close === 0 || to - close <= from + open)
|
|
156
|
+
return null;
|
|
157
|
+
const inside = text.slice(from + open, to - close);
|
|
158
|
+
return /["']/.test(inside) ? null : { start: from + open, end: to - close };
|
|
159
|
+
}
|
|
160
|
+
/** The token that holds `at`, by binary search. */
|
|
161
|
+
function tokenAt(tokens, at) {
|
|
162
|
+
let lo = 0;
|
|
163
|
+
let hi = tokens.length - 1;
|
|
164
|
+
while (lo <= hi) {
|
|
165
|
+
const mid = (lo + hi) >> 1;
|
|
166
|
+
const token = tokens[mid];
|
|
167
|
+
if (at < token.start)
|
|
168
|
+
hi = mid - 1;
|
|
169
|
+
else if (at >= token.end)
|
|
170
|
+
lo = mid + 1;
|
|
171
|
+
else
|
|
172
|
+
return token;
|
|
173
|
+
}
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
/** Smallest decoded index `i` with `map[i] >= offset` (or -1). */
|
|
177
|
+
function firstAtOrAfter(map, length, offset) {
|
|
178
|
+
let lo = 0;
|
|
179
|
+
let hi = length;
|
|
180
|
+
while (lo < hi) {
|
|
181
|
+
const mid = (lo + hi) >> 1;
|
|
182
|
+
if (map[mid] < offset)
|
|
183
|
+
lo = mid + 1;
|
|
184
|
+
else
|
|
185
|
+
hi = mid;
|
|
186
|
+
}
|
|
187
|
+
return lo <= length ? lo : -1;
|
|
188
|
+
}
|
|
189
|
+
/** Largest decoded index `i` with `map[i] <= offset` (or -1). */
|
|
190
|
+
function lastAtOrBefore(map, length, offset) {
|
|
191
|
+
let lo = 0;
|
|
192
|
+
let hi = length;
|
|
193
|
+
while (lo < hi) {
|
|
194
|
+
const mid = (lo + hi + 1) >> 1;
|
|
195
|
+
if (map[mid] <= offset)
|
|
196
|
+
lo = mid;
|
|
197
|
+
else
|
|
198
|
+
hi = mid - 1;
|
|
199
|
+
}
|
|
200
|
+
return map[lo] <= offset ? lo : -1;
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=export-mask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-mask.js","sourceRoot":"","sources":["../src/export-mask.ts"],"names":[],"mappings":";;;AAqFA,gCAwEC;AA7JD;;;;;;;;;;;;;;;;;;GAkBG;AACH,2DAA0D;AAC1D,6CAA+E;AAC/E,iDAAyE;AACzE,yDAAsD;AACtD,qDAA6C;AAE7C,4GAA4G;AAC/F,QAAA,eAAe,GAAG,CAAC,CAAC;AAEjC,6EAA6E;AAC7E,MAAM,UAAU,GAAG,mDAAmD,CAAC;AACvE,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAmBvB,QAAA,cAAc,GAAe,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAE9E,iGAAiG;AACjG,SAAS,SAAS,CAAC,MAAwB;IACzC,MAAM,MAAM,GAAG,IAAA,4BAAe,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACpB,IAAI,EAAE,GAAG,CAAC,CAAC;QACX,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,GAA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