agentdock-cli 1.4.0 → 1.4.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/package.json +1 -1
- package/dist/src/scanners/sensitive.js +35 -2
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentdock-cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Diagnose, migrate, and back up your AI coding environment — Claude Code, Codex, Gemini CLI, TRAE, Cursor/Grok Build, Cline, Windsurf, Copilot, OpenCode and more — with config snapshots, restore, and secret isolation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.isSecretKey = isSecretKey;
|
|
13
13
|
exports.looksLikeSecret = looksLikeSecret;
|
|
14
|
+
exports.isSensitiveEntry = isSensitiveEntry;
|
|
14
15
|
exports.findSecretLeaks = findSecretLeaks;
|
|
15
16
|
exports.maskSecret = maskSecret;
|
|
16
17
|
exports.createSecretKeyRegistry = createSecretKeyRegistry;
|
|
@@ -42,6 +43,38 @@ function looksLikeSecret(value) {
|
|
|
42
43
|
}
|
|
43
44
|
return SECRET_VALUE_PATTERNS.some((pattern) => pattern.test(value));
|
|
44
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* 纯数字 / 布尔 / 空值:这类值来自配置项(如 `CLAUDE_CODE_MAX_CONTEXT_TOKENS=32000`),
|
|
48
|
+
* 即使键名包含 token 也不应视为机密。真实令牌几乎不会只由数字组成。
|
|
49
|
+
*/
|
|
50
|
+
function isNonSecretScalar(value) {
|
|
51
|
+
const trimmed = value.trim();
|
|
52
|
+
if (trimmed === '') {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
if (/^[+-]?\d+(?:\.\d+)?$/.test(trimmed)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
return /^(true|false|null|none|undefined)$/i.test(trimmed);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 判定一个键值对是否应按机密处理:
|
|
62
|
+
* 1. 值本身匹配已知令牌形状 → 是;
|
|
63
|
+
* 2. 键名像凭据,且值不是纯数字 / 布尔等配置标量 → 是;
|
|
64
|
+
* 3. 其余 → 否。
|
|
65
|
+
*/
|
|
66
|
+
function isSensitiveEntry(name, value) {
|
|
67
|
+
if (looksLikeSecret(value)) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
if (!isSecretKey(name)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (typeof value === 'string') {
|
|
74
|
+
return !isNonSecretScalar(value);
|
|
75
|
+
}
|
|
76
|
+
return typeof value === 'object' && value !== null;
|
|
77
|
+
}
|
|
45
78
|
/**
|
|
46
79
|
* Scan arbitrary text (e.g. a free-text skill/agent/memory file) for leaked
|
|
47
80
|
* secret tokens. Tokenizes on whitespace and common delimiters, then tests each
|
|
@@ -137,7 +170,7 @@ function collectSecrets(node, basePath, accumulator, seen = new WeakSet()) {
|
|
|
137
170
|
for (const [key, value] of Object.entries(node)) {
|
|
138
171
|
const childPath = `${basePath}.${key}`;
|
|
139
172
|
if (typeof value === 'string') {
|
|
140
|
-
if (
|
|
173
|
+
if (isSensitiveEntry(key, value)) {
|
|
141
174
|
accumulator.push({ key, value, jsonPath: childPath });
|
|
142
175
|
}
|
|
143
176
|
}
|
|
@@ -188,7 +221,7 @@ function maskSecretsInPlace(node, basePath, agent, secretsEnv, seen = new WeakSe
|
|
|
188
221
|
for (const [key, value] of Object.entries(node)) {
|
|
189
222
|
const childPath = `${basePath}.${key}`;
|
|
190
223
|
if (typeof value === 'string') {
|
|
191
|
-
if (
|
|
224
|
+
if (isSensitiveEntry(key, value)) {
|
|
192
225
|
const keyName = allocateSecretKey(registry, secretKeyName(agent, childPath), value);
|
|
193
226
|
node[key] =
|
|
194
227
|
secretsEnv && secretsEnv[keyName] !== undefined ? secretsEnv[keyName] : `{{${keyName}}}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentdock-cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Diagnose, migrate, and back up your AI coding environment — Claude Code, Codex, Gemini CLI, TRAE, Cursor/Grok Build, Cline, Windsurf, Copilot, OpenCode and more — with config snapshots, restore, and secret isolation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|