@node9/proxy 1.13.1 → 1.14.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/README.md +15 -12
- package/dist/cli.js +1546 -1286
- package/dist/cli.mjs +1529 -1270
- package/dist/index.js +17 -2
- package/dist/index.mjs +17 -2
- package/dist/shields/builtin/project-jail.json +64 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -126,6 +126,7 @@ function appendLocalAudit(toolName, args, decision, checkedBy, meta, auditHashAr
|
|
|
126
126
|
...testRun,
|
|
127
127
|
agent: meta?.agent,
|
|
128
128
|
mcpServer: meta?.mcpServer,
|
|
129
|
+
sessionId: meta?.sessionId,
|
|
129
130
|
hostname: import_os.default.hostname()
|
|
130
131
|
});
|
|
131
132
|
}
|
|
@@ -3586,8 +3587,22 @@ async function _authorizeHeadlessCore(toolName, args, meta, options) {
|
|
|
3586
3587
|
};
|
|
3587
3588
|
}
|
|
3588
3589
|
} else if (!taintWarning) {
|
|
3589
|
-
|
|
3590
|
-
|
|
3590
|
+
const toolLower = toolName.toLowerCase();
|
|
3591
|
+
const isFileTool = toolLower === "read" || toolLower === "grep" || toolLower === "glob" || toolLower === "read_file" || toolLower === "grep_search" || toolLower === "list_files";
|
|
3592
|
+
if (isFileTool && readActiveShields().includes("project-jail")) {
|
|
3593
|
+
const argsObj = args && typeof args === "object" && !Array.isArray(args) ? args : {};
|
|
3594
|
+
const filePath = String(
|
|
3595
|
+
argsObj.file_path ?? argsObj.path ?? argsObj.pattern ?? argsObj.filename ?? ""
|
|
3596
|
+
);
|
|
3597
|
+
if (filePath && scanFilePath(filePath)) {
|
|
3598
|
+
} else {
|
|
3599
|
+
if (!isManual) appendLocalAudit(toolName, args, "allow", "ignored", meta, hashAuditArgs);
|
|
3600
|
+
return { approved: true };
|
|
3601
|
+
}
|
|
3602
|
+
} else {
|
|
3603
|
+
if (!isManual) appendLocalAudit(toolName, args, "allow", "ignored", meta, hashAuditArgs);
|
|
3604
|
+
return { approved: true };
|
|
3605
|
+
}
|
|
3591
3606
|
}
|
|
3592
3607
|
if (!taintWarning && getActiveTrustSession(toolName, args)) {
|
|
3593
3608
|
if (approvers.cloud && creds?.apiKey)
|
package/dist/index.mjs
CHANGED
|
@@ -106,6 +106,7 @@ function appendLocalAudit(toolName, args, decision, checkedBy, meta, auditHashAr
|
|
|
106
106
|
...testRun,
|
|
107
107
|
agent: meta?.agent,
|
|
108
108
|
mcpServer: meta?.mcpServer,
|
|
109
|
+
sessionId: meta?.sessionId,
|
|
109
110
|
hostname: os.hostname()
|
|
110
111
|
});
|
|
111
112
|
}
|
|
@@ -3556,8 +3557,22 @@ async function _authorizeHeadlessCore(toolName, args, meta, options) {
|
|
|
3556
3557
|
};
|
|
3557
3558
|
}
|
|
3558
3559
|
} else if (!taintWarning) {
|
|
3559
|
-
|
|
3560
|
-
|
|
3560
|
+
const toolLower = toolName.toLowerCase();
|
|
3561
|
+
const isFileTool = toolLower === "read" || toolLower === "grep" || toolLower === "glob" || toolLower === "read_file" || toolLower === "grep_search" || toolLower === "list_files";
|
|
3562
|
+
if (isFileTool && readActiveShields().includes("project-jail")) {
|
|
3563
|
+
const argsObj = args && typeof args === "object" && !Array.isArray(args) ? args : {};
|
|
3564
|
+
const filePath = String(
|
|
3565
|
+
argsObj.file_path ?? argsObj.path ?? argsObj.pattern ?? argsObj.filename ?? ""
|
|
3566
|
+
);
|
|
3567
|
+
if (filePath && scanFilePath(filePath)) {
|
|
3568
|
+
} else {
|
|
3569
|
+
if (!isManual) appendLocalAudit(toolName, args, "allow", "ignored", meta, hashAuditArgs);
|
|
3570
|
+
return { approved: true };
|
|
3571
|
+
}
|
|
3572
|
+
} else {
|
|
3573
|
+
if (!isManual) appendLocalAudit(toolName, args, "allow", "ignored", meta, hashAuditArgs);
|
|
3574
|
+
return { approved: true };
|
|
3575
|
+
}
|
|
3561
3576
|
}
|
|
3562
3577
|
if (!taintWarning && getActiveTrustSession(toolName, args)) {
|
|
3563
3578
|
if (approvers.cloud && creds?.apiKey)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "project-jail",
|
|
3
|
+
"description": "Restricts AI agents from reading sensitive credential files outside the current project",
|
|
4
|
+
"aliases": ["jail"],
|
|
5
|
+
"smartRules": [
|
|
6
|
+
{
|
|
7
|
+
"name": "shield:project-jail:block-read-ssh",
|
|
8
|
+
"tool": "bash",
|
|
9
|
+
"conditions": [
|
|
10
|
+
{
|
|
11
|
+
"field": "command",
|
|
12
|
+
"op": "matches",
|
|
13
|
+
"value": "(cat|less|head|tail|bat|more|open|print|nano|vim|vi|emacs|code|type)\\s+.*[\\/\\\\]\\.ssh[\\/\\\\]",
|
|
14
|
+
"flags": "i"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"verdict": "block",
|
|
18
|
+
"reason": "Reading SSH private keys is blocked by project-jail shield"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "shield:project-jail:block-read-aws",
|
|
22
|
+
"tool": "bash",
|
|
23
|
+
"conditions": [
|
|
24
|
+
{
|
|
25
|
+
"field": "command",
|
|
26
|
+
"op": "matches",
|
|
27
|
+
"value": "(cat|less|head|tail|bat|more|open|print|nano|vim|vi|emacs|code|type)\\s+.*[\\/\\\\]\\.aws[\\/\\\\]",
|
|
28
|
+
"flags": "i"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"verdict": "block",
|
|
32
|
+
"reason": "Reading AWS credentials is blocked by project-jail shield"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "shield:project-jail:block-read-env",
|
|
36
|
+
"tool": "bash",
|
|
37
|
+
"conditions": [
|
|
38
|
+
{
|
|
39
|
+
"field": "command",
|
|
40
|
+
"op": "matches",
|
|
41
|
+
"value": "(cat|less|head|tail|bat|more|open|print|nano|vim|vi|emacs|code|type)\\s+.*\\.env(\\.local|\\.production|\\.staging)?\\b",
|
|
42
|
+
"flags": "i"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"verdict": "block",
|
|
46
|
+
"reason": "Reading .env files is blocked by project-jail shield"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "shield:project-jail:block-read-credentials",
|
|
50
|
+
"tool": "bash",
|
|
51
|
+
"conditions": [
|
|
52
|
+
{
|
|
53
|
+
"field": "command",
|
|
54
|
+
"op": "matches",
|
|
55
|
+
"value": "(cat|less|head|tail|bat|more|open|print|nano|vim|vi|emacs|code|type)\\s+.*(credentials\\.json|\\.netrc|\\.npmrc|\\.docker[\\/\\\\]config\\.json|gcloud[\\/\\\\]credentials)",
|
|
56
|
+
"flags": "i"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"verdict": "block",
|
|
60
|
+
"reason": "Reading credential files is blocked by project-jail shield"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"dangerousWords": []
|
|
64
|
+
}
|