@exorcist-98/cli 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 +8 -8
- 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 +109 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Needs Node 20 or newer.
|
|
|
11
11
|
## Scan a project
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
npx -y @exorcist-98/cli@0.3.
|
|
14
|
+
npx -y @exorcist-98/cli@0.3.2 scan .
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Every finding shows the file, line, the exact text, how serious it is and how
|
|
@@ -39,7 +39,7 @@ request.
|
|
|
39
39
|
## Map the haunted house
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
npx -y @exorcist-98/cli@0.3.
|
|
42
|
+
npx -y @exorcist-98/cli@0.3.2 map .
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
For every MCP config in the folder, lists which servers sit in the three rooms
|
|
@@ -52,8 +52,8 @@ data. The rules are in `definitions/capabilities.yaml`.
|
|
|
52
52
|
## Disinfect (exorcise)
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
|
-
npx -y @exorcist-98/cli@0.3.
|
|
56
|
-
npx -y @exorcist-98/cli@0.3.
|
|
55
|
+
npx -y @exorcist-98/cli@0.3.2 exorcise . # dry run: prints a unified diff
|
|
56
|
+
npx -y @exorcist-98/cli@0.3.2 exorcise . --write # apply, with a vault backup first
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Only threats with one safe, mechanical fix are repaired: hidden characters
|
|
@@ -67,7 +67,7 @@ human"), and `exorcist vault restore <id>` puts every file back byte for byte.
|
|
|
67
67
|
## Protect your MCP servers
|
|
68
68
|
|
|
69
69
|
```sh
|
|
70
|
-
npx -y @exorcist-98/cli@0.3.
|
|
70
|
+
npx -y @exorcist-98/cli@0.3.2 wrap .kiro/settings/mcp.json
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
`wrap` puts every server in the file, local or remote, behind the Real-Time
|
|
@@ -79,9 +79,9 @@ instruct your agent. `unwrap` restores the file exactly. See
|
|
|
79
79
|
## Share approved tools with your team: exorcist.lock
|
|
80
80
|
|
|
81
81
|
```sh
|
|
82
|
-
npx -y @exorcist-98/cli@0.3.
|
|
83
|
-
npx -y @exorcist-98/cli@0.3.
|
|
84
|
-
npx -y @exorcist-98/cli@0.3.
|
|
82
|
+
npx -y @exorcist-98/cli@0.3.2 lock # write exorcist.lock, then commit it
|
|
83
|
+
npx -y @exorcist-98/cli@0.3.2 lock --check # exit 1 if any tool or program changed
|
|
84
|
+
npx -y @exorcist-98/cli@0.3.2 lock --check --static # starts nothing: names, programs, URLs only
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
`exorcist.lock` records the fingerprint of every tool your MCP servers list,
|
|
@@ -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
|
@@ -19083,8 +19083,21 @@ function scriptTargets(name, scripts, depth = 0, seen = /* @__PURE__ */ new Set(
|
|
|
19083
19083
|
if (text === void 0 || seen.has(name) || depth > MAX_FOLLOW_DEPTH) return out;
|
|
19084
19084
|
seen.add(name);
|
|
19085
19085
|
out.inline.push(text);
|
|
19086
|
+
collectSegments(text, scripts, depth, seen, out);
|
|
19087
|
+
return out;
|
|
19088
|
+
}
|
|
19089
|
+
var SHELLS = /* @__PURE__ */ new Set(["sh", "bash", "zsh", "dash"]);
|
|
19090
|
+
var MODULE_FLAGS = /* @__PURE__ */ new Set(["-r", "--require", "--import", "--loader", "--experimental-loader"]);
|
|
19091
|
+
var MODULE_FLAG_EQ = /^(--require|--import|--loader|--experimental-loader)=([\s\S]+)$/;
|
|
19092
|
+
var PYTHON_MODULE = /^[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*$/;
|
|
19093
|
+
function pythonModuleFiles(mod) {
|
|
19094
|
+
if (!PYTHON_MODULE.test(mod) || mod.length > 200) return [];
|
|
19095
|
+
const path = mod.split(".").join("/");
|
|
19096
|
+
return [`${path}.py`, `${path}/__main__.py`, `${path}/__init__.py`];
|
|
19097
|
+
}
|
|
19098
|
+
function collectSegments(text, scripts, depth, seen, out) {
|
|
19086
19099
|
const split = splitShell(text);
|
|
19087
|
-
if (!split.ok) return
|
|
19100
|
+
if (!split.ok) return;
|
|
19088
19101
|
for (const raw of split.segments) {
|
|
19089
19102
|
const words3 = stripPrefixes(raw);
|
|
19090
19103
|
const head = words3[0];
|
|
@@ -19101,11 +19114,31 @@ function scriptTargets(name, scripts, depth = 0, seen = /* @__PURE__ */ new Set(
|
|
|
19101
19114
|
}
|
|
19102
19115
|
continue;
|
|
19103
19116
|
}
|
|
19104
|
-
|
|
19117
|
+
const interp = /^python[0-9.]*$/.test(base) ? "python" : base;
|
|
19118
|
+
if (INTERPRETERS.has(interp)) {
|
|
19119
|
+
const isShell = SHELLS.has(interp);
|
|
19105
19120
|
for (let i = 1; i < words3.length; i++) {
|
|
19106
19121
|
const w = words3[i] ?? "";
|
|
19107
|
-
if (INLINE_FLAGS.has(w)) {
|
|
19108
|
-
|
|
19122
|
+
if (INLINE_FLAGS.has(w) || isShell && /^-[A-Za-z]*c[A-Za-z]*$/.test(w)) {
|
|
19123
|
+
const inner = words3[i + 1] ?? "";
|
|
19124
|
+
out.inline.push(inner);
|
|
19125
|
+
if (isShell && depth < MAX_FOLLOW_DEPTH) collectSegments(inner, scripts, depth + 1, seen, out);
|
|
19126
|
+
break;
|
|
19127
|
+
}
|
|
19128
|
+
const eq = MODULE_FLAG_EQ.exec(w);
|
|
19129
|
+
if (eq) {
|
|
19130
|
+
const rel2 = cleanRel(eq[2] ?? "");
|
|
19131
|
+
if (rel2 !== null) out.files.push(rel2);
|
|
19132
|
+
continue;
|
|
19133
|
+
}
|
|
19134
|
+
if (MODULE_FLAGS.has(w)) {
|
|
19135
|
+
const rel2 = cleanRel(words3[i + 1] ?? "");
|
|
19136
|
+
if (rel2 !== null) out.files.push(rel2);
|
|
19137
|
+
i += 1;
|
|
19138
|
+
continue;
|
|
19139
|
+
}
|
|
19140
|
+
if (w === "-m" && interp === "python") {
|
|
19141
|
+
out.files.push(...pythonModuleFiles(words3[i + 1] ?? ""));
|
|
19109
19142
|
break;
|
|
19110
19143
|
}
|
|
19111
19144
|
if (VALUE_FLAGS.has(w)) {
|
|
@@ -19113,7 +19146,7 @@ function scriptTargets(name, scripts, depth = 0, seen = /* @__PURE__ */ new Set(
|
|
|
19113
19146
|
continue;
|
|
19114
19147
|
}
|
|
19115
19148
|
if (w.startsWith("-")) continue;
|
|
19116
|
-
if (
|
|
19149
|
+
if (interp === "deno" && (w === "run" || w === "task")) continue;
|
|
19117
19150
|
const rel = cleanRel(w);
|
|
19118
19151
|
if (rel !== null) out.files.push(rel);
|
|
19119
19152
|
break;
|
|
@@ -19125,7 +19158,6 @@ function scriptTargets(name, scripts, depth = 0, seen = /* @__PURE__ */ new Set(
|
|
|
19125
19158
|
if (rel !== null) out.files.push(rel);
|
|
19126
19159
|
}
|
|
19127
19160
|
}
|
|
19128
|
-
return out;
|
|
19129
19161
|
}
|
|
19130
19162
|
var SECRET_PATTERNS = [
|
|
19131
19163
|
[/(?<![\w])\.env(?!\.(?:example|sample|template|dist))(?:\.[A-Za-z]+)?(?![\w-])/, ".env"],
|
|
@@ -19336,8 +19368,8 @@ async function loadCapabilityRules(definitionsDir) {
|
|
|
19336
19368
|
var PACKAGE_RUNNERS = /* @__PURE__ */ new Set(["npx", "bunx", "pnpx", "uvx"]);
|
|
19337
19369
|
var SCRIPT_RUNNERS = /* @__PURE__ */ new Set(["node", "nodejs", "python", "python3", "py", "bun", "deno", "tsx", "ts-node"]);
|
|
19338
19370
|
var CONTAINERS = /* @__PURE__ */ new Set(["docker", "podman"]);
|
|
19339
|
-
var
|
|
19340
|
-
var LAUNCHERS = /* @__PURE__ */ new Set([...PACKAGE_RUNNERS, ...SCRIPT_RUNNERS, ...CONTAINERS, ...
|
|
19371
|
+
var SHELLS2 = /* @__PURE__ */ new Set(["bash", "sh", "zsh", "cmd", "powershell", "pwsh"]);
|
|
19372
|
+
var LAUNCHERS = /* @__PURE__ */ new Set([...PACKAGE_RUNNERS, ...SCRIPT_RUNNERS, ...CONTAINERS, ...SHELLS2, "npm", "pnpm", "yarn", "uv", "pipx", "env", "exorcist"]);
|
|
19341
19373
|
var DOCKER_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
19342
19374
|
"-e",
|
|
19343
19375
|
"--env",
|
|
@@ -19407,7 +19439,7 @@ function unwrapLaunch(command, args, depth = 0) {
|
|
|
19407
19439
|
if (u !== -1 && args[u + 1] !== void 0) return { command: "", args: [], url: args[u + 1] };
|
|
19408
19440
|
}
|
|
19409
19441
|
const base = basenameOf(command);
|
|
19410
|
-
if (depth < 3 &&
|
|
19442
|
+
if (depth < 3 && SHELLS2.has(base)) {
|
|
19411
19443
|
const c = args.findIndex((a) => /^(?:-c|\/c|-command)$/i.test(a));
|
|
19412
19444
|
const inner = c === -1 ? void 0 : args[c + 1];
|
|
19413
19445
|
if (inner !== void 0) {
|
|
@@ -20039,7 +20071,7 @@ async function* scanRepo(root, options) {
|
|
|
20039
20071
|
init_zod();
|
|
20040
20072
|
|
|
20041
20073
|
// ../core/src/version.ts
|
|
20042
|
-
var SCANNER_VERSION = "0.3.
|
|
20074
|
+
var SCANNER_VERSION = "0.3.2";
|
|
20043
20075
|
|
|
20044
20076
|
// ../core/src/redact-secrets.ts
|
|
20045
20077
|
var MIN_LENGTH_FOR_PREFIX = 16;
|
|
@@ -20333,6 +20365,10 @@ var ENTRIES = {
|
|
|
20333
20365
|
headline: "A script that runs by itself sends your secrets out",
|
|
20334
20366
|
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.'
|
|
20335
20367
|
},
|
|
20368
|
+
"EX-037": {
|
|
20369
|
+
headline: "This text tells your AI to do something and not to tell you",
|
|
20370
|
+
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.'
|
|
20371
|
+
},
|
|
20336
20372
|
"EX-027": {
|
|
20337
20373
|
headline: "Your AI read untrusted text and private data, and now wants to send something out",
|
|
20338
20374
|
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."
|
|
@@ -23825,9 +23861,10 @@ function runScriptsBlockMessage(hit) {
|
|
|
23825
23861
|
}
|
|
23826
23862
|
|
|
23827
23863
|
// ../core/src/shell-read-guard.ts
|
|
23828
|
-
import { readdirSync as readdirSync3 } from "node:fs";
|
|
23864
|
+
import { readdirSync as readdirSync3, statSync as statSync9 } from "node:fs";
|
|
23829
23865
|
import { basename as basename6, dirname as dirname4, isAbsolute as isAbsolute8, relative as relative8, resolve as resolve11, sep as sep3 } from "node:path";
|
|
23830
|
-
var MAX_TARGETS =
|
|
23866
|
+
var MAX_TARGETS = 100;
|
|
23867
|
+
var MAX_TOTAL_BYTES = 32 * 1024 * 1024;
|
|
23831
23868
|
var VALUE_FLAGS3 = {
|
|
23832
23869
|
cat: /* @__PURE__ */ new Set(),
|
|
23833
23870
|
head: /* @__PURE__ */ new Set(["-n", "-c", "--lines", "--bytes"]),
|
|
@@ -23893,15 +23930,23 @@ function expandSimpleGlob(word, dir) {
|
|
|
23893
23930
|
const base = basename6(word);
|
|
23894
23931
|
const re2 = new RegExp(`^${base.replace(/[.+^${}()|\\[\]]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".")}$`);
|
|
23895
23932
|
const folder = resolve11(dir, dirname4(word));
|
|
23896
|
-
return readdirSync3(folder).filter((n) => re2.test(n) && (!n.startsWith(".") || base.startsWith("."))).sort().slice(0, MAX_TARGETS).map((n) => resolve11(folder, n));
|
|
23933
|
+
return readdirSync3(folder).filter((n) => re2.test(n) && (!n.startsWith(".") || base.startsWith("."))).sort().slice(0, MAX_TARGETS + 1).map((n) => resolve11(folder, n));
|
|
23897
23934
|
} catch {
|
|
23898
23935
|
return [];
|
|
23899
23936
|
}
|
|
23900
23937
|
}
|
|
23901
|
-
function
|
|
23938
|
+
function sizeOf(p) {
|
|
23939
|
+
try {
|
|
23940
|
+
return statSync9(p).size;
|
|
23941
|
+
} catch {
|
|
23942
|
+
return 0;
|
|
23943
|
+
}
|
|
23944
|
+
}
|
|
23945
|
+
function shellReadPlan(command, cwd, workspace) {
|
|
23902
23946
|
const split = splitShell(command);
|
|
23903
23947
|
if (!split.ok) return null;
|
|
23904
23948
|
const out = [];
|
|
23949
|
+
let tooMany = false;
|
|
23905
23950
|
let dir = cwd;
|
|
23906
23951
|
for (const raw of split.segments) {
|
|
23907
23952
|
const words3 = stripPrefixes(raw);
|
|
@@ -23917,19 +23962,33 @@ function shellReadPaths(command, cwd, workspace) {
|
|
|
23917
23962
|
const rel = relative8(workspace, abs);
|
|
23918
23963
|
if (rel === "" || rel.startsWith("..") || isAbsolute8(rel) || rel.split(sep3).includes("..")) continue;
|
|
23919
23964
|
if (!out.includes(abs)) out.push(abs);
|
|
23920
|
-
if (out.length
|
|
23965
|
+
if (out.length > MAX_TARGETS) return { paths: out.slice(0, MAX_TARGETS), tooMany: true };
|
|
23921
23966
|
}
|
|
23922
23967
|
}
|
|
23923
23968
|
}
|
|
23924
|
-
|
|
23969
|
+
let total = 0;
|
|
23970
|
+
for (const p of out) {
|
|
23971
|
+
total += sizeOf(p);
|
|
23972
|
+
if (total > MAX_TOTAL_BYTES) {
|
|
23973
|
+
tooMany = true;
|
|
23974
|
+
break;
|
|
23975
|
+
}
|
|
23976
|
+
}
|
|
23977
|
+
return { paths: out, tooMany };
|
|
23978
|
+
}
|
|
23979
|
+
function tooManyFilesMessage() {
|
|
23980
|
+
return `Exorcist 98 blocked this command, which reads files through the shell: it names too many files to check (more than ${MAX_TARGETS} files, or more than ${MAX_TOTAL_BYTES / (1024 * 1024)} MB in all). A part of the list was not scanned, so none of it is let through. Read fewer files at a time, for example one folder or one file per command. Do not look for a way around this block.`;
|
|
23925
23981
|
}
|
|
23926
23982
|
function decideShellRead(event, defs, opts = {}, fallbackCwd = process.cwd()) {
|
|
23927
23983
|
try {
|
|
23928
23984
|
const command = eventCommand(event);
|
|
23929
23985
|
if (command === null) return { exitCode: 0, message: "" };
|
|
23930
23986
|
const cwd = eventCwd(event, opts.cwd ?? fallbackCwd);
|
|
23931
|
-
const
|
|
23932
|
-
if (
|
|
23987
|
+
const plan = shellReadPlan(command, cwd, cwd);
|
|
23988
|
+
if (plan === null) return { exitCode: 0, message: "" };
|
|
23989
|
+
if (plan.tooMany) return { exitCode: 2, message: tooManyFilesMessage() };
|
|
23990
|
+
const paths2 = plan.paths;
|
|
23991
|
+
if (paths2.length === 0) return { exitCode: 0, message: "" };
|
|
23933
23992
|
const d = decideRead({ tool_name: "read", cwd, tool_input: { paths: paths2 } }, defs, { ...opts, cwd });
|
|
23934
23993
|
if (d.exitCode === 2) {
|
|
23935
23994
|
return { exitCode: 2, message: d.message.replace("Exorcist 98 blocked this read:", "Exorcist 98 blocked this command, which reads a file through the shell:") };
|
|
@@ -26505,7 +26564,7 @@ var ShieldEngine = class {
|
|
|
26505
26564
|
|
|
26506
26565
|
// ../shield/src/proxy.ts
|
|
26507
26566
|
import { spawn } from "node:child_process";
|
|
26508
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync8, readFileSync as readFileSync18, statSync as
|
|
26567
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync8, readFileSync as readFileSync18, statSync as statSync12 } from "node:fs";
|
|
26509
26568
|
import { dirname as dirname10 } from "node:path";
|
|
26510
26569
|
|
|
26511
26570
|
// ../shield/src/lockfile.ts
|
|
@@ -26696,7 +26755,7 @@ function findLockFile(starts) {
|
|
|
26696
26755
|
|
|
26697
26756
|
// ../shield/src/vault.ts
|
|
26698
26757
|
import { createHash as createHash8, randomBytes as randomBytes4 } from "node:crypto";
|
|
26699
|
-
import { copyFileSync, existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync15, readdirSync as readdirSync6, rmSync as rmSync4, statSync as
|
|
26758
|
+
import { copyFileSync, existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync15, readdirSync as readdirSync6, rmSync as rmSync4, statSync as statSync10, writeFileSync as writeFileSync6 } from "node:fs";
|
|
26700
26759
|
import { basename as basename7, dirname as dirname8, isAbsolute as isAbsolute10, join as join20, resolve as resolve14 } from "node:path";
|
|
26701
26760
|
init_zod();
|
|
26702
26761
|
var SafeRel = external_exports.string().min(1).max(1024).refine(
|
|
@@ -26808,7 +26867,7 @@ function quarantineServer(o) {
|
|
|
26808
26867
|
}
|
|
26809
26868
|
function quarantineFile(o) {
|
|
26810
26869
|
const target = resolve14(o.filePath);
|
|
26811
|
-
if (!existsSync10(target) || !
|
|
26870
|
+
if (!existsSync10(target) || !statSync10(target).isFile()) return fail2(`${target} is not a file.`);
|
|
26812
26871
|
if (activeFor(o.vaultDir, target)) return fail2(`${target} is already in the vault.`);
|
|
26813
26872
|
const now = o.now ?? /* @__PURE__ */ new Date();
|
|
26814
26873
|
const id = newId(basename7(target), now);
|
|
@@ -27724,13 +27783,13 @@ var EventTail = class {
|
|
|
27724
27783
|
|
|
27725
27784
|
// ../shield/src/launch.ts
|
|
27726
27785
|
import { createHash as createHash10 } from "node:crypto";
|
|
27727
|
-
import { existsSync as existsSync11, readFileSync as readFileSync17, statSync as
|
|
27786
|
+
import { existsSync as existsSync11, readFileSync as readFileSync17, statSync as statSync11 } from "node:fs";
|
|
27728
27787
|
import { dirname as dirname9, isAbsolute as isAbsolute11, join as join23, parse as parsePath2, relative as relative9, resolve as resolve15, sep as sep4 } from "node:path";
|
|
27729
27788
|
var sha2563 = (b) => createHash10("sha256").update(b).digest("hex");
|
|
27730
27789
|
var MAX_HASHED_BYTES = 64 * 1024 * 1024;
|
|
27731
27790
|
var fsReader = (path) => {
|
|
27732
27791
|
try {
|
|
27733
|
-
const st =
|
|
27792
|
+
const st = statSync11(path);
|
|
27734
27793
|
if (!st.isFile()) return { kind: "other" };
|
|
27735
27794
|
return { kind: "file", size: st.size, mtimeMs: st.mtimeMs, read: () => readFileSync17(path) };
|
|
27736
27795
|
} catch {
|
|
@@ -28084,7 +28143,7 @@ async function prepareShield(o) {
|
|
|
28084
28143
|
let dirty = false;
|
|
28085
28144
|
const readMtime = () => {
|
|
28086
28145
|
try {
|
|
28087
|
-
return
|
|
28146
|
+
return statSync12(statePath(o.dir)).mtimeMs;
|
|
28088
28147
|
} catch {
|
|
28089
28148
|
return 0;
|
|
28090
28149
|
}
|
|
@@ -28539,12 +28598,12 @@ async function runRemoteProxy(o) {
|
|
|
28539
28598
|
}
|
|
28540
28599
|
|
|
28541
28600
|
// ../shield/src/locate.ts
|
|
28542
|
-
import { existsSync as existsSync13, readdirSync as readdirSync7, statSync as
|
|
28601
|
+
import { existsSync as existsSync13, readdirSync as readdirSync7, statSync as statSync13 } from "node:fs";
|
|
28543
28602
|
import { dirname as dirname11, isAbsolute as isAbsolute12, join as join24, parse as parse2, resolve as resolve16 } from "node:path";
|
|
28544
28603
|
import { fileURLToPath } from "node:url";
|
|
28545
28604
|
function hasDefinitions(dir) {
|
|
28546
28605
|
try {
|
|
28547
|
-
return
|
|
28606
|
+
return statSync13(dir).isDirectory() && readdirSync7(dir).some((f) => /^EX-\d{3}.*\.yaml$/.test(f));
|
|
28548
28607
|
} catch {
|
|
28549
28608
|
return false;
|
|
28550
28609
|
}
|
|
@@ -28756,7 +28815,7 @@ var DEFAULT_DIR = "the project's .exorcist folder (or EXORCIST_DIR)";
|
|
|
28756
28815
|
// src/commands/on-access.ts
|
|
28757
28816
|
import { randomBytes as randomBytes7 } from "node:crypto";
|
|
28758
28817
|
import { execFile as execFile4 } from "node:child_process";
|
|
28759
|
-
import { existsSync as existsSync14, statSync as
|
|
28818
|
+
import { existsSync as existsSync14, statSync as statSync14 } from "node:fs";
|
|
28760
28819
|
import { resolve as resolve17 } from "node:path";
|
|
28761
28820
|
import { createInterface } from "node:readline";
|
|
28762
28821
|
var ALLOW_READ_HELP = `Usage: exorcist allow-read <file>
|
|
@@ -28950,7 +29009,7 @@ ${ALLOW_READ_HELP}`);
|
|
|
28950
29009
|
return 1;
|
|
28951
29010
|
}
|
|
28952
29011
|
const file = resolve17(target);
|
|
28953
|
-
if (!existsSync14(file) || !
|
|
29012
|
+
if (!existsSync14(file) || !statSync14(file).isFile()) {
|
|
28954
29013
|
io.err(`Not a readable file: ${shownName(target)}`);
|
|
28955
29014
|
return 1;
|
|
28956
29015
|
}
|
|
@@ -29115,16 +29174,16 @@ async function alertsCommand(argv, io) {
|
|
|
29115
29174
|
}
|
|
29116
29175
|
|
|
29117
29176
|
// src/commands/baseline.ts
|
|
29118
|
-
import { statSync as
|
|
29177
|
+
import { statSync as statSync17, writeFileSync as writeFileSync8 } from "node:fs";
|
|
29119
29178
|
import { join as join27, resolve as resolve20 } from "node:path";
|
|
29120
29179
|
|
|
29121
29180
|
// src/commands/scan.ts
|
|
29122
|
-
import { existsSync as existsSync17, readFileSync as readFileSync21, realpathSync as realpathSync6, statSync as
|
|
29181
|
+
import { existsSync as existsSync17, readFileSync as readFileSync21, realpathSync as realpathSync6, statSync as statSync16, writeFileSync as writeFileSync7 } from "node:fs";
|
|
29123
29182
|
import { basename as basename9, dirname as dirname12, isAbsolute as isAbsolute13, join as join26, relative as relative10, resolve as resolve19 } from "node:path";
|
|
29124
29183
|
init_bedrock();
|
|
29125
29184
|
|
|
29126
29185
|
// src/commands/detonate.ts
|
|
29127
|
-
import { existsSync as existsSync16, readFileSync as readFileSync20, statSync as
|
|
29186
|
+
import { existsSync as existsSync16, readFileSync as readFileSync20, statSync as statSync15 } from "node:fs";
|
|
29128
29187
|
import { basename as basename8, join as join25, resolve as resolve18 } from "node:path";
|
|
29129
29188
|
init_bedrock();
|
|
29130
29189
|
var DEFAULT_DETONATE_MAX = 10;
|
|
@@ -29268,11 +29327,11 @@ ${DETONATE_HELP}`);
|
|
|
29268
29327
|
return 2;
|
|
29269
29328
|
}
|
|
29270
29329
|
const abs = resolve18(target);
|
|
29271
|
-
if (!existsSync16(abs) || !
|
|
29330
|
+
if (!existsSync16(abs) || !statSync15(abs).isFile()) {
|
|
29272
29331
|
io.err(`File not found: ${target}`);
|
|
29273
29332
|
return 2;
|
|
29274
29333
|
}
|
|
29275
|
-
if (
|
|
29334
|
+
if (statSync15(abs).size > MAX_FILE_BYTES5) {
|
|
29276
29335
|
io.err(`${target} is larger than 1 MB; detonate a smaller part of it.`);
|
|
29277
29336
|
return 2;
|
|
29278
29337
|
}
|
|
@@ -29443,7 +29502,7 @@ async function runScan(opts, io) {
|
|
|
29443
29502
|
io.err(`Path not found: ${opts.target}`);
|
|
29444
29503
|
return { ok: false, code: 2 };
|
|
29445
29504
|
}
|
|
29446
|
-
const isFile =
|
|
29505
|
+
const isFile = statSync16(abs).isFile();
|
|
29447
29506
|
const root = isFile ? dirname12(abs) : abs;
|
|
29448
29507
|
const only = isFile ? basename9(abs) : null;
|
|
29449
29508
|
const defsDir = findDefinitionsDir2(opts.definitions);
|
|
@@ -29498,7 +29557,7 @@ function makeRootReader(root) {
|
|
|
29498
29557
|
const real = realpathSync6(resolve19(realRoot, file));
|
|
29499
29558
|
const rel = relative10(realRoot, real);
|
|
29500
29559
|
if (rel === "" || rel.startsWith("..") || isAbsolute13(rel)) return null;
|
|
29501
|
-
if (
|
|
29560
|
+
if (statSync16(real).size > MAX_DIRECTIVE_FILE_BYTES) return null;
|
|
29502
29561
|
return readFileSync21(real, "utf8");
|
|
29503
29562
|
} catch {
|
|
29504
29563
|
return null;
|
|
@@ -29670,7 +29729,7 @@ ${BASELINE_HELP}`);
|
|
|
29670
29729
|
}
|
|
29671
29730
|
const target = p.positionals[0] ?? ".";
|
|
29672
29731
|
try {
|
|
29673
|
-
if (!
|
|
29732
|
+
if (!statSync17(resolve20(target)).isDirectory()) {
|
|
29674
29733
|
io.err(`${target} is a file. Give a folder to baseline.`);
|
|
29675
29734
|
return 2;
|
|
29676
29735
|
}
|
|
@@ -29822,7 +29881,7 @@ unwrap Put the original file back byte for byte, if it was not edited since
|
|
|
29822
29881
|
|
|
29823
29882
|
Options (wrap):
|
|
29824
29883
|
--bin <command> Command that runs the shield (default: exorcist)
|
|
29825
|
-
--bin-arg <arg> Argument before "shield" (repeatable), e.g. --bin npx --bin-arg -y --bin-arg @exorcist-98/cli@0.3.
|
|
29884
|
+
--bin-arg <arg> Argument before "shield" (repeatable), e.g. --bin npx --bin-arg -y --bin-arg @exorcist-98/cli@0.3.2
|
|
29826
29885
|
--dir <folder> State folder (default: ${DEFAULT_DIR})
|
|
29827
29886
|
--dry-run Show the result without writing the file
|
|
29828
29887
|
`;
|
|
@@ -31003,7 +31062,7 @@ ${CONSOLE_HELP}`);
|
|
|
31003
31062
|
}
|
|
31004
31063
|
|
|
31005
31064
|
// src/commands/exorcise.ts
|
|
31006
|
-
import { existsSync as existsSync19, readFileSync as readFileSync23, statSync as
|
|
31065
|
+
import { existsSync as existsSync19, readFileSync as readFileSync23, statSync as statSync18 } from "node:fs";
|
|
31007
31066
|
import { basename as basename10, dirname as dirname13, isAbsolute as isAbsolute14, relative as relative11, resolve as resolve23 } from "node:path";
|
|
31008
31067
|
var EXORCISE_HELP = `Usage: exorcist exorcise [path] [options]
|
|
31009
31068
|
|
|
@@ -31093,7 +31152,7 @@ ${EXORCISE_HELP}`);
|
|
|
31093
31152
|
io.err(`Path not found: ${target}`);
|
|
31094
31153
|
return 2;
|
|
31095
31154
|
}
|
|
31096
|
-
const isFile =
|
|
31155
|
+
const isFile = statSync18(abs).isFile();
|
|
31097
31156
|
const root = isFile ? dirname13(abs) : abs;
|
|
31098
31157
|
const single = isFile ? basename10(abs) : null;
|
|
31099
31158
|
const defsDir = findDefinitionsDir2(str4(p.values["definitions"]));
|
|
@@ -31589,7 +31648,7 @@ async function guardShellReadCommand(stdin, io) {
|
|
|
31589
31648
|
}
|
|
31590
31649
|
|
|
31591
31650
|
// src/commands/hook-scan.ts
|
|
31592
|
-
import { existsSync as existsSync22, statSync as
|
|
31651
|
+
import { existsSync as existsSync22, statSync as statSync19 } from "node:fs";
|
|
31593
31652
|
import { resolve as resolve25 } from "node:path";
|
|
31594
31653
|
async function hookScanCommand(stdin, io) {
|
|
31595
31654
|
let event;
|
|
@@ -31601,7 +31660,7 @@ async function hookScanCommand(stdin, io) {
|
|
|
31601
31660
|
if (typeof event.file_path !== "string" || event.file_path === "") return 0;
|
|
31602
31661
|
const base = typeof event.cwd === "string" && event.cwd ? event.cwd : process.cwd();
|
|
31603
31662
|
const file = resolve25(base, event.file_path);
|
|
31604
|
-
if (!existsSync22(file) || !
|
|
31663
|
+
if (!existsSync22(file) || !statSync19(file).isFile()) return 0;
|
|
31605
31664
|
return await scanCommand([file, "--fail-on", "high"], { out: io.err, err: io.err });
|
|
31606
31665
|
}
|
|
31607
31666
|
|
|
@@ -31725,8 +31784,8 @@ function reviewerAgentForProject(mcpCommand) {
|
|
|
31725
31784
|
}
|
|
31726
31785
|
|
|
31727
31786
|
// src/commands/init.ts
|
|
31728
|
-
var DEFAULT_BIN = "npx -y @exorcist-98/cli@0.3.
|
|
31729
|
-
var DEFAULT_MCP_BIN = "npx -y @exorcist-98/mcp-server@0.3.
|
|
31787
|
+
var DEFAULT_BIN = "npx -y @exorcist-98/cli@0.3.2";
|
|
31788
|
+
var DEFAULT_MCP_BIN = "npx -y @exorcist-98/mcp-server@0.3.2";
|
|
31730
31789
|
var MISSING_FROM_DEFAULT_BIN = /* @__PURE__ */ new Set();
|
|
31731
31790
|
var INIT_HELP = `Usage: exorcist init [folder] [--kiro] [--shield] [--sandbox] [--no-agent] [--force]
|
|
31732
31791
|
[--bin <command>] [--mcp-bin <command>]
|
|
@@ -32095,7 +32154,7 @@ ${INIT_HELP}`);
|
|
|
32095
32154
|
"then reconnect MCP servers in the MCP panel so they start through the Shield."
|
|
32096
32155
|
];
|
|
32097
32156
|
if (isDefaultBin) {
|
|
32098
|
-
lines.push("Commands run through npx (@exorcist-98/cli@0.3.
|
|
32157
|
+
lines.push("Commands run through npx (@exorcist-98/cli@0.3.2). If Kiro cannot start a wrapped server or a hook cannot find npx,");
|
|
32099
32158
|
lines.push('rerun with --bin "<absolute path to node> <absolute path to the exorcist CLI>" and --force.');
|
|
32100
32159
|
}
|
|
32101
32160
|
io.out(lines.join("\n"));
|
|
@@ -39478,7 +39537,7 @@ var RawToolsPage = external_exports.object({ tools: external_exports.array(exter
|
|
|
39478
39537
|
var firstLine2 = (err) => (err instanceof Error ? err.message : String(err)).split("\n")[0]?.slice(0, 300) ?? "unknown error";
|
|
39479
39538
|
async function listTools(o) {
|
|
39480
39539
|
const transport = new StdioClientTransport({ command: o.command, args: o.args, env: o.env, cwd: o.cwd, stderr: "ignore" });
|
|
39481
|
-
const client = new Client({ name: "exorcist-lock", version: "0.3.
|
|
39540
|
+
const client = new Client({ name: "exorcist-lock", version: "0.3.2" }, { capabilities: {} });
|
|
39482
39541
|
let timer;
|
|
39483
39542
|
const timedOut = new Promise((res) => {
|
|
39484
39543
|
timer = setTimeout(() => res({ ok: false, error: `it did not list its tools within ${o.timeoutMs} ms.` }), o.timeoutMs);
|
|
@@ -39720,7 +39779,7 @@ ${LOCK_HELP}`);
|
|
|
39720
39779
|
}
|
|
39721
39780
|
|
|
39722
39781
|
// src/commands/map.ts
|
|
39723
|
-
import { existsSync as existsSync25, statSync as
|
|
39782
|
+
import { existsSync as existsSync25, statSync as statSync20 } from "node:fs";
|
|
39724
39783
|
import { resolve as resolve28 } from "node:path";
|
|
39725
39784
|
var MAP_HELP = `Usage: exorcist map [dir] [options]
|
|
39726
39785
|
|
|
@@ -39817,7 +39876,7 @@ ${MAP_HELP}`);
|
|
|
39817
39876
|
}
|
|
39818
39877
|
const target = p.positionals[0] ?? ".";
|
|
39819
39878
|
const root = resolve28(target);
|
|
39820
|
-
if (!existsSync25(root) || !
|
|
39879
|
+
if (!existsSync25(root) || !statSync20(root).isDirectory()) {
|
|
39821
39880
|
io.err(`Folder not found: ${target}`);
|
|
39822
39881
|
return 2;
|
|
39823
39882
|
}
|
|
@@ -39839,7 +39898,7 @@ ${MAP_HELP}`);
|
|
|
39839
39898
|
}
|
|
39840
39899
|
|
|
39841
39900
|
// src/commands/origin.ts
|
|
39842
|
-
import { existsSync as existsSync26, realpathSync as realpathSync7, statSync as
|
|
39901
|
+
import { existsSync as existsSync26, realpathSync as realpathSync7, statSync as statSync21 } from "node:fs";
|
|
39843
39902
|
import { posix, relative as relative12, resolve as resolve29, sep as sep5 } from "node:path";
|
|
39844
39903
|
var ORIGIN_HELP = `Usage: exorcist origin [dir] [options]
|
|
39845
39904
|
|
|
@@ -39963,7 +40022,7 @@ ${ORIGIN_HELP}`);
|
|
|
39963
40022
|
return 2;
|
|
39964
40023
|
}
|
|
39965
40024
|
const target = resolve29(p.positionals[0] ?? ".");
|
|
39966
|
-
if (!existsSync26(target) || !
|
|
40025
|
+
if (!existsSync26(target) || !statSync21(target).isDirectory()) {
|
|
39967
40026
|
io.err(`Not a directory: ${target}`);
|
|
39968
40027
|
return 2;
|
|
39969
40028
|
}
|
|
@@ -40475,7 +40534,7 @@ ${VERIFY_LOG_HELP}`);
|
|
|
40475
40534
|
}
|
|
40476
40535
|
|
|
40477
40536
|
// src/index.ts
|
|
40478
|
-
var VERSION = "0.3.
|
|
40537
|
+
var VERSION = "0.3.2";
|
|
40479
40538
|
var HELP = `Exorcist 98 ${VERSION}: antivirus for AI coding agents
|
|
40480
40539
|
|
|
40481
40540
|
Usage: exorcist <command> [options]
|