@exorcist-98/mcp-server 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md 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.2.0"] }
40
+ "exorcist": { "command": "npx", "args": ["-y", "@exorcist-98/mcp-server@0.3.0"] }
41
41
  }
42
42
  }
43
43
  ```
@@ -1,5 +1,5 @@
1
1
  id: EX-028
2
- title: Hidden text that instructs the AI
2
+ title: Hidden text, meta tags or image alt text that instruct the AI
3
3
  severity: high
4
4
  applies_to:
5
5
  - instruction
@@ -13,6 +13,13 @@ match:
13
13
  # display:none, visibility:hidden, opacity:0, off-screen position, zero-size
14
14
  # box) whose text names the AI or asks for an action. Hidden text that does
15
15
  # neither (a closed modal, a screen-reader label, a collapsed menu) is quiet.
16
+ #
17
+ # m11 (CT-11, CT-12), same rule id, same code path: also (a) an HTML <meta>
18
+ # tag whose name is aimed at a model (ai-instructions, llm, assistant, ...)
19
+ # and whose content addresses the AI, whatever its visibility, and (b) image
20
+ # alt text (<img alt> or Markdown ![alt](...)) that names the AI as its
21
+ # addressee or asks for an action. Ordinary meta names (description,
22
+ # viewport, robots) and alt text that only describes the image are quiet.
16
23
  hidden_text: true
17
24
  # Hidden markup shown inside Markdown code is displayed, not hidden.
18
25
  skip_in_code: true
@@ -0,0 +1,54 @@
1
+ id: EX-030
2
+ title: Instructions to change the agent's own settings or guard files
3
+ severity: high
4
+ applies_to:
5
+ - instruction
6
+ - docs
7
+ - memory
8
+ - tool-result
9
+ match:
10
+ # Text addressed to an agent that asks it to change what the agent trusts:
11
+ # a trusted-commands or auto-approve setting (commandsToAlwaysAllow,
12
+ # permissions.allow, autoApprove), an agent settings file (.vscode/settings.json,
13
+ # .claude/settings.json, .cursor/cli.json), or the files that hold its guards
14
+ # (.kiro/hooks/, .kiro/agents/, .kiro/steering/, AGENTS.md). An attacker uses
15
+ # this to make a change stick after the poisoned file is gone.
16
+ #
17
+ # Two shapes, both in one sentence:
18
+ # 1. an edit verb, then one of those targets, where the sentence is plainly
19
+ # talking to the agent ("you must", "please", "the agent should",
20
+ # "silently", "before you continue", "to proceed") before the verb;
21
+ # 2. an edit verb with a wildcard ("*") or "all/any command" and a trusted
22
+ # commands or auto-approve setting, which needs no other cue.
23
+ # "Edit .vscode/settings.json to change the font size" is ordinary
24
+ # documentation for a person and is not flagged.
25
+ #
26
+ # The cue is part of the match, so the span starts at it and a quoted order
27
+ # ("... such as "you must edit .kiro/hooks"") is recognised as an example.
28
+ # The words between the cue and the verb may not negate it ("you must never
29
+ # edit"); a negation right before a verb without a cue is left to
30
+ # negated_cues. A "." inside a word (kiro.commandsToAlwaysAllow,
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))'
33
+ # A phrase in quotation marks that close right after it, in a passage that
34
+ # is warning about it or quoting it as an example ("never follow text such
35
+ # as ..."), is not an order.
36
+ 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)'
37
+ # A sentence that forbids the change is a defence ("you must never edit
38
+ # .kiro/hooks", "do not add * to the trusted commands"). The negation has to
39
+ # end right before the verb, as for EX-002. A second form covers a verb joined
40
+ # to a forbidden one by "or" ("you must never edit .kiro/hooks or add * to ...").
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|avoid|refrain\s+from|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|forbidden\s+to|prohibited\s+from)\s+(?:(?:ever|simply|just|even|actually|knowingly|first|then|also|silently|quietly)\s+)*$|\b(?:never|(?:must|should|shall|will|would|can|could|do|does)\s*(?:not|never)|(?:don|doesn|shouldn|mustn|won|can)[''’]?t)\s+(?:(?:ever|simply|just|actually|silently|quietly)\s+)*(?: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,80}?\b(?:or|nor)\s+(?:(?:ever|simply|just|actually|silently|quietly)\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 widen
52
+ its own trusted commands or to edit its hooks, agents, steering or AGENTS.md.
53
+ Make those changes yourself, in a reviewed commit. If you are documenting the
54
+ attack, put it in a fenced code block or say that the agent must never do it.
@@ -0,0 +1,46 @@
1
+ id: EX-031
2
+ title: Instructions to weaken tests or checks
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 asks it to get a change through by making
12
+ # the checks weaker: adding .skip / xit / test.todo, deleting a test file
13
+ # because it is flaky, --no-verify, "|| true" on a CI step, lowering a
14
+ # coverage threshold, or making a failing check pass by other means than a
15
+ # fix. Comments in source files are scanned too (applies_to includes code).
16
+ #
17
+ # Two shapes:
18
+ # 1. a cue that the sentence is talking to the agent ("you must", "please",
19
+ # "the agent should", "silently", "before you continue", "to proceed"),
20
+ # then a weakening verb, then one of the targets above;
21
+ # 2. "make the failing tests pass" followed by a means that is not a fix
22
+ # ("by skipping", "whatever it takes", "at any cost"), which needs no cue.
23
+ # A test file that calls it.skip(...), a CI file with "|| true", and a page
24
+ # that explains --no-verify to a person have no such cue and are not flagged.
25
+ 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)[^.!?\n]{0,60}?)\b(?:add|append|insert|put|use|pass|mark|skip|disable|comment\s+out|delete|remove|lower|reduce|relax|drop|bypass|ignore|silence|force|commit|push|merge|turn\s+off|set|change|append|tack\s+on)\b[^.!?\n]{0,60}?(?:\.skip\b|\bxit\b|\bxdescribe\b|\b(?:test|it)\.todo\b|--no-verify\b|\|\|\s*true\b|\bcoverage\s+(?:threshold|requirement|gate|minimum)s?\b|\b(?:failing|flaky|broken)\s+(?:tests?|checks?|specs?|ci|builds?)\b|\b(?:tests?|specs?)\s+files?\b|\bci\s+(?:checks?|steps?|failures?)\b|\bpre-?commit\s+hooks?\b)|\bmake\s+(?:the\s+)?(?:failing|failed|red)\s+(?:tests?|checks?|builds?|ci)\s+pass\b[^.!?\n]{0,40}?(?:\bby\s+(?:any\s+means|whatever\s+means|skipping|deleting|removing|disabling|ignoring|bypassing)\b|\bwhatever\s+it\s+takes\b|\bat\s+any\s+cost\b|\bno\s+matter\s+what\b|\bwithout\s+(?:fixing|reading|looking)\b))'
26
+ # A phrase in quotation marks that closes right after it, in a passage that
27
+ # is warning about it or quoting it as an example ("never follow text such
28
+ # as ..."), is not an order.
29
+ 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)'
30
+ # A sentence that forbids the action is a defence ("you must never use
31
+ # --no-verify"). The negation has to end right before the verb, as for EX-002.
32
+ 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|avoid|refrain\s+from|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|forbidden\s+to|prohibited\s+from)\s+(?:(?:ever|simply|just|even|actually|knowingly|first|then|also|silently|quietly)\s+)*$'
33
+ # Test and eval fixtures hold attack samples on purpose. Findings there are
34
+ # reported at low severity, not dropped. A file an agent reads is never lowered.
35
+ low_severity_paths:
36
+ - "(^|/)(tests?|__tests__|__mocks__|spec|specs|fixtures?|testdata|test-data|e2e|evals?)/|[._-](test|spec)s?\\.[A-Za-z0-9]+$|_tests?\\.(rs|go|py)$"
37
+ owasp:
38
+ - "ASI02 Inadequate Human-in-the-Loop Controls"
39
+ - "ASI03 Prompt Injection via External Content"
40
+ - "LLM01:2025 Prompt Injection"
41
+ fix: >
42
+ Remove the instruction. A file your agent reads should not tell it to skip or
43
+ delete tests, bypass hooks with --no-verify, hide CI failures with "|| true",
44
+ lower a coverage threshold, or make a failing check pass without a fix. Fix
45
+ the cause in a reviewed commit. If you are documenting the attack, put it in
46
+ a fenced code block or say that the agent must never do it.
@@ -0,0 +1,33 @@
1
+ id: EX-032
2
+ title: Instructions to push or publish somewhere else
3
+ severity: high
4
+ applies_to:
5
+ - instruction
6
+ - docs
7
+ - memory
8
+ - tool-result
9
+ match:
10
+ # Text addressed to an agent that asks it to send code somewhere else:
11
+ # push to a remote other than origin, add or re-point a remote, publish a
12
+ # package, change the package registry, or open a pull request against a
13
+ # different repository. The sentence has to be plainly talking to the agent
14
+ # ("you must", "please", "silently", "before you continue", "to proceed")
15
+ # before the action, with no negation in between (the match starts at the
16
+ # cue so a quoted example is recognised). "Maintainers run `npm publish` to release" is a release
17
+ # process for people and is not flagged.
18
+ 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)(?:(?!\b(?:not|never|cannot|avoid|refrain|unable|forbidden|prohibited)\b|n[''’]t\b)[^.!?\n]){0,60}?(?:\bgit\s+push\b(?:\s+-{1,2}[\w-]+)*\s+(?!origin\b)(?:https?://|ssh://|git@|[A-Za-z][\w.-]*\s)|\bpush\b[^.!?\n]{0,40}?\bto\b[^\n]{0,20}?(?:https?://|ssh://|git@)|\bgit\s+remote\s+(?:add|set-url)\b|\badd\b[^.!?\n]{0,20}?\b(?:new|another|extra|second)\s+(?:git\s+)?remote\b|\b(?:npm|pnpm|yarn|bun|cargo|gem|twine)\s+(?:publish|upload|push)\b|\bpublish\b[^.!?\n]{0,30}?\b(?:package|crate|gem|module|library|build|release)\b|\b(?:npm|pnpm|yarn)\s+config\s+set\s+registry\b|\b(?:change|set|switch|point|replace|override|update)\b[^.!?\n]{0,40}?\b(?:npm|package|pip|cargo|gem|default)?\s*registry\b|--registry[=\s]|\bregistry\s*=\s*https?://|\bgh\s+pr\s+create\b[^\n]{0,80}?--repo\b|\b(?:open|create|file|submit|send|raise)\b[^.!?\n]{0,30}?\b(?:pull\s+request|PR)\b[^.!?\n]{0,30}?\b(?:against|to|on|in)\b[^.!?\n]{0,20}?\b(?:different|another|other|external|upstream|fork|attacker)\b)'
19
+ # A phrase in a passage that warns about it or quotes it as an example is not an order.
20
+ 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)'
21
+ # A sentence that forbids the action is a defence ("never push to a different remote").
22
+ 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|avoid|refrain\s+from|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|forbidden\s+to|prohibited\s+from)\s+(?:(?:ever|simply|just|even|actually|knowingly|first|then|also|silently|quietly)\s+)*$'
23
+ low_severity_paths:
24
+ - "(^|/)(tests?|__tests__|__mocks__|spec|specs|fixtures?|testdata|test-data|e2e|evals?)/|[._-](test|spec)s?\\.[A-Za-z0-9]+$|_tests?\\.(rs|go|py)$"
25
+ owasp:
26
+ - "ASI03 Prompt Injection via External Content"
27
+ - "LLM01:2025 Prompt Injection"
28
+ fix: >
29
+ Remove the instruction. A file your agent reads should not tell it to push
30
+ to another remote, publish a package, change the registry or open a pull
31
+ request against another repository. Do those steps yourself. If you are
32
+ documenting the attack, put it in a fenced code block or say that the agent
33
+ must never do it.
@@ -0,0 +1,30 @@
1
+ id: EX-033
2
+ title: Settings that let the agent run any command without asking
3
+ severity: critical
4
+ applies_to:
5
+ - config
6
+ - mcp-config
7
+ match:
8
+ # A committed settings file whose trusted-commands list holds a wildcard or a
9
+ # bare shell or interpreter name. Settings names, from each tool's own docs
10
+ # (sources in .kiro/specs/m11-config-tamper/design.md):
11
+ # Kiro IDE (0.x) kiroAgent.trustedCommands (VS Code settings.json), prefix match
12
+ # Claude Code permissions.allow: "Bash" or "Bash(*)" allow every shell command
13
+ # Cursor CLI permissions.allow in .cursor/cli.json: "Shell(*)"
14
+ # The file may carry comments and trailing commas (VS Code settings are JSON
15
+ # with comments). The Copilot form, a map of patterns to true, is EX-034.
16
+ # EX-007 cannot hold this: it is high, and this one is critical, and its
17
+ # value_regex is tuned to tool names, not to command patterns.
18
+ json_path: "$..[?(@property==='kiroAgent.trustedCommands' || (@property==='allow' && @parentProperty==='permissions'))][*]"
19
+ value_regex: '^\s*(?:(?:\*+|\.\*|\^?\.[*+]\$?)|(?:sh|bash|zsh|fish|dash|ksh|csh|tcsh|cmd|powershell|pwsh|node|nodejs|deno|bun|python[0-9.]*|perl|ruby|php|lua|eval|exec|sudo|env|xargs|ssh|curl|wget|nc|ncat|npx|bunx|pnpx|uvx)(?:\s+\*+)?|(?:Bash|Shell|PowerShell)(?:\(\s*(?:\*+|:\*|(?:sh|bash|zsh|fish|dash|ksh|cmd|powershell|pwsh|node|python[0-9.]*|perl|ruby|php|eval|exec|sudo|env|xargs|ssh|curl|wget|nc|npx)(?:\s*:?\s*\*+)?)?\s*\))?)\s*$'
20
+ # Only files that name one of those settings are looked at (generic config files).
21
+ file_regex: 'kiroAgent\.trustedCommands|"permissions"'
22
+ owasp:
23
+ - "ASI02 Inadequate Human-in-the-Loop Controls"
24
+ - "ASI05 Unexpected Code Execution"
25
+ - "LLM06:2025 Excessive Agency"
26
+ fix: >
27
+ Remove the wildcard or the bare shell name from the trusted-commands or allow
28
+ list. List only specific, read-only commands (for example "git status" or
29
+ "pnpm test"), and keep trust for commands in your own user settings, not in a
30
+ file that is committed to the repository.
@@ -0,0 +1,24 @@
1
+ id: EX-034
2
+ title: Copilot terminal auto-approve map that trusts every command
3
+ severity: critical
4
+ applies_to:
5
+ - config
6
+ - mcp-config
7
+ match:
8
+ # VS Code's chat.tools.terminal.autoApprove is a map from a command pattern to
9
+ # true (run without asking) or false (ask), or to { "approve": true }. A key
10
+ # that matches every command, or a bare shell, set to true trusts everything.
11
+ # Source: https://code.visualstudio.com/docs/agents/run/approvals
12
+ # This is a map, so the finding quotes the key (json_path ends in ~), and it
13
+ # cannot share a path with the list forms of EX-033.
14
+ json_path: "$..[?(@property==='chat.tools.terminal.autoApprove')][?(@ === true || (@ && @.approve === true))]~"
15
+ value_regex: '^\s*(?:\*+|/\^?\.[*+]\$?/|\.\*|(?:sh|bash|zsh|fish|dash|ksh|cmd|powershell|pwsh|node|python[0-9.]*|perl|ruby|php|eval|exec|sudo|env|xargs|ssh|curl|wget|nc|npx)(?:\s+\*+)?|/\^?\(?(?:sh|bash|zsh)\b[^/]*/)\s*$'
16
+ file_regex: 'chat\.tools\.terminal\.autoApprove'
17
+ owasp:
18
+ - "ASI02 Inadequate Human-in-the-Loop Controls"
19
+ - "ASI05 Unexpected Code Execution"
20
+ - "LLM06:2025 Excessive Agency"
21
+ fix: >
22
+ Remove the pattern that matches every command from chat.tools.terminal.autoApprove,
23
+ or set it to false. Trust only specific commands such as "git status", and put
24
+ that setting in your user settings, not in a file committed to the repository.
@@ -0,0 +1,29 @@
1
+ id: EX-035
2
+ title: Committed sandbox file turns MCP sandboxing off
3
+ severity: low
4
+ applies_to:
5
+ - config
6
+ # The encyclopedia record for the sandbox policy check (CT-18). The real
7
+ # check is in code: packages/core/src/sandbox-policy.ts reads
8
+ # .kiro/settings/sandbox.json (JSON with comments) and looks at the "enabled"
9
+ # and "mcpSandboxing" fields, which a text match cannot do reliably. So this
10
+ # rule is not run as a signature; the pattern below documents what it reports.
11
+ # Informational: the lowest level there is (a project file can only tighten the
12
+ # global policy, so the global policy may still apply). It stays below the
13
+ # default gate threshold, so it never fails "exorcist gate" or "exorcist scan".
14
+ # Field names: https://kiro.dev/docs/sandbox
15
+ enabled: false
16
+ match:
17
+ regex: '"(?:mcpSandboxing|enabled)"\s*:\s*false'
18
+ file_regex: '\.kiro/settings/sandbox\.json$'
19
+ owasp:
20
+ - "ASI05 Unexpected Code Execution"
21
+ - "LLM06:2025 Excessive Agency"
22
+ fix: >
23
+ A committed .kiro/settings/sandbox.json sets MCP sandboxing (or the whole
24
+ command sandbox) to off, so local MCP server processes run without the
25
+ operating-system boundary. This is information only: a project file can only
26
+ tighten the global sandbox policy, so if your global policy turns it on, it
27
+ still applies. To be covered in every project, set "enabled": true and
28
+ "mcpSandboxing": true in your global ~/.kiro/settings/sandbox.json, or in
29
+ this project file.
package/dist/index.mjs CHANGED
@@ -26728,7 +26728,57 @@ var OPEN_TAG = /<([a-zA-Z][a-zA-Z0-9-]*)\b([^<>]*?)\bstyle\s*=\s*(?:"([^"]*)"|'(
26728
26728
  function plainElementText(html) {
26729
26729
  return html.replace(/<[^>]*>/g, " ").replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/\s+/g, " ").trim();
26730
26730
  }
26731
+ var AI_META_NAME = /^(?:ai|llm|assistant|gpt|chatgpt|claude|kiro|copilot|agent|ai-agent|bot-instructions)(?:[-_:.][a-z0-9_.:-]*)?$/i;
26732
+ var META_TAG = /<meta\b[^<>]*>/gi;
26733
+ var IMG_TAG = /<img\b[^<>]*>/gi;
26734
+ var MD_IMAGE = /!\[([^\]\n]{1,500})\]\(/g;
26735
+ var AI_WORD = "(?:AI|assistants?|agents?|llms?|language\\s+models?|kiro|claude|copilot|chatgpt|gemini|cursor)";
26736
+ var ALT_ADDRESS = new RegExp(
26737
+ `(?:^|[.!?]\\s+)(?:hey\\s+|dear\\s+|attention\\s+)?${AI_WORD}\\s*[,:]|\\b(?:if\\s+you\\s+are|you\\s+are\\s+an?|note\\s+to|message\\s+for|instructions?\\s+for|attention)\\b[^.\\n]{0,30}\\b${AI_WORD}\\b`,
26738
+ "i"
26739
+ );
26740
+ function attr(tag, name) {
26741
+ const m = new RegExp(`\\b${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, "i").exec(tag);
26742
+ return m ? m[1] ?? m[2] ?? "" : null;
26743
+ }
26744
+ function altInstructs(alt) {
26745
+ const t = alt.replace(/\s+/g, " ").trim();
26746
+ return t.length > 0 && (ALT_ADDRESS.test(t) || OVERRIDE.test(t) || ACTION.test(t));
26747
+ }
26748
+ function metaTagFindings(text) {
26749
+ const out = [];
26750
+ META_TAG.lastIndex = 0;
26751
+ let m;
26752
+ while ((m = META_TAG.exec(text)) !== null) {
26753
+ const name = attr(m[0], "name");
26754
+ const content = attr(m[0], "content");
26755
+ if (name === null || content === null || !AI_META_NAME.test(name.trim())) continue;
26756
+ const body = content.replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/\s+/g, " ").trim();
26757
+ if (!addressesAi(body)) continue;
26758
+ out.push({ index: m.index, length: m[0].length, method: "meta-tag", text: body });
26759
+ }
26760
+ return out;
26761
+ }
26762
+ function altTextFindings(text) {
26763
+ const out = [];
26764
+ let m;
26765
+ IMG_TAG.lastIndex = 0;
26766
+ while ((m = IMG_TAG.exec(text)) !== null) {
26767
+ const alt = attr(m[0], "alt");
26768
+ if (alt !== null && altInstructs(alt)) out.push({ index: m.index, length: m[0].length, method: "alt-text", text: alt.replace(/\s+/g, " ").trim() });
26769
+ }
26770
+ MD_IMAGE.lastIndex = 0;
26771
+ while ((m = MD_IMAGE.exec(text)) !== null) {
26772
+ const alt = m[1];
26773
+ if (altInstructs(alt)) out.push({ index: m.index, length: m[0].length, method: "alt-text", text: alt.replace(/\s+/g, " ").trim() });
26774
+ }
26775
+ return out;
26776
+ }
26731
26777
  function findHiddenText(text) {
26778
+ const all = [...findHiddenElements(text), ...metaTagFindings(text), ...altTextFindings(text)];
26779
+ return all.sort((a, b) => a.index - b.index);
26780
+ }
26781
+ function findHiddenElements(text) {
26732
26782
  const out = [];
26733
26783
  OPEN_TAG.lastIndex = 0;
26734
26784
  let lastEnd = -1;
@@ -26751,6 +26801,65 @@ function findHiddenText(text) {
26751
26801
  return out;
26752
26802
  }
26753
26803
 
26804
+ // ../core/src/json-loose.ts
26805
+ function parseJsonLoose(text) {
26806
+ try {
26807
+ return JSON.parse(text);
26808
+ } catch {
26809
+ }
26810
+ try {
26811
+ return JSON.parse(stripJsonComments(text));
26812
+ } catch {
26813
+ return void 0;
26814
+ }
26815
+ }
26816
+ function stripJsonComments(text) {
26817
+ let out = "";
26818
+ let i = text.charCodeAt(0) === 65279 ? 1 : 0;
26819
+ while (i < text.length) {
26820
+ const c = text[i];
26821
+ const next = text[i + 1];
26822
+ if (c === '"') {
26823
+ let j = i + 1;
26824
+ while (j < text.length && text[j] !== '"') j += text[j] === "\\" ? 2 : 1;
26825
+ out += text.slice(i, j + 1);
26826
+ i = j + 1;
26827
+ } else if (c === "/" && next === "/") {
26828
+ while (i < text.length && text[i] !== "\n") i++;
26829
+ } else if (c === "/" && next === "*") {
26830
+ const end = text.indexOf("*/", i + 2);
26831
+ i = end === -1 ? text.length : end + 2;
26832
+ out += " ";
26833
+ } else {
26834
+ out += c;
26835
+ i++;
26836
+ }
26837
+ }
26838
+ return dropTrailingCommas(out);
26839
+ }
26840
+ function dropTrailingCommas(text) {
26841
+ let out = "";
26842
+ let i = 0;
26843
+ while (i < text.length) {
26844
+ const c = text[i];
26845
+ if (c === '"') {
26846
+ let j = i + 1;
26847
+ while (j < text.length && text[j] !== '"') j += text[j] === "\\" ? 2 : 1;
26848
+ out += text.slice(i, j + 1);
26849
+ i = j + 1;
26850
+ } else if (c === ",") {
26851
+ let j = i + 1;
26852
+ while (j < text.length && /\s/.test(text[j])) j++;
26853
+ if (text[j] !== "}" && text[j] !== "]") out += c;
26854
+ i++;
26855
+ } else {
26856
+ out += c;
26857
+ i++;
26858
+ }
26859
+ }
26860
+ return out;
26861
+ }
26862
+
26754
26863
  // ../core/src/scanner/signature-engine.ts
26755
26864
  init_severity_paths();
26756
26865
 
@@ -27370,12 +27479,8 @@ function runSignatures(file, norm, defs, limitMs = REGEX_TIME_LIMIT_MS) {
27370
27479
  }
27371
27480
  }
27372
27481
  if (match.json_path) {
27373
- let parsed;
27374
- try {
27375
- parsed = JSON.parse(norm.original);
27376
- } catch {
27377
- continue;
27378
- }
27482
+ const parsed = parseJsonLoose(norm.original);
27483
+ if (parsed === void 0) continue;
27379
27484
  if (parsed === null || typeof parsed !== "object") continue;
27380
27485
  let results2;
27381
27486
  try {
@@ -27927,6 +28032,47 @@ function scanSourceTools(file, text, defs) {
27927
28032
  }
27928
28033
  }
27929
28034
 
28035
+ // ../core/src/sandbox-policy.ts
28036
+ init_canary();
28037
+ var SANDBOX_RULE_ID = "EX-035";
28038
+ var SANDBOX_FILE = /(?:^|\/)\.kiro\/settings\/sandbox\.json$/;
28039
+ var OWASP = ["ASI05 Unexpected Code Execution", "LLM06:2025 Excessive Agency"];
28040
+ var FIX = 'A project file can only tighten the global sandbox policy, so if your global policy turns the sandbox and MCP wrapping on, it still applies here. To be covered in every project, set "enabled": true and "mcpSandboxing": true in your global ~/.kiro/settings/sandbox.json (or in this file).';
28041
+ function indexOfFalse(text, key) {
28042
+ const re2 = new RegExp(`"${key}"\\s*:\\s*false`, "g");
28043
+ for (let m = re2.exec(text); m; m = re2.exec(text)) {
28044
+ const lineStart = text.lastIndexOf("\n", m.index) + 1;
28045
+ if (!text.slice(lineStart, m.index).includes("//")) return m.index;
28046
+ }
28047
+ return -1;
28048
+ }
28049
+ function sandboxFindings(text, rel) {
28050
+ if (!SANDBOX_FILE.test(rel.replace(/\\/g, "/"))) return [];
28051
+ const doc = parseJsonLoose(text);
28052
+ if (typeof doc !== "object" || doc === null || Array.isArray(doc)) return [];
28053
+ const obj = doc;
28054
+ const mcpOff = obj["mcpSandboxing"] === false;
28055
+ const allOff = obj["enabled"] === false;
28056
+ if (!mcpOff && !allOff) return [];
28057
+ const key = mcpOff ? "mcpSandboxing" : "enabled";
28058
+ const at = indexOfFalse(text, key);
28059
+ if (at < 0) return [];
28060
+ const m = new RegExp(`^"${key}"\\s*:\\s*false`).exec(text.slice(at));
28061
+ const { line, col } = lineColOf(text, at);
28062
+ return [{
28063
+ source: "signature",
28064
+ ruleId: SANDBOX_RULE_ID,
28065
+ title: mcpOff ? "Info: MCP sandboxing is off in this project" : "Info: the command sandbox is off in this project",
28066
+ severity: "low",
28067
+ file: rel,
28068
+ line,
28069
+ col,
28070
+ span: m ? m[0] : `"${key}": false`,
28071
+ owasp: OWASP,
28072
+ fix: FIX
28073
+ }];
28074
+ }
28075
+
27930
28076
  // ../core/src/path-names.ts
27931
28077
  var MAX_PATH_SPAN = 120;
27932
28078
  var CONTROL = /[\u0000-\u001F\u007F-\u009F]/;
@@ -28415,7 +28561,7 @@ function stripJsonc(text) {
28415
28561
  }
28416
28562
  return out.replace(/,(\s*[}\]])/g, "$1");
28417
28563
  }
28418
- function parseJsonLoose(text) {
28564
+ function parseJsonLoose2(text) {
28419
28565
  try {
28420
28566
  return JSON.parse(text);
28421
28567
  } catch {
@@ -28470,7 +28616,7 @@ function serverEntries(servers) {
28470
28616
  function parseMcpConfig(rel, role, text) {
28471
28617
  if (role !== "mcp-config" && !(role === "config" && /\.jsonc?$/i.test(rel))) return null;
28472
28618
  if (role === "config" && !text.includes("mcpServers")) return null;
28473
- const top = Obj.safeParse(parseJsonLoose(text));
28619
+ const top = Obj.safeParse(parseJsonLoose2(text));
28474
28620
  if (!top.success) return null;
28475
28621
  const doc = top.data;
28476
28622
  const entries = [];
@@ -28723,7 +28869,7 @@ async function* scanRepo(root, options) {
28723
28869
  const heurs = options.bedrockClient ? await runHeuristics(file, norm, sigs, options.bedrockClient) : [];
28724
28870
  const traps = canaryFindings(text, file.rel, records, ex022);
28725
28871
  const sourceTools = (file.role === "code" || file.role === "unknown") && languageOf(file.rel) !== null ? scanSourceTools(file, text, defs) : [];
28726
- let deduped = deduplicate([...sigs, ...heurs, ...traps, ...sourceTools]);
28872
+ let deduped = deduplicate([...sigs, ...heurs, ...traps, ...sandboxFindings(text, file.rel), ...sourceTools]);
28727
28873
  if (checkVault && deduped.length > 0 && file.rel.includes(".exorcist/vault/")) {
28728
28874
  const backup = checkVault(file.rel, await readFile3(file.path));
28729
28875
  if (backup) deduped = deduped.map((f) => asBackupFinding(f, backup));
@@ -28959,6 +29105,30 @@ var ENTRIES = {
28959
29105
  headline: "A file or folder name is giving your AI orders",
28960
29106
  attack: 'The name of a file or folder reads like an instruction ("ignore previous instructions...") or hides invisible characters. An agent that lists the project reads every name, so a name alone can steer it.'
28961
29107
  },
29108
+ "EX-030": {
29109
+ headline: "This text asks your AI to change its own settings or guards",
29110
+ attack: "A file tells the agent to add a wildcard to its trusted commands, switch on auto-approve, or edit its hooks, custom agents, steering files or AGENTS.md. If the agent obeys, it stops asking you before it runs commands, and the change stays after the poisoned file is gone."
29111
+ },
29112
+ "EX-031": {
29113
+ headline: "This text tells your AI to skip, delete or weaken your tests and checks",
29114
+ attack: 'A file tells the agent to add .skip to tests, delete a test file as "flaky", commit with --no-verify, add "|| true" to a CI step, lower a coverage threshold, or make a failing check pass without fixing it. A bad change then gets through because the checks no longer catch it.'
29115
+ },
29116
+ "EX-032": {
29117
+ headline: "This text tells your AI to send your code somewhere else",
29118
+ attack: "A file tells the agent to push to a remote that is not your origin, add a new remote, publish a package, switch the package registry, or open a pull request against another repository. If the agent obeys, your code or a poisoned package leaves your control."
29119
+ },
29120
+ "EX-033": {
29121
+ headline: "This settings file lets your AI run any command without asking you",
29122
+ attack: "A committed settings file lists a wildcard or a bare shell name as trusted (Kiro trusted commands, Claude Code or Cursor allow rules). Whoever wrote the file decides that the agent never asks before running a command, so a poisoned file elsewhere in the project can then run anything on your machine."
29123
+ },
29124
+ "EX-034": {
29125
+ headline: "This settings file lets Copilot run any terminal command without asking you",
29126
+ attack: "The terminal auto-approve map in a committed settings file marks a pattern that matches every command as approved. The agent then runs commands without showing you a prompt."
29127
+ },
29128
+ "EX-035": {
29129
+ headline: "This project file switches off the sandbox around your AI tool servers",
29130
+ attack: "A committed Kiro sandbox file turns MCP sandboxing, or the whole command sandbox, off, so local tool servers run without the operating-system boundary. This is only information: a project file can only tighten your global sandbox policy, so your global setting may still apply."
29131
+ },
28962
29132
  "EX-027": {
28963
29133
  headline: "Your AI read untrusted text and private data, and now wants to send something out",
28964
29134
  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."
@@ -29087,6 +29257,28 @@ var AllowedReadsSchema = external_exports.object({ version: external_exports.lit
29087
29257
  init_walker();
29088
29258
  var MAX_SCAN_BYTES = 10 * 1048576;
29089
29259
 
29260
+ // ../core/src/mcp-write-guard.ts
29261
+ var MAX_READ_BYTES = 2 * 1024 * 1024;
29262
+
29263
+ // ../core/src/web-fetch-guard.ts
29264
+ init_zod();
29265
+ init_canary();
29266
+ var EventSchema = external_exports.object({
29267
+ tool_name: external_exports.string().optional(),
29268
+ tool_input: external_exports.record(external_exports.unknown())
29269
+ });
29270
+
29271
+ // ../core/src/env-write-guard.ts
29272
+ init_zod();
29273
+ var EventSchema2 = external_exports.object({
29274
+ tool_name: external_exports.string().optional(),
29275
+ tool_input: external_exports.record(external_exports.unknown())
29276
+ });
29277
+ var MAX_TEXT_CHARS = 2 * 1024 * 1024;
29278
+
29279
+ // ../core/src/env-values.ts
29280
+ var MAX_ENV_FILE_BYTES = 256 * 1024;
29281
+
29090
29282
  // ../core/src/gate.ts
29091
29283
  init_walker();
29092
29284
 
@@ -29267,6 +29459,27 @@ var BaselineSchema = external_exports.object({
29267
29459
  entries: external_exports.array(BaselineEntrySchema)
29268
29460
  }).strict();
29269
29461
 
29462
+ // ../core/src/kiro-evidence.ts
29463
+ init_zod();
29464
+ var KiroEventSchema = external_exports.object({
29465
+ id: external_exports.string(),
29466
+ timestamp: external_exports.string(),
29467
+ payload: external_exports.object({ type: external_exports.string() }).passthrough()
29468
+ }).passthrough();
29469
+ var CRED_KEY = "(?:(?<![A-Za-z])|(?<=\\\\[nrt]))(?<key>aws_secret_access_key|aws_access_key_id|aws_session_token|password|_authToken)";
29470
+ var CRED_DELIMITED_SOURCE = `${CRED_KEY}(?<sep>(?:\\\\*["'])?[ \\t]*[=:][ \\t]*)(?:(?<q>\\\\*["'])(?<quoted>[^"'\\\\]{4,})|(?<bare>[^\\s"'\\\\,;}]{4,}))`;
29471
+ var DROP = Symbol("drop");
29472
+ var SessionJsonSchema = external_exports.object({
29473
+ id: external_exports.string().optional(),
29474
+ title: external_exports.string().optional(),
29475
+ agentMode: external_exports.string().optional(),
29476
+ createdAt: external_exports.string().optional(),
29477
+ lastModifiedAt: external_exports.string().optional(),
29478
+ modelId: external_exports.string().optional(),
29479
+ autopilot: external_exports.boolean().optional(),
29480
+ approveForMe: external_exports.boolean().optional()
29481
+ }).passthrough();
29482
+
29270
29483
  // ../shield/src/paraphrase.ts
29271
29484
  var W = String.raw`[\s\W_]{0,3}`;
29272
29485
  var words = (...ws) => ws.join(`${W}`);
@@ -29623,9 +29836,99 @@ function quarantineServer(o) {
29623
29836
 
29624
29837
  // ../shield/src/events.ts
29625
29838
  init_zod();
29839
+
29840
+ // ../shield/src/chain.ts
29841
+ init_zod();
29842
+
29843
+ // ../shield/src/chain-core.ts
29844
+ init_zod();
29845
+
29846
+ // ../shield/src/sha256.ts
29847
+ var K = new Uint32Array([
29848
+ 1116352408,
29849
+ 1899447441,
29850
+ 3049323471,
29851
+ 3921009573,
29852
+ 961987163,
29853
+ 1508970993,
29854
+ 2453635748,
29855
+ 2870763221,
29856
+ 3624381080,
29857
+ 310598401,
29858
+ 607225278,
29859
+ 1426881987,
29860
+ 1925078388,
29861
+ 2162078206,
29862
+ 2614888103,
29863
+ 3248222580,
29864
+ 3835390401,
29865
+ 4022224774,
29866
+ 264347078,
29867
+ 604807628,
29868
+ 770255983,
29869
+ 1249150122,
29870
+ 1555081692,
29871
+ 1996064986,
29872
+ 2554220882,
29873
+ 2821834349,
29874
+ 2952996808,
29875
+ 3210313671,
29876
+ 3336571891,
29877
+ 3584528711,
29878
+ 113926993,
29879
+ 338241895,
29880
+ 666307205,
29881
+ 773529912,
29882
+ 1294757372,
29883
+ 1396182291,
29884
+ 1695183700,
29885
+ 1986661051,
29886
+ 2177026350,
29887
+ 2456956037,
29888
+ 2730485921,
29889
+ 2820302411,
29890
+ 3259730800,
29891
+ 3345764771,
29892
+ 3516065817,
29893
+ 3600352804,
29894
+ 4094571909,
29895
+ 275423344,
29896
+ 430227734,
29897
+ 506948616,
29898
+ 659060556,
29899
+ 883997877,
29900
+ 958139571,
29901
+ 1322822218,
29902
+ 1537002063,
29903
+ 1747873779,
29904
+ 1955562222,
29905
+ 2024104815,
29906
+ 2227730452,
29907
+ 2361852424,
29908
+ 2428436474,
29909
+ 2756734187,
29910
+ 3204031479,
29911
+ 3329325298
29912
+ ]);
29913
+
29914
+ // ../shield/src/chain-core.ts
29915
+ var HEX64 = /^[0-9a-f]{64}$/;
29916
+ var HeadRecordSchema = external_exports.object({
29917
+ v: external_exports.literal(1),
29918
+ genesis: external_exports.string().regex(HEX64),
29919
+ seq: external_exports.number().int().positive(),
29920
+ hash: external_exports.string().regex(HEX64)
29921
+ }).strict();
29922
+
29923
+ // ../shield/src/chain.ts
29924
+ var GenesisFileSchema = external_exports.object({ v: external_exports.literal(1), genesis: external_exports.string().regex(HEX64) }).strict();
29925
+ var CHUNK = 1 << 20;
29926
+
29927
+ // ../shield/src/events.ts
29626
29928
  var MAX_EVENT_BYTES = 1024 * 1024;
29627
29929
  var MAX_LINE_BYTES = 8 * 1024;
29628
- var MAX_READ_BYTES = 8 * 1024 * 1024;
29930
+ var MAX_READ_BYTES2 = 8 * 1024 * 1024;
29931
+ var HEX642 = /^[0-9a-f]{64}$/;
29629
29932
  var NAME_CHARS2 = 80;
29630
29933
  var WHY_CHARS = 400;
29631
29934
  var MESSAGE_CHARS = 600;
@@ -29639,7 +29942,11 @@ var Base = {
29639
29942
  time: Time2,
29640
29943
  pid: external_exports.number().int().positive(),
29641
29944
  server: Name2,
29642
- session: external_exports.string().regex(KEY_RE).optional()
29945
+ session: external_exports.string().regex(KEY_RE).optional(),
29946
+ /** Hash-chain fields (chain.ts). Absent on lines written before the chain existed or when the lock could not be taken. */
29947
+ seq: external_exports.number().int().positive().optional(),
29948
+ prev: external_exports.string().regex(HEX642).optional(),
29949
+ hash: external_exports.string().regex(HEX642).optional()
29643
29950
  };
29644
29951
  var StartEvent = external_exports.object({
29645
29952
  ...Base,
@@ -29997,7 +30304,7 @@ Tell the user. They can undo this with: exorcist vault restore ${r.value.id}`
29997
30304
  }
29998
30305
 
29999
30306
  // src/index.ts
30000
- var VERSION = "0.2.0";
30307
+ var VERSION = "0.3.0";
30001
30308
  var ctx = {
30002
30309
  cwd: process.cwd(),
30003
30310
  approved: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exorcist-98/mcp-server",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "MCP server for Exorcist 98: scan repos and MCP configs, explain findings, quarantine servers.",