claude-warden 2.8.0 → 2.8.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/dist/cli.cjs +90 -9
- package/dist/codex-export.cjs +90 -9
- package/dist/copilot.cjs +90 -9
- package/dist/index.cjs +90 -9
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "warden",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"description": "Smart command safety filter for Claude Code — parses shell pipelines and evaluates per-command safety rules to auto-approve safe commands and block dangerous ones",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "banyudu"
|
package/dist/cli.cjs
CHANGED
|
@@ -18860,6 +18860,91 @@ function registryOpsPattern() {
|
|
|
18860
18860
|
reason: "Registry modification"
|
|
18861
18861
|
};
|
|
18862
18862
|
}
|
|
18863
|
+
var INLINE_LANG_CONFIG = {
|
|
18864
|
+
Python: {
|
|
18865
|
+
ext: "py",
|
|
18866
|
+
patterns: [
|
|
18867
|
+
"os\\.system",
|
|
18868
|
+
"subprocess",
|
|
18869
|
+
"commands\\.",
|
|
18870
|
+
"pty\\.",
|
|
18871
|
+
`__import__\\s*\\(\\s*['"](?:os|subprocess|socket)`,
|
|
18872
|
+
"\\bexec\\s*\\(",
|
|
18873
|
+
"\\beval\\s*\\(",
|
|
18874
|
+
`open\\s*\\([^)]*['"][wax+]`,
|
|
18875
|
+
"\\bsocket\\b",
|
|
18876
|
+
"urllib",
|
|
18877
|
+
"requests\\.",
|
|
18878
|
+
"http\\.client"
|
|
18879
|
+
]
|
|
18880
|
+
},
|
|
18881
|
+
JavaScript: {
|
|
18882
|
+
ext: "js",
|
|
18883
|
+
patterns: [
|
|
18884
|
+
"child[_]process",
|
|
18885
|
+
`require\\s*\\(\\s*['"]child[_]process`,
|
|
18886
|
+
"\\.(?:writeFile|appendFile|createWriteStream|writeFileSync|appendFileSync)\\s*\\(",
|
|
18887
|
+
"http\\.request",
|
|
18888
|
+
"https\\.request",
|
|
18889
|
+
"net\\.(?:connect|createConnection)",
|
|
18890
|
+
"fetch\\s*\\("
|
|
18891
|
+
]
|
|
18892
|
+
},
|
|
18893
|
+
Ruby: {
|
|
18894
|
+
ext: "rb",
|
|
18895
|
+
patterns: [
|
|
18896
|
+
"`",
|
|
18897
|
+
"%x[\\(\\{\\[]",
|
|
18898
|
+
"\\bsystem\\s*\\(",
|
|
18899
|
+
"\\bexec\\s*\\(",
|
|
18900
|
+
"IO\\.popen",
|
|
18901
|
+
"Kernel\\.",
|
|
18902
|
+
"\\bspawn\\s*\\(",
|
|
18903
|
+
`File\\.open\\s*\\([^)]*['"][wax+]`,
|
|
18904
|
+
"File\\.write",
|
|
18905
|
+
"open-uri",
|
|
18906
|
+
"Net::HTTP"
|
|
18907
|
+
]
|
|
18908
|
+
},
|
|
18909
|
+
Perl: {
|
|
18910
|
+
ext: "pl",
|
|
18911
|
+
patterns: [
|
|
18912
|
+
"`",
|
|
18913
|
+
"qx[\\(\\{\\[/]",
|
|
18914
|
+
"\\bsystem\\s*\\(",
|
|
18915
|
+
"\\bexec\\s*\\(",
|
|
18916
|
+
`open\\s*\\([^)]*['"][>|+]`
|
|
18917
|
+
]
|
|
18918
|
+
},
|
|
18919
|
+
PHP: {
|
|
18920
|
+
ext: "php",
|
|
18921
|
+
patterns: [
|
|
18922
|
+
"`",
|
|
18923
|
+
"shell_exec",
|
|
18924
|
+
"\\b(?:system|passthru|popen|proc_open)\\s*\\(",
|
|
18925
|
+
"\\bexec\\s*\\(",
|
|
18926
|
+
"file_put_contents",
|
|
18927
|
+
"fwrite",
|
|
18928
|
+
`fopen\\s*\\([^)]*['"][wax+]`,
|
|
18929
|
+
"curl_exec",
|
|
18930
|
+
"fsockopen"
|
|
18931
|
+
]
|
|
18932
|
+
}
|
|
18933
|
+
};
|
|
18934
|
+
function inlineExecPatterns(lang, flags) {
|
|
18935
|
+
const { ext, patterns } = INLINE_LANG_CONFIG[lang];
|
|
18936
|
+
const reason = `Inline ${lang} is hard to audit. For JSON, prefer \`jq\`. For reuse, save to scripts/*.${ext} and run it.`;
|
|
18937
|
+
const flagAlt = flags.map((f) => f.replace(/^\^/, "").replace(/\$$/, "")).join("|");
|
|
18938
|
+
const compound = `(?:^|\\s)(?:${flagAlt})[\\s=][^\\n]{0,16000}?(?:${patterns.join("|")})`;
|
|
18939
|
+
return [
|
|
18940
|
+
{ match: { argsMatch: [compound] }, decision: "ask", reason },
|
|
18941
|
+
{
|
|
18942
|
+
match: { anyArgMatches: flags },
|
|
18943
|
+
decision: "allow",
|
|
18944
|
+
description: `Plausibly read-only inline ${lang} script`
|
|
18945
|
+
}
|
|
18946
|
+
];
|
|
18947
|
+
}
|
|
18863
18948
|
function pkgManagerRule(command, extraSafeCmds = []) {
|
|
18864
18949
|
const safeCmds = [...SAFE_PKG_MANAGER_CMDS, ...extraSafeCmds];
|
|
18865
18950
|
return {
|
|
@@ -19243,7 +19328,7 @@ var DEFAULT_CONFIG = {
|
|
|
19243
19328
|
command: "node",
|
|
19244
19329
|
default: "ask",
|
|
19245
19330
|
argPatterns: [
|
|
19246
|
-
|
|
19331
|
+
...inlineExecPatterns("JavaScript", ["^-e$", "^--eval", "^-p$", "^--print"]),
|
|
19247
19332
|
{ match: { anyArgMatches: ["^--(version|help)$", "^-[vh]$"] }, decision: "allow", description: "Version/help flags" },
|
|
19248
19333
|
{ match: { noArgs: true }, decision: "ask", reason: "Interactive REPL" }
|
|
19249
19334
|
]
|
|
@@ -19272,6 +19357,7 @@ var DEFAULT_CONFIG = {
|
|
|
19272
19357
|
command: cmd,
|
|
19273
19358
|
default: "ask",
|
|
19274
19359
|
argPatterns: [
|
|
19360
|
+
...inlineExecPatterns("Python", ["^-c$"]),
|
|
19275
19361
|
{ match: { anyArgMatches: ["^--(version|help)$", "^-V$"] }, decision: "allow" }
|
|
19276
19362
|
]
|
|
19277
19363
|
})),
|
|
@@ -19430,14 +19516,9 @@ var DEFAULT_CONFIG = {
|
|
|
19430
19516
|
argPatterns: [VERSION_HELP_FLAGS]
|
|
19431
19517
|
})),
|
|
19432
19518
|
// --- Scripting languages ---
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
argPatterns: [
|
|
19437
|
-
{ match: { anyArgMatches: ["^-e$", "^--eval"] }, decision: "ask", reason: "Inline code execution" },
|
|
19438
|
-
VERSION_HELP_FLAGS
|
|
19439
|
-
]
|
|
19440
|
-
})),
|
|
19519
|
+
{ command: "ruby", default: "ask", argPatterns: [...inlineExecPatterns("Ruby", ["^-e$", "^--eval"]), VERSION_HELP_FLAGS] },
|
|
19520
|
+
{ command: "perl", default: "ask", argPatterns: [...inlineExecPatterns("Perl", ["^-e$", "^-E$"]), VERSION_HELP_FLAGS] },
|
|
19521
|
+
{ command: "php", default: "ask", argPatterns: [...inlineExecPatterns("PHP", ["^-r$"]), VERSION_HELP_FLAGS] },
|
|
19441
19522
|
// --- Java ecosystem ---
|
|
19442
19523
|
{ command: "java", default: "ask", argPatterns: [VERSION_HELP_FLAGS] },
|
|
19443
19524
|
{ command: "javac", default: "allow" },
|
package/dist/codex-export.cjs
CHANGED
|
@@ -18864,6 +18864,91 @@ function registryOpsPattern() {
|
|
|
18864
18864
|
reason: "Registry modification"
|
|
18865
18865
|
};
|
|
18866
18866
|
}
|
|
18867
|
+
var INLINE_LANG_CONFIG = {
|
|
18868
|
+
Python: {
|
|
18869
|
+
ext: "py",
|
|
18870
|
+
patterns: [
|
|
18871
|
+
"os\\.system",
|
|
18872
|
+
"subprocess",
|
|
18873
|
+
"commands\\.",
|
|
18874
|
+
"pty\\.",
|
|
18875
|
+
`__import__\\s*\\(\\s*['"](?:os|subprocess|socket)`,
|
|
18876
|
+
"\\bexec\\s*\\(",
|
|
18877
|
+
"\\beval\\s*\\(",
|
|
18878
|
+
`open\\s*\\([^)]*['"][wax+]`,
|
|
18879
|
+
"\\bsocket\\b",
|
|
18880
|
+
"urllib",
|
|
18881
|
+
"requests\\.",
|
|
18882
|
+
"http\\.client"
|
|
18883
|
+
]
|
|
18884
|
+
},
|
|
18885
|
+
JavaScript: {
|
|
18886
|
+
ext: "js",
|
|
18887
|
+
patterns: [
|
|
18888
|
+
"child[_]process",
|
|
18889
|
+
`require\\s*\\(\\s*['"]child[_]process`,
|
|
18890
|
+
"\\.(?:writeFile|appendFile|createWriteStream|writeFileSync|appendFileSync)\\s*\\(",
|
|
18891
|
+
"http\\.request",
|
|
18892
|
+
"https\\.request",
|
|
18893
|
+
"net\\.(?:connect|createConnection)",
|
|
18894
|
+
"fetch\\s*\\("
|
|
18895
|
+
]
|
|
18896
|
+
},
|
|
18897
|
+
Ruby: {
|
|
18898
|
+
ext: "rb",
|
|
18899
|
+
patterns: [
|
|
18900
|
+
"`",
|
|
18901
|
+
"%x[\\(\\{\\[]",
|
|
18902
|
+
"\\bsystem\\s*\\(",
|
|
18903
|
+
"\\bexec\\s*\\(",
|
|
18904
|
+
"IO\\.popen",
|
|
18905
|
+
"Kernel\\.",
|
|
18906
|
+
"\\bspawn\\s*\\(",
|
|
18907
|
+
`File\\.open\\s*\\([^)]*['"][wax+]`,
|
|
18908
|
+
"File\\.write",
|
|
18909
|
+
"open-uri",
|
|
18910
|
+
"Net::HTTP"
|
|
18911
|
+
]
|
|
18912
|
+
},
|
|
18913
|
+
Perl: {
|
|
18914
|
+
ext: "pl",
|
|
18915
|
+
patterns: [
|
|
18916
|
+
"`",
|
|
18917
|
+
"qx[\\(\\{\\[/]",
|
|
18918
|
+
"\\bsystem\\s*\\(",
|
|
18919
|
+
"\\bexec\\s*\\(",
|
|
18920
|
+
`open\\s*\\([^)]*['"][>|+]`
|
|
18921
|
+
]
|
|
18922
|
+
},
|
|
18923
|
+
PHP: {
|
|
18924
|
+
ext: "php",
|
|
18925
|
+
patterns: [
|
|
18926
|
+
"`",
|
|
18927
|
+
"shell_exec",
|
|
18928
|
+
"\\b(?:system|passthru|popen|proc_open)\\s*\\(",
|
|
18929
|
+
"\\bexec\\s*\\(",
|
|
18930
|
+
"file_put_contents",
|
|
18931
|
+
"fwrite",
|
|
18932
|
+
`fopen\\s*\\([^)]*['"][wax+]`,
|
|
18933
|
+
"curl_exec",
|
|
18934
|
+
"fsockopen"
|
|
18935
|
+
]
|
|
18936
|
+
}
|
|
18937
|
+
};
|
|
18938
|
+
function inlineExecPatterns(lang, flags) {
|
|
18939
|
+
const { ext, patterns } = INLINE_LANG_CONFIG[lang];
|
|
18940
|
+
const reason = `Inline ${lang} is hard to audit. For JSON, prefer \`jq\`. For reuse, save to scripts/*.${ext} and run it.`;
|
|
18941
|
+
const flagAlt = flags.map((f) => f.replace(/^\^/, "").replace(/\$$/, "")).join("|");
|
|
18942
|
+
const compound = `(?:^|\\s)(?:${flagAlt})[\\s=][^\\n]{0,16000}?(?:${patterns.join("|")})`;
|
|
18943
|
+
return [
|
|
18944
|
+
{ match: { argsMatch: [compound] }, decision: "ask", reason },
|
|
18945
|
+
{
|
|
18946
|
+
match: { anyArgMatches: flags },
|
|
18947
|
+
decision: "allow",
|
|
18948
|
+
description: `Plausibly read-only inline ${lang} script`
|
|
18949
|
+
}
|
|
18950
|
+
];
|
|
18951
|
+
}
|
|
18867
18952
|
function pkgManagerRule(command, extraSafeCmds = []) {
|
|
18868
18953
|
const safeCmds = [...SAFE_PKG_MANAGER_CMDS, ...extraSafeCmds];
|
|
18869
18954
|
return {
|
|
@@ -19247,7 +19332,7 @@ var DEFAULT_CONFIG = {
|
|
|
19247
19332
|
command: "node",
|
|
19248
19333
|
default: "ask",
|
|
19249
19334
|
argPatterns: [
|
|
19250
|
-
|
|
19335
|
+
...inlineExecPatterns("JavaScript", ["^-e$", "^--eval", "^-p$", "^--print"]),
|
|
19251
19336
|
{ match: { anyArgMatches: ["^--(version|help)$", "^-[vh]$"] }, decision: "allow", description: "Version/help flags" },
|
|
19252
19337
|
{ match: { noArgs: true }, decision: "ask", reason: "Interactive REPL" }
|
|
19253
19338
|
]
|
|
@@ -19276,6 +19361,7 @@ var DEFAULT_CONFIG = {
|
|
|
19276
19361
|
command: cmd,
|
|
19277
19362
|
default: "ask",
|
|
19278
19363
|
argPatterns: [
|
|
19364
|
+
...inlineExecPatterns("Python", ["^-c$"]),
|
|
19279
19365
|
{ match: { anyArgMatches: ["^--(version|help)$", "^-V$"] }, decision: "allow" }
|
|
19280
19366
|
]
|
|
19281
19367
|
})),
|
|
@@ -19434,14 +19520,9 @@ var DEFAULT_CONFIG = {
|
|
|
19434
19520
|
argPatterns: [VERSION_HELP_FLAGS]
|
|
19435
19521
|
})),
|
|
19436
19522
|
// --- Scripting languages ---
|
|
19437
|
-
|
|
19438
|
-
|
|
19439
|
-
|
|
19440
|
-
argPatterns: [
|
|
19441
|
-
{ match: { anyArgMatches: ["^-e$", "^--eval"] }, decision: "ask", reason: "Inline code execution" },
|
|
19442
|
-
VERSION_HELP_FLAGS
|
|
19443
|
-
]
|
|
19444
|
-
})),
|
|
19523
|
+
{ command: "ruby", default: "ask", argPatterns: [...inlineExecPatterns("Ruby", ["^-e$", "^--eval"]), VERSION_HELP_FLAGS] },
|
|
19524
|
+
{ command: "perl", default: "ask", argPatterns: [...inlineExecPatterns("Perl", ["^-e$", "^-E$"]), VERSION_HELP_FLAGS] },
|
|
19525
|
+
{ command: "php", default: "ask", argPatterns: [...inlineExecPatterns("PHP", ["^-r$"]), VERSION_HELP_FLAGS] },
|
|
19445
19526
|
// --- Java ecosystem ---
|
|
19446
19527
|
{ command: "java", default: "ask", argPatterns: [VERSION_HELP_FLAGS] },
|
|
19447
19528
|
{ command: "javac", default: "allow" },
|
package/dist/copilot.cjs
CHANGED
|
@@ -18860,6 +18860,91 @@ function registryOpsPattern() {
|
|
|
18860
18860
|
reason: "Registry modification"
|
|
18861
18861
|
};
|
|
18862
18862
|
}
|
|
18863
|
+
var INLINE_LANG_CONFIG = {
|
|
18864
|
+
Python: {
|
|
18865
|
+
ext: "py",
|
|
18866
|
+
patterns: [
|
|
18867
|
+
"os\\.system",
|
|
18868
|
+
"subprocess",
|
|
18869
|
+
"commands\\.",
|
|
18870
|
+
"pty\\.",
|
|
18871
|
+
`__import__\\s*\\(\\s*['"](?:os|subprocess|socket)`,
|
|
18872
|
+
"\\bexec\\s*\\(",
|
|
18873
|
+
"\\beval\\s*\\(",
|
|
18874
|
+
`open\\s*\\([^)]*['"][wax+]`,
|
|
18875
|
+
"\\bsocket\\b",
|
|
18876
|
+
"urllib",
|
|
18877
|
+
"requests\\.",
|
|
18878
|
+
"http\\.client"
|
|
18879
|
+
]
|
|
18880
|
+
},
|
|
18881
|
+
JavaScript: {
|
|
18882
|
+
ext: "js",
|
|
18883
|
+
patterns: [
|
|
18884
|
+
"child[_]process",
|
|
18885
|
+
`require\\s*\\(\\s*['"]child[_]process`,
|
|
18886
|
+
"\\.(?:writeFile|appendFile|createWriteStream|writeFileSync|appendFileSync)\\s*\\(",
|
|
18887
|
+
"http\\.request",
|
|
18888
|
+
"https\\.request",
|
|
18889
|
+
"net\\.(?:connect|createConnection)",
|
|
18890
|
+
"fetch\\s*\\("
|
|
18891
|
+
]
|
|
18892
|
+
},
|
|
18893
|
+
Ruby: {
|
|
18894
|
+
ext: "rb",
|
|
18895
|
+
patterns: [
|
|
18896
|
+
"`",
|
|
18897
|
+
"%x[\\(\\{\\[]",
|
|
18898
|
+
"\\bsystem\\s*\\(",
|
|
18899
|
+
"\\bexec\\s*\\(",
|
|
18900
|
+
"IO\\.popen",
|
|
18901
|
+
"Kernel\\.",
|
|
18902
|
+
"\\bspawn\\s*\\(",
|
|
18903
|
+
`File\\.open\\s*\\([^)]*['"][wax+]`,
|
|
18904
|
+
"File\\.write",
|
|
18905
|
+
"open-uri",
|
|
18906
|
+
"Net::HTTP"
|
|
18907
|
+
]
|
|
18908
|
+
},
|
|
18909
|
+
Perl: {
|
|
18910
|
+
ext: "pl",
|
|
18911
|
+
patterns: [
|
|
18912
|
+
"`",
|
|
18913
|
+
"qx[\\(\\{\\[/]",
|
|
18914
|
+
"\\bsystem\\s*\\(",
|
|
18915
|
+
"\\bexec\\s*\\(",
|
|
18916
|
+
`open\\s*\\([^)]*['"][>|+]`
|
|
18917
|
+
]
|
|
18918
|
+
},
|
|
18919
|
+
PHP: {
|
|
18920
|
+
ext: "php",
|
|
18921
|
+
patterns: [
|
|
18922
|
+
"`",
|
|
18923
|
+
"shell_exec",
|
|
18924
|
+
"\\b(?:system|passthru|popen|proc_open)\\s*\\(",
|
|
18925
|
+
"\\bexec\\s*\\(",
|
|
18926
|
+
"file_put_contents",
|
|
18927
|
+
"fwrite",
|
|
18928
|
+
`fopen\\s*\\([^)]*['"][wax+]`,
|
|
18929
|
+
"curl_exec",
|
|
18930
|
+
"fsockopen"
|
|
18931
|
+
]
|
|
18932
|
+
}
|
|
18933
|
+
};
|
|
18934
|
+
function inlineExecPatterns(lang, flags) {
|
|
18935
|
+
const { ext, patterns } = INLINE_LANG_CONFIG[lang];
|
|
18936
|
+
const reason = `Inline ${lang} is hard to audit. For JSON, prefer \`jq\`. For reuse, save to scripts/*.${ext} and run it.`;
|
|
18937
|
+
const flagAlt = flags.map((f) => f.replace(/^\^/, "").replace(/\$$/, "")).join("|");
|
|
18938
|
+
const compound = `(?:^|\\s)(?:${flagAlt})[\\s=][^\\n]{0,16000}?(?:${patterns.join("|")})`;
|
|
18939
|
+
return [
|
|
18940
|
+
{ match: { argsMatch: [compound] }, decision: "ask", reason },
|
|
18941
|
+
{
|
|
18942
|
+
match: { anyArgMatches: flags },
|
|
18943
|
+
decision: "allow",
|
|
18944
|
+
description: `Plausibly read-only inline ${lang} script`
|
|
18945
|
+
}
|
|
18946
|
+
];
|
|
18947
|
+
}
|
|
18863
18948
|
function pkgManagerRule(command, extraSafeCmds = []) {
|
|
18864
18949
|
const safeCmds = [...SAFE_PKG_MANAGER_CMDS, ...extraSafeCmds];
|
|
18865
18950
|
return {
|
|
@@ -19243,7 +19328,7 @@ var DEFAULT_CONFIG = {
|
|
|
19243
19328
|
command: "node",
|
|
19244
19329
|
default: "ask",
|
|
19245
19330
|
argPatterns: [
|
|
19246
|
-
|
|
19331
|
+
...inlineExecPatterns("JavaScript", ["^-e$", "^--eval", "^-p$", "^--print"]),
|
|
19247
19332
|
{ match: { anyArgMatches: ["^--(version|help)$", "^-[vh]$"] }, decision: "allow", description: "Version/help flags" },
|
|
19248
19333
|
{ match: { noArgs: true }, decision: "ask", reason: "Interactive REPL" }
|
|
19249
19334
|
]
|
|
@@ -19272,6 +19357,7 @@ var DEFAULT_CONFIG = {
|
|
|
19272
19357
|
command: cmd,
|
|
19273
19358
|
default: "ask",
|
|
19274
19359
|
argPatterns: [
|
|
19360
|
+
...inlineExecPatterns("Python", ["^-c$"]),
|
|
19275
19361
|
{ match: { anyArgMatches: ["^--(version|help)$", "^-V$"] }, decision: "allow" }
|
|
19276
19362
|
]
|
|
19277
19363
|
})),
|
|
@@ -19430,14 +19516,9 @@ var DEFAULT_CONFIG = {
|
|
|
19430
19516
|
argPatterns: [VERSION_HELP_FLAGS]
|
|
19431
19517
|
})),
|
|
19432
19518
|
// --- Scripting languages ---
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
argPatterns: [
|
|
19437
|
-
{ match: { anyArgMatches: ["^-e$", "^--eval"] }, decision: "ask", reason: "Inline code execution" },
|
|
19438
|
-
VERSION_HELP_FLAGS
|
|
19439
|
-
]
|
|
19440
|
-
})),
|
|
19519
|
+
{ command: "ruby", default: "ask", argPatterns: [...inlineExecPatterns("Ruby", ["^-e$", "^--eval"]), VERSION_HELP_FLAGS] },
|
|
19520
|
+
{ command: "perl", default: "ask", argPatterns: [...inlineExecPatterns("Perl", ["^-e$", "^-E$"]), VERSION_HELP_FLAGS] },
|
|
19521
|
+
{ command: "php", default: "ask", argPatterns: [...inlineExecPatterns("PHP", ["^-r$"]), VERSION_HELP_FLAGS] },
|
|
19441
19522
|
// --- Java ecosystem ---
|
|
19442
19523
|
{ command: "java", default: "ask", argPatterns: [VERSION_HELP_FLAGS] },
|
|
19443
19524
|
{ command: "javac", default: "allow" },
|
package/dist/index.cjs
CHANGED
|
@@ -18860,6 +18860,91 @@ function registryOpsPattern() {
|
|
|
18860
18860
|
reason: "Registry modification"
|
|
18861
18861
|
};
|
|
18862
18862
|
}
|
|
18863
|
+
var INLINE_LANG_CONFIG = {
|
|
18864
|
+
Python: {
|
|
18865
|
+
ext: "py",
|
|
18866
|
+
patterns: [
|
|
18867
|
+
"os\\.system",
|
|
18868
|
+
"subprocess",
|
|
18869
|
+
"commands\\.",
|
|
18870
|
+
"pty\\.",
|
|
18871
|
+
`__import__\\s*\\(\\s*['"](?:os|subprocess|socket)`,
|
|
18872
|
+
"\\bexec\\s*\\(",
|
|
18873
|
+
"\\beval\\s*\\(",
|
|
18874
|
+
`open\\s*\\([^)]*['"][wax+]`,
|
|
18875
|
+
"\\bsocket\\b",
|
|
18876
|
+
"urllib",
|
|
18877
|
+
"requests\\.",
|
|
18878
|
+
"http\\.client"
|
|
18879
|
+
]
|
|
18880
|
+
},
|
|
18881
|
+
JavaScript: {
|
|
18882
|
+
ext: "js",
|
|
18883
|
+
patterns: [
|
|
18884
|
+
"child[_]process",
|
|
18885
|
+
`require\\s*\\(\\s*['"]child[_]process`,
|
|
18886
|
+
"\\.(?:writeFile|appendFile|createWriteStream|writeFileSync|appendFileSync)\\s*\\(",
|
|
18887
|
+
"http\\.request",
|
|
18888
|
+
"https\\.request",
|
|
18889
|
+
"net\\.(?:connect|createConnection)",
|
|
18890
|
+
"fetch\\s*\\("
|
|
18891
|
+
]
|
|
18892
|
+
},
|
|
18893
|
+
Ruby: {
|
|
18894
|
+
ext: "rb",
|
|
18895
|
+
patterns: [
|
|
18896
|
+
"`",
|
|
18897
|
+
"%x[\\(\\{\\[]",
|
|
18898
|
+
"\\bsystem\\s*\\(",
|
|
18899
|
+
"\\bexec\\s*\\(",
|
|
18900
|
+
"IO\\.popen",
|
|
18901
|
+
"Kernel\\.",
|
|
18902
|
+
"\\bspawn\\s*\\(",
|
|
18903
|
+
`File\\.open\\s*\\([^)]*['"][wax+]`,
|
|
18904
|
+
"File\\.write",
|
|
18905
|
+
"open-uri",
|
|
18906
|
+
"Net::HTTP"
|
|
18907
|
+
]
|
|
18908
|
+
},
|
|
18909
|
+
Perl: {
|
|
18910
|
+
ext: "pl",
|
|
18911
|
+
patterns: [
|
|
18912
|
+
"`",
|
|
18913
|
+
"qx[\\(\\{\\[/]",
|
|
18914
|
+
"\\bsystem\\s*\\(",
|
|
18915
|
+
"\\bexec\\s*\\(",
|
|
18916
|
+
`open\\s*\\([^)]*['"][>|+]`
|
|
18917
|
+
]
|
|
18918
|
+
},
|
|
18919
|
+
PHP: {
|
|
18920
|
+
ext: "php",
|
|
18921
|
+
patterns: [
|
|
18922
|
+
"`",
|
|
18923
|
+
"shell_exec",
|
|
18924
|
+
"\\b(?:system|passthru|popen|proc_open)\\s*\\(",
|
|
18925
|
+
"\\bexec\\s*\\(",
|
|
18926
|
+
"file_put_contents",
|
|
18927
|
+
"fwrite",
|
|
18928
|
+
`fopen\\s*\\([^)]*['"][wax+]`,
|
|
18929
|
+
"curl_exec",
|
|
18930
|
+
"fsockopen"
|
|
18931
|
+
]
|
|
18932
|
+
}
|
|
18933
|
+
};
|
|
18934
|
+
function inlineExecPatterns(lang, flags) {
|
|
18935
|
+
const { ext, patterns } = INLINE_LANG_CONFIG[lang];
|
|
18936
|
+
const reason = `Inline ${lang} is hard to audit. For JSON, prefer \`jq\`. For reuse, save to scripts/*.${ext} and run it.`;
|
|
18937
|
+
const flagAlt = flags.map((f) => f.replace(/^\^/, "").replace(/\$$/, "")).join("|");
|
|
18938
|
+
const compound = `(?:^|\\s)(?:${flagAlt})[\\s=][^\\n]{0,16000}?(?:${patterns.join("|")})`;
|
|
18939
|
+
return [
|
|
18940
|
+
{ match: { argsMatch: [compound] }, decision: "ask", reason },
|
|
18941
|
+
{
|
|
18942
|
+
match: { anyArgMatches: flags },
|
|
18943
|
+
decision: "allow",
|
|
18944
|
+
description: `Plausibly read-only inline ${lang} script`
|
|
18945
|
+
}
|
|
18946
|
+
];
|
|
18947
|
+
}
|
|
18863
18948
|
function pkgManagerRule(command, extraSafeCmds = []) {
|
|
18864
18949
|
const safeCmds = [...SAFE_PKG_MANAGER_CMDS, ...extraSafeCmds];
|
|
18865
18950
|
return {
|
|
@@ -19243,7 +19328,7 @@ var DEFAULT_CONFIG = {
|
|
|
19243
19328
|
command: "node",
|
|
19244
19329
|
default: "ask",
|
|
19245
19330
|
argPatterns: [
|
|
19246
|
-
|
|
19331
|
+
...inlineExecPatterns("JavaScript", ["^-e$", "^--eval", "^-p$", "^--print"]),
|
|
19247
19332
|
{ match: { anyArgMatches: ["^--(version|help)$", "^-[vh]$"] }, decision: "allow", description: "Version/help flags" },
|
|
19248
19333
|
{ match: { noArgs: true }, decision: "ask", reason: "Interactive REPL" }
|
|
19249
19334
|
]
|
|
@@ -19272,6 +19357,7 @@ var DEFAULT_CONFIG = {
|
|
|
19272
19357
|
command: cmd,
|
|
19273
19358
|
default: "ask",
|
|
19274
19359
|
argPatterns: [
|
|
19360
|
+
...inlineExecPatterns("Python", ["^-c$"]),
|
|
19275
19361
|
{ match: { anyArgMatches: ["^--(version|help)$", "^-V$"] }, decision: "allow" }
|
|
19276
19362
|
]
|
|
19277
19363
|
})),
|
|
@@ -19430,14 +19516,9 @@ var DEFAULT_CONFIG = {
|
|
|
19430
19516
|
argPatterns: [VERSION_HELP_FLAGS]
|
|
19431
19517
|
})),
|
|
19432
19518
|
// --- Scripting languages ---
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
argPatterns: [
|
|
19437
|
-
{ match: { anyArgMatches: ["^-e$", "^--eval"] }, decision: "ask", reason: "Inline code execution" },
|
|
19438
|
-
VERSION_HELP_FLAGS
|
|
19439
|
-
]
|
|
19440
|
-
})),
|
|
19519
|
+
{ command: "ruby", default: "ask", argPatterns: [...inlineExecPatterns("Ruby", ["^-e$", "^--eval"]), VERSION_HELP_FLAGS] },
|
|
19520
|
+
{ command: "perl", default: "ask", argPatterns: [...inlineExecPatterns("Perl", ["^-e$", "^-E$"]), VERSION_HELP_FLAGS] },
|
|
19521
|
+
{ command: "php", default: "ask", argPatterns: [...inlineExecPatterns("PHP", ["^-r$"]), VERSION_HELP_FLAGS] },
|
|
19441
19522
|
// --- Java ecosystem ---
|
|
19442
19523
|
{ command: "java", default: "ask", argPatterns: [VERSION_HELP_FLAGS] },
|
|
19443
19524
|
{ command: "javac", default: "allow" },
|