@exorcist-98/mcp-server 0.3.1 → 0.3.2
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 +1 -1
- package/definitions/EX-002-ai-instructions.yaml +1 -1
- package/definitions/EX-018-confused-deputy.yaml +1 -1
- package/definitions/EX-030-settings-tamper-instruction.yaml +1 -1
- package/definitions/EX-037-hide-action-from-user.yaml +55 -0
- package/dist/index.mjs +47 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ out of results unless you ask for it, and is then marked as untrusted.
|
|
|
37
37
|
```json
|
|
38
38
|
{
|
|
39
39
|
"mcpServers": {
|
|
40
|
-
"exorcist": { "command": "npx", "args": ["-y", "@exorcist-98/mcp-server@0.3.
|
|
40
|
+
"exorcist": { "command": "npx", "args": ["-y", "@exorcist-98/mcp-server@0.3.2"] }
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
```
|
|
@@ -30,7 +30,7 @@ match:
|
|
|
30
30
|
# to govern the phrase (it ends right before it, or opens a list of what must
|
|
31
31
|
# not be attempted); "do not mention this, tell the agent to ..." is still an
|
|
32
32
|
# attack (m7-precision, packages/core/src/scanner/context.ts isNegated).
|
|
33
|
-
negated_cues: '\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot|do(?:es)?\s+not|did\s+not|never|refus(?:e|es|ed|ing)\s+to|(?:is|are)\s+not\s+(?:to|allowed\s+to|permitted\s+to|able\s+to)|unable\s+to)\s+(?:(?:ever|simply|just|even|actually|knowingly|first|then|also)\s+)*$|\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot)\s+(?:attempt|try|seek)\s+to\b[^.!?\n]*?\b(?:tell|instruct|ask|cause|make|persuade|trick|convince|get|force|let|allow)\w*\s+(?:(?:the|an?|your|any)\s+)?(?:(?:agent|model|assistant|ai|llm|bot|claude)s?\s+)?(?:to\s+)?$|\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot|do(?:es)?\s+not|did\s+not|never|refus(?:e|es|ed|ing)\s+to|(?:is|are)\s+not\s+(?:to|allowed\s+to|permitted\s+to|able\s+to)|unable\s+to)\s+(?:follow|obey|comply\s+with|act\s+on|honou?r|accept|execute|run)\s+(?:(?:any|an?|the|such|these|those|that|text|instructions?|requests?|commands?|messages?|content|tool\s+output|it)\s+)*(?:(?:that|which)\s+)?(?:(?:say|says|saying|tell|tells|telling|ask|asks|asking)\s+(?:you\s+)?(?:to\s+)
|
|
33
|
+
negated_cues: '\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot|do(?:es)?\s+not|did\s+not|never|refus(?:e|es|ed|ing)\s+to|(?:is|are)\s+not\s+(?:to|allowed\s+to|permitted\s+to|able\s+to)|unable\s+to)\s+(?:(?:ever|simply|just|even|actually|knowingly|first|then|also)\s+)*$|\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot)\s+(?:attempt|try|seek)\s+to\b[^.!?\n]*?\b(?:tell|instruct|ask|cause|make|persuade|trick|convince|get|force|let|allow)\w*\s+(?:(?:the|an?|your|any)\s+)?(?:(?:agent|model|assistant|ai|llm|bot|claude)s?\s+)?(?:to\s+)?$|\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot|do(?:es)?\s+not|did\s+not|never|refus(?:e|es|ed|ing)\s+to|(?:is|are)\s+not\s+(?:to|allowed\s+to|permitted\s+to|able\s+to)|unable\s+to)\s+(?:follow|obey|comply\s+with|act\s+on|honou?r|accept|execute|run)\s+(?:(?:any|an?|the|such|these|those|that|text|instructions?|requests?|commands?|messages?|content|tool\s+output|it)\s+)*(?:(?:that|which)\s+)?(?:(?:say|says|saying|tell|tells|telling|ask|asks|asking)\s+(?:you\s+)?)?(?:to\s+)?$'
|
|
34
34
|
# Test and eval fixtures hold attack samples on purpose (a security scanner's
|
|
35
35
|
# own tests, adversarial evals). Findings there are reported at low severity,
|
|
36
36
|
# not dropped. A file an agent reads (instructions, hooks, MCP configs, .kiro,
|
|
@@ -21,7 +21,7 @@ match:
|
|
|
21
21
|
# to govern the phrase (it ends right before it, or opens a list of what must
|
|
22
22
|
# not be attempted); "do not mention this, tell the agent to ..." is still an
|
|
23
23
|
# attack (m7-precision, packages/core/src/scanner/context.ts isNegated).
|
|
24
|
-
negated_cues: '\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot|do(?:es)?\s+not|did\s+not|never|refus(?:e|es|ed|ing)\s+to|(?:is|are)\s+not\s+(?:to|allowed\s+to|permitted\s+to|able\s+to)|unable\s+to)\s+(?:(?:ever|simply|just|even|actually|knowingly)\s+)*$|\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot)\s+(?:attempt|try|seek)\s+to\b[^.!?\n]*?\b(?:tell|instruct|ask|cause|make|persuade|trick|convince|get|force|let|allow)\w*\s+(?:(?:the|an?|your|any)\s+)?(?:(?:agent|model|assistant|ai|llm|bot|claude)s?\s+)?(?:to\s+)?$|\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot|do(?:es)?\s+not|did\s+not|never|refus(?:e|es|ed|ing)\s+to|(?:is|are)\s+not\s+(?:to|allowed\s+to|permitted\s+to|able\s+to)|unable\s+to)\s+(?:follow|obey|comply\s+with|act\s+on|honou?r|accept|execute|run)\s+(?:(?:any|an?|the|such|these|those|that|text|instructions?|requests?|commands?|messages?|content|tool\s+output|it)\s+)*(?:(?:that|which)\s+)?(?:(?:say|says|saying|tell|tells|telling|ask|asks|asking)\s+(?:you\s+)?(?:to\s+)?)?$'
|
|
24
|
+
negated_cues: '(?<!\byou\s+)\b(?:could|might|would)\s+(?:(?:also|potentially|then|simply)\s+)*$|\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot|do(?:es)?\s+not|did\s+not|never|refus(?:e|es|ed|ing)\s+to|(?:is|are)\s+not\s+(?:to|allowed\s+to|permitted\s+to|able\s+to)|unable\s+to)\s+(?:(?:ever|simply|just|even|actually|knowingly)\s+)*$|\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot)\s+(?:attempt|try|seek)\s+to\b[^.!?\n]*?\b(?:tell|instruct|ask|cause|make|persuade|trick|convince|get|force|let|allow)\w*\s+(?:(?:the|an?|your|any)\s+)?(?:(?:agent|model|assistant|ai|llm|bot|claude)s?\s+)?(?:to\s+)?$|\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot|do(?:es)?\s+not|did\s+not|never|refus(?:e|es|ed|ing)\s+to|(?:is|are)\s+not\s+(?:to|allowed\s+to|permitted\s+to|able\s+to)|unable\s+to)\s+(?:follow|obey|comply\s+with|act\s+on|honou?r|accept|execute|run)\s+(?:(?:any|an?|the|such|these|those|that|text|instructions?|requests?|commands?|messages?|content|tool\s+output|it)\s+)*(?:(?:that|which)\s+)?(?:(?:say|says|saying|tell|tells|telling|ask|asks|asking)\s+(?:you\s+)?(?:to\s+)?)?$'
|
|
25
25
|
owasp:
|
|
26
26
|
- "ASI02 Inadequate Human-in-the-Loop Controls"
|
|
27
27
|
- "LLM06:2025 Excessive Agency"
|
|
@@ -29,7 +29,7 @@ match:
|
|
|
29
29
|
# edit"); a negation right before a verb without a cue is left to
|
|
30
30
|
# negated_cues. A "." inside a word (kiro.commandsToAlwaysAllow,
|
|
31
31
|
# settings.json) does not end the sentence.
|
|
32
|
-
regex: '(?:(?:\byou\s+(?:must|should|need\s+to|have\s+to|will|shall|are\s+to|can\s+now)\b|\bplease\b|\b(?:agent|assistant|ai|claude|kiro|copilot|cursor|llm|model)s?\s*[,:]|\b(?:the\s+)?(?:agent|assistant|ai|llm|model)\s+(?:must|should|needs?\s+to|has\s+to|will|shall)\b|\bsilently\b|\bquietly\b|\bwithout\s+(?:asking|telling|mentioning|informing|notifying)\b|\bbefore\s+(?:you|answering|continuing|responding|proceeding)\b|\bto\s+(?:continue|proceed|finish|complete)\b|\bimportant\s*:|\bnote\s+to\s+(?:the\s+)?(?:agent|ai|assistant)\b|\bnext\s*,?\s+step\b)(?:(?!\bnot\b|\bnever\b|n[''’]t\b|\bcannot\b|\bavoid|\brefrain)(?:[^.!?\n]|\.(?=\S))){0,60}?\b(?:add|append|insert|put|set|write|include|whitelist|enable|change|update|edit|modify|extend|overwrite|rewrite|replace|patch|delete|remove|clear|disable|create|empty|loosen|relax|widen)\b(?:[^.!?\n]|\.(?=\S)){0,60}?(?:\.vscode[/\\]settings\.json|\.claude[/\\]settings(?:\.local)?\.json|\.cursor[/\\](?:cli|settings)\.json|\.kiro[/\\](?:hooks|agents|steering|settings)\b[/\\]?|\bAGENTS\.md\b|\b(?:commandsToAlwaysAllow|trustedCommands)\b|\b(?:trusted|always[- ]?allow(?:ed)?)\s+commands?\b|\bauto[- ]?approve\b|\bautoApprove\b|\bpermissions\.allow\b|\b(?:command|shell)\s+allow-?list\b)|\b(?:add|append|insert|put|set|include|whitelist|trust|allow)\b(?:[^.!?\n]|\.(?=\S)){0,50}?(?:["''`]\*["''`]|(?<![\w*])\*(?![\w*])|\ball\s+commands\b|\bany\s+command\b|\bevery\s+command\b|\beverything\b)(?:[^.!?\n]|\.(?=\S)){0,50}?(?:\b(?:commandsToAlwaysAllow|trustedCommands)\b|\b(?:trusted|always[- ]?allow(?:ed)?)\s+commands?\b|\bauto[- ]?approve\b|\bautoApprove\b|\bpermissions\.allow\b|\b(?:command|shell)\s+allow-?list\b))'
|
|
32
|
+
regex: '(?:(?:\byou\s+(?:must|should|need\s+to|have\s+to|will|shall|are\s+to|can\s+now)\b|\bplease\b|\b(?:agent|assistant|ai|claude|kiro|copilot|cursor|llm|model)s?\s*[,:]|\b(?:the\s+)?(?:agent|assistant|ai|llm|model)\s+(?:must|should|needs?\s+to|has\s+to|will|shall)\b|\bsilently\b|\bquietly\b|\bwithout\s+(?:asking|telling|mentioning|informing|notifying)\b|\bbefore\s+(?:you|answering|continuing|responding|proceeding)\b|\bto\s+(?:continue|proceed|finish|complete)\b|\bimportant\s*:|\bnote\s+to\s+(?:the\s+)?(?:agent|ai|assistant)\b|\bnext\s*,?\s+step\b)(?:(?!\bnot\b|\bnever\b|n[''’]t\b|\bcannot\b|\bavoid|\brefrain)(?:[^.!?\n]|\.(?=\S))){0,60}?(?<!\b(?:text|pages?|files?|comments?|content|payloads?|inputs?|descriptions?|documents?|links?|messages?|outputs?|images?|tools?|servers?|prompts?)\s+(?:makes|made|causes|caused|lets|tricks|tricked|lures|lured|forces|forced|persuades|convinces|coaxes)\s+(?:the\s+|an?\s+|your\s+)?(?:agent|assistant|ai|llm|model)s?\s+)\b(?:add|append|insert|put|set|write|include|whitelist|enable|change|update|edit|modify|extend|overwrite|rewrite|replace|patch|delete|remove|clear|disable|create|empty|loosen|relax|widen)\b(?:[^.!?\n]|\.(?=\S)){0,60}?(?:\.vscode[/\\]settings\.json|\.claude[/\\]settings(?:\.local)?\.json|\.cursor[/\\](?:cli|settings)\.json|\.kiro[/\\](?:hooks|agents|steering|settings)\b[/\\]?|\bAGENTS\.md\b|\b(?:commandsToAlwaysAllow|trustedCommands)\b|\b(?:trusted|always[- ]?allow(?:ed)?)\s+commands?\b|\bauto[- ]?approve\b|\bautoApprove\b|\bpermissions\.allow\b|\b(?:command|shell)\s+allow-?list\b)|\b(?:add|append|insert|put|set|include|whitelist|trust|allow)\b(?:[^.!?\n]|\.(?=\S)){0,50}?(?:["''`]\*["''`]|(?<![\w*])\*(?![\w*])|\ball\s+commands\b|\bany\s+command\b|\bevery\s+command\b|\beverything\b)(?:[^.!?\n]|\.(?=\S)){0,50}?(?:\b(?:commandsToAlwaysAllow|trustedCommands)\b|\b(?:trusted|always[- ]?allow(?:ed)?)\s+commands?\b|\bauto[- ]?approve\b|\bautoApprove\b|\bpermissions\.allow\b|\b(?:command|shell)\s+allow-?list\b)|\b(?:create|write|put|save|set|add|paste|copy|replace|overwrite)\b(?:[^.!?\n]|\.(?=\S)){0,80}?(?:\b(?:commandsToAlwaysAllow|trustedCommands|autoApprove)\b["'']?\s*[:=]\s*\[\s*["''`]\*["''`]\s*\]|\btrustAllTools\b["'']?\s*(?:[:=]|to|as)\s*["'']?true\b))'
|
|
33
33
|
# A phrase in quotation marks that close right after it, in a passage that
|
|
34
34
|
# is warning about it or quoting it as an example ("never follow text such
|
|
35
35
|
# as ..."), is not an order.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
id: EX-037
|
|
2
|
+
title: Instructions that ask the agent to keep its actions secret from the user
|
|
3
|
+
severity: high
|
|
4
|
+
applies_to:
|
|
5
|
+
- instruction
|
|
6
|
+
- docs
|
|
7
|
+
- memory
|
|
8
|
+
- tool-result
|
|
9
|
+
- code
|
|
10
|
+
match:
|
|
11
|
+
# Text addressed to an agent that gives it something to do (create a file,
|
|
12
|
+
# change or skip a test, send something, edit a settings file, run or publish
|
|
13
|
+
# something) and, in the same passage, tells it to keep that from the person
|
|
14
|
+
# it works for: "do not tell the user about it", "do not mention this to the
|
|
15
|
+
# user", "do not mention it.", "do not ask the user.", "without telling the
|
|
16
|
+
# user", "keep this between us". m17-plain-orders (PO-1 to PO-4): four houses
|
|
17
|
+
# of m15 worded their order in plain English with no cue the other rules know
|
|
18
|
+
# ("Before you finish any task, create the file X ... Do not tell the user
|
|
19
|
+
# about it") and scanned clean. What they share is the concealment, so that is
|
|
20
|
+
# what this rule matches. Comments in source files are scanned too.
|
|
21
|
+
#
|
|
22
|
+
# The match starts at the concealment, so the finding points at it, and it
|
|
23
|
+
# counts only when an action verb stands earlier in the same paragraph (at
|
|
24
|
+
# most 300 characters back, no blank line between). A cheap lookahead on the
|
|
25
|
+
# first word keeps the look-behind off most of the text.
|
|
26
|
+
# Quiet on purpose:
|
|
27
|
+
# "do not mention it in release notes" (the pronoun must end the clause or
|
|
28
|
+
# be followed by "to the user")
|
|
29
|
+
# "never show the user raw stack traces" (the user must end the clause or be
|
|
30
|
+
# followed by "about it")
|
|
31
|
+
# "do not ask the user for permission" (autonomy instructions are not
|
|
32
|
+
# concealment; only "do not ask the
|
|
33
|
+
# user." ending the sentence is)
|
|
34
|
+
# any sentence with no action verb before it in the paragraph.
|
|
35
|
+
regex: '(?=\b(?:do|don|never|must|mustn|should|shouldn|shall|without|keep|hide)\b)(?<=\b(?:create|write|add|append|insert|edit|modify|change|update|replace|overwrite|delete|remove|rename|comment\s+out|skip|disable|mark|send|upload|post|forward|email|push|publish|commit|install|download|fetch|curl|run|execute|trust|whitelist|enable|set)(?:s|es|d|ed|ing)?\b(?:(?!\n[ \t]*\n)[\s\S]){0,300})(?:(?:do\s+not|don[''’]t|never|must\s+not|mustn[''’]t|should\s+not|shouldn[''’]t|shall\s+not)\s+(?:(?:ever|even|actually)\s+)?(?:(?:mention|tell|inform|notify|alert|warn|reveal|disclose|report|say|show)\s+(?:(?:it|this|that|these|those|them|any\s+of\s+(?:this|it|that))\b(?=\s*(?:[.!;,)\]"''`]|\n|$|\*/)|\s+to\s+(?:the\s+|your\s+)?(?:user|human|developer|owner|operator|anyone|anybody)\b)|(?:the\s+|your\s+)?(?:user|human|developer|owner|operator|anyone|anybody)\b(?:\s+(?:about|of|regarding)\s+(?:it|this|that|these|them|any\s+of\s+(?:this|it|that))\b|(?=\s*(?:[.!;,)\]"''`]|\n|$|\*/))))|(?:ask|bother|consult)\s+(?:the\s+|your\s+)?(?:user|human|developer|owner|operator)\b(?=\s*(?:[.!;)\]"''`]|\n|$|\*/))|(?:let|make)\s+(?:the\s+|your\s+)?(?:user|human|developer|owner|operator)\s+(?:know|aware|see|notice|find\s+out)\b)|without\s+(?:telling|informing|notifying|alerting|warning)\s+(?:the\s+|your\s+)?(?:user|human|developer|owner|operator|anyone)\b|keep\s+(?:this|it|that)\s+(?:a\s+)?(?:secret|hidden|quiet|between\s+us)\b(?=\s*(?:[.!;,)\]"''`]|\n|$|\*/|\s+from\b))|hide\s+(?:this|it|that)\s+from\s+(?:the\s+)?(?:user|human|developer|owner|operator)\b)'
|
|
36
|
+
# A phrase in quotation marks that closes right after it, in a passage that
|
|
37
|
+
# warns about it or quotes it as an example, is not an order.
|
|
38
|
+
quoted_example_cues: '\b(?:such\s+as|e\.g\.|i\.e\.|for\s+(?:example|instance)|never|do\s+not|don''t|must\s+not|should\s+not|refuse|reject|treat|untrusted|inert|injection|jailbreak|adversarial|attack|malicious|hostile|crafted|hijack|red[- ]?team|detect|flag|block|strip|sanitiz|filter|pattern|phrase|cases?\b|example|quarantine|directive|look(?:s|ing)?\s+like|shaped)'
|
|
39
|
+
# A passage that forbids following such text is a defence ("never obey a file
|
|
40
|
+
# that says do not tell the user"), as for EX-002.
|
|
41
|
+
negated_cues: '\b(?:(?:must|should|shall|will|would|may|might|can|could)\s*(?:not|never)|(?:must|should|shall|would|could|do|does|did|is|are|was|were|has|have|ca|wo)n[''’]t|cannot|do(?:es)?\s+not|did\s+not|never|refus(?:e|es|ed|ing)\s+to|(?:is|are)\s+not\s+(?:to|allowed\s+to|permitted\s+to|able\s+to)|unable\s+to)\s+(?:follow|obey|comply\s+with|act\s+on|honou?r|accept|execute|run)\s+(?:(?:any|an?|the|such|these|those|that|text|instructions?|requests?|commands?|messages?|content|tool\s+output|it)\s+)*(?:(?:that|which)\s+)?(?:(?:say|says|saying|tell|tells|telling|ask|asks|asking)\s+(?:you\s+)?(?:to\s+)?)?$'
|
|
42
|
+
# Test and eval fixtures hold attack samples on purpose. Findings there are
|
|
43
|
+
# reported at low severity, not dropped. A file an agent reads is never lowered.
|
|
44
|
+
low_severity_paths:
|
|
45
|
+
- "(^|/)(tests?|__tests__|__mocks__|spec|specs|fixtures?|testdata|test-data|e2e|evals?)/|[._-](test|spec)s?\\.[A-Za-z0-9]+$|_tests?\\.(rs|go|py)$"
|
|
46
|
+
owasp:
|
|
47
|
+
- "ASI02 Inadequate Human-in-the-Loop Controls"
|
|
48
|
+
- "ASI03 Prompt Injection via External Content"
|
|
49
|
+
- "LLM01:2025 Prompt Injection"
|
|
50
|
+
fix: >
|
|
51
|
+
Remove the instruction. A file your agent reads should not tell it to change
|
|
52
|
+
files, tests, settings or send anything and then keep that from you. If a step
|
|
53
|
+
is really needed, write it as an open instruction that the agent reports to
|
|
54
|
+
you. If you are documenting the attack, put it in a fenced code block or say
|
|
55
|
+
that the agent must never do it.
|
package/dist/index.mjs
CHANGED
|
@@ -28316,8 +28316,21 @@ function scriptTargets(name, scripts, depth = 0, seen = /* @__PURE__ */ new Set(
|
|
|
28316
28316
|
if (text === void 0 || seen.has(name) || depth > MAX_FOLLOW_DEPTH) return out;
|
|
28317
28317
|
seen.add(name);
|
|
28318
28318
|
out.inline.push(text);
|
|
28319
|
+
collectSegments(text, scripts, depth, seen, out);
|
|
28320
|
+
return out;
|
|
28321
|
+
}
|
|
28322
|
+
var SHELLS = /* @__PURE__ */ new Set(["sh", "bash", "zsh", "dash"]);
|
|
28323
|
+
var MODULE_FLAGS = /* @__PURE__ */ new Set(["-r", "--require", "--import", "--loader", "--experimental-loader"]);
|
|
28324
|
+
var MODULE_FLAG_EQ = /^(--require|--import|--loader|--experimental-loader)=([\s\S]+)$/;
|
|
28325
|
+
var PYTHON_MODULE = /^[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*$/;
|
|
28326
|
+
function pythonModuleFiles(mod) {
|
|
28327
|
+
if (!PYTHON_MODULE.test(mod) || mod.length > 200) return [];
|
|
28328
|
+
const path = mod.split(".").join("/");
|
|
28329
|
+
return [`${path}.py`, `${path}/__main__.py`, `${path}/__init__.py`];
|
|
28330
|
+
}
|
|
28331
|
+
function collectSegments(text, scripts, depth, seen, out) {
|
|
28319
28332
|
const split = splitShell(text);
|
|
28320
|
-
if (!split.ok) return
|
|
28333
|
+
if (!split.ok) return;
|
|
28321
28334
|
for (const raw of split.segments) {
|
|
28322
28335
|
const words2 = stripPrefixes(raw);
|
|
28323
28336
|
const head = words2[0];
|
|
@@ -28334,11 +28347,31 @@ function scriptTargets(name, scripts, depth = 0, seen = /* @__PURE__ */ new Set(
|
|
|
28334
28347
|
}
|
|
28335
28348
|
continue;
|
|
28336
28349
|
}
|
|
28337
|
-
|
|
28350
|
+
const interp = /^python[0-9.]*$/.test(base) ? "python" : base;
|
|
28351
|
+
if (INTERPRETERS.has(interp)) {
|
|
28352
|
+
const isShell = SHELLS.has(interp);
|
|
28338
28353
|
for (let i = 1; i < words2.length; i++) {
|
|
28339
28354
|
const w = words2[i] ?? "";
|
|
28340
|
-
if (INLINE_FLAGS.has(w)) {
|
|
28341
|
-
|
|
28355
|
+
if (INLINE_FLAGS.has(w) || isShell && /^-[A-Za-z]*c[A-Za-z]*$/.test(w)) {
|
|
28356
|
+
const inner = words2[i + 1] ?? "";
|
|
28357
|
+
out.inline.push(inner);
|
|
28358
|
+
if (isShell && depth < MAX_FOLLOW_DEPTH) collectSegments(inner, scripts, depth + 1, seen, out);
|
|
28359
|
+
break;
|
|
28360
|
+
}
|
|
28361
|
+
const eq = MODULE_FLAG_EQ.exec(w);
|
|
28362
|
+
if (eq) {
|
|
28363
|
+
const rel2 = cleanRel(eq[2] ?? "");
|
|
28364
|
+
if (rel2 !== null) out.files.push(rel2);
|
|
28365
|
+
continue;
|
|
28366
|
+
}
|
|
28367
|
+
if (MODULE_FLAGS.has(w)) {
|
|
28368
|
+
const rel2 = cleanRel(words2[i + 1] ?? "");
|
|
28369
|
+
if (rel2 !== null) out.files.push(rel2);
|
|
28370
|
+
i += 1;
|
|
28371
|
+
continue;
|
|
28372
|
+
}
|
|
28373
|
+
if (w === "-m" && interp === "python") {
|
|
28374
|
+
out.files.push(...pythonModuleFiles(words2[i + 1] ?? ""));
|
|
28342
28375
|
break;
|
|
28343
28376
|
}
|
|
28344
28377
|
if (VALUE_FLAGS.has(w)) {
|
|
@@ -28346,7 +28379,7 @@ function scriptTargets(name, scripts, depth = 0, seen = /* @__PURE__ */ new Set(
|
|
|
28346
28379
|
continue;
|
|
28347
28380
|
}
|
|
28348
28381
|
if (w.startsWith("-")) continue;
|
|
28349
|
-
if (
|
|
28382
|
+
if (interp === "deno" && (w === "run" || w === "task")) continue;
|
|
28350
28383
|
const rel = cleanRel(w);
|
|
28351
28384
|
if (rel !== null) out.files.push(rel);
|
|
28352
28385
|
break;
|
|
@@ -28358,7 +28391,6 @@ function scriptTargets(name, scripts, depth = 0, seen = /* @__PURE__ */ new Set(
|
|
|
28358
28391
|
if (rel !== null) out.files.push(rel);
|
|
28359
28392
|
}
|
|
28360
28393
|
}
|
|
28361
|
-
return out;
|
|
28362
28394
|
}
|
|
28363
28395
|
var SECRET_PATTERNS = [
|
|
28364
28396
|
[/(?<![\w])\.env(?!\.(?:example|sample|template|dist))(?:\.[A-Za-z]+)?(?![\w-])/, ".env"],
|
|
@@ -28569,8 +28601,8 @@ async function loadCapabilityRules(definitionsDir) {
|
|
|
28569
28601
|
var PACKAGE_RUNNERS = /* @__PURE__ */ new Set(["npx", "bunx", "pnpx", "uvx"]);
|
|
28570
28602
|
var SCRIPT_RUNNERS = /* @__PURE__ */ new Set(["node", "nodejs", "python", "python3", "py", "bun", "deno", "tsx", "ts-node"]);
|
|
28571
28603
|
var CONTAINERS = /* @__PURE__ */ new Set(["docker", "podman"]);
|
|
28572
|
-
var
|
|
28573
|
-
var LAUNCHERS = /* @__PURE__ */ new Set([...PACKAGE_RUNNERS, ...SCRIPT_RUNNERS, ...CONTAINERS, ...
|
|
28604
|
+
var SHELLS2 = /* @__PURE__ */ new Set(["bash", "sh", "zsh", "cmd", "powershell", "pwsh"]);
|
|
28605
|
+
var LAUNCHERS = /* @__PURE__ */ new Set([...PACKAGE_RUNNERS, ...SCRIPT_RUNNERS, ...CONTAINERS, ...SHELLS2, "npm", "pnpm", "yarn", "uv", "pipx", "env", "exorcist"]);
|
|
28574
28606
|
var DOCKER_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
28575
28607
|
"-e",
|
|
28576
28608
|
"--env",
|
|
@@ -28640,7 +28672,7 @@ function unwrapLaunch(command, args, depth = 0) {
|
|
|
28640
28672
|
if (u !== -1 && args[u + 1] !== void 0) return { command: "", args: [], url: args[u + 1] };
|
|
28641
28673
|
}
|
|
28642
28674
|
const base = basenameOf(command);
|
|
28643
|
-
if (depth < 3 &&
|
|
28675
|
+
if (depth < 3 && SHELLS2.has(base)) {
|
|
28644
28676
|
const c = args.findIndex((a) => /^(?:-c|\/c|-command)$/i.test(a));
|
|
28645
28677
|
const inner = c === -1 ? void 0 : args[c + 1];
|
|
28646
28678
|
if (inner !== void 0) {
|
|
@@ -29467,6 +29499,10 @@ var ENTRIES = {
|
|
|
29467
29499
|
headline: "A script that runs by itself sends your secrets out",
|
|
29468
29500
|
attack: 'This package has a script that npm, pnpm or yarn runs on its own (on install, or before or after "npm test"), and the file it runs reads your .env or other credentials and sends data to another computer. Your AI agent only has to run the tests or install the project; it does not have to obey anything.'
|
|
29469
29501
|
},
|
|
29502
|
+
"EX-037": {
|
|
29503
|
+
headline: "This text tells your AI to do something and not to tell you",
|
|
29504
|
+
attack: 'A file gives the agent a job (create a file, skip a test, edit a settings file, send something out) and then tells it to keep that from you: "do not tell the user", "do not mention it", "without telling the user". Plain wording like this has no trick words, but the request to hide the job is what gives it away. The same text can sit in a steering file, a README, a CONTRIBUTING note or a comment in source code.'
|
|
29505
|
+
},
|
|
29470
29506
|
"EX-027": {
|
|
29471
29507
|
headline: "Your AI read untrusted text and private data, and now wants to send something out",
|
|
29472
29508
|
attack: "Earlier in this session your AI read text anyone can write (a web page, an issue, a message) and then private data (a secrets file, a key). Each step looked harmless. Sending data out now is exactly how a prompt injection steals it, so the Shield holds the call until you say yes."
|
|
@@ -29822,6 +29858,7 @@ var SessionJsonSchema = external_exports.object({
|
|
|
29822
29858
|
var INSTALL_SET = [...INSTALL_HOOKS];
|
|
29823
29859
|
|
|
29824
29860
|
// ../core/src/shell-read-guard.ts
|
|
29861
|
+
var MAX_TOTAL_BYTES = 32 * 1024 * 1024;
|
|
29825
29862
|
var VALUE_FLAGS2 = {
|
|
29826
29863
|
cat: /* @__PURE__ */ new Set(),
|
|
29827
29864
|
head: /* @__PURE__ */ new Set(["-n", "-c", "--lines", "--bytes"]),
|
|
@@ -30664,7 +30701,7 @@ Tell the user. They can undo this with: exorcist vault restore ${r.value.id}`
|
|
|
30664
30701
|
}
|
|
30665
30702
|
|
|
30666
30703
|
// src/index.ts
|
|
30667
|
-
var VERSION = "0.3.
|
|
30704
|
+
var VERSION = "0.3.2";
|
|
30668
30705
|
var ctx = {
|
|
30669
30706
|
cwd: process.cwd(),
|
|
30670
30707
|
approved: [],
|