@exorcist-98/mcp-server 0.1.1 → 0.1.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 CHANGED
@@ -21,7 +21,7 @@ out of results unless you ask for it, and is then marked as untrusted.
21
21
  ```json
22
22
  {
23
23
  "mcpServers": {
24
- "exorcist": { "command": "npx", "args": ["-y", "@exorcist-98/mcp-server@0.1.1"] }
24
+ "exorcist": { "command": "npx", "args": ["-y", "@exorcist-98/mcp-server@0.1.2"] }
25
25
  }
26
26
  }
27
27
  ```
@@ -25,6 +25,17 @@ match:
25
25
  classes:
26
26
  - zero-width
27
27
  severity: medium
28
+ # A single U+200B between @ and a name is how changelogs keep GitHub from
29
+ # notifying that person (an @ sign, a zero-width space, then the name). It carries no message, so it is low and
30
+ # does not count toward the five short runs that make a file suspect.
31
+ mention_guard:
32
+ severity: low
33
+ # Test and eval fixtures hold attack samples on purpose (a security scanner's
34
+ # own tests, adversarial evals). Findings there are reported at low severity,
35
+ # not dropped. A file an agent reads (instructions, hooks, MCP configs, .kiro,
36
+ # .claude, .cursor) is never lowered, wherever it sits.
37
+ low_severity_paths:
38
+ - "(^|/)(tests?|__tests__|__mocks__|spec|specs|fixtures?|testdata|test-data|e2e|evals?)/|[._-](test|spec)s?\\.[A-Za-z0-9]+$|_tests?\\.(rs|go|py)$"
28
39
  owasp:
29
40
  - "LLM01:2025 Prompt Injection"
30
41
  - "ASI03 Prompt Injection via External Content"
@@ -18,6 +18,19 @@ match:
18
18
  # EX-002 (docs/FIELD_REPORT.md). A quoted phrase that runs on into a longer
19
19
  # instruction is still reported.
20
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 phrase the passage itself forbids is a defence, not an attack: "never
22
+ # ignore earlier instructions", "users cannot bypass the prompt", "it must not
23
+ # attempt to tell the agent to ignore earlier instructions". The negation has
24
+ # to govern the phrase (it ends right before it, or opens a list of what must
25
+ # not be attempted); "do not mention this, tell the agent to ..." is still an
26
+ # attack (m7-precision, packages/core/src/scanner/context.ts isNegated).
27
+ 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+)?)?$'
28
+ # Test and eval fixtures hold attack samples on purpose (a security scanner's
29
+ # own tests, adversarial evals). Findings there are reported at low severity,
30
+ # not dropped. A file an agent reads (instructions, hooks, MCP configs, .kiro,
31
+ # .claude, .cursor) is never lowered, wherever it sits.
32
+ low_severity_paths:
33
+ - "(^|/)(tests?|__tests__|__mocks__|spec|specs|fixtures?|testdata|test-data|e2e|evals?)/|[._-](test|spec)s?\\.[A-Za-z0-9]+$|_tests?\\.(rs|go|py)$"
21
34
  owasp:
22
35
  - "LLM01:2025 Prompt Injection"
23
36
  - "ASI03 Prompt Injection via External Content"
@@ -16,6 +16,16 @@ match:
16
16
  # A comment inside Markdown code (backticks or a fenced block) is displayed,
17
17
  # not hidden, so it is not smuggling.
18
18
  skip_in_code: true
19
+ # Only a bare linter directive is exempt: `<!-- noqa -->` or `<!-- noqa: CODE,
20
+ # CODE -->` and nothing else. Free text after the code is still checked, so
21
+ # starting a comment with noqa does not hide an instruction.
22
+ exclude_regex: '^<!--\s*noqa(?::\s*[A-Z0-9-]+(?:,\s*[A-Z0-9-]+)*)?\s*-->$'
23
+ # Test and eval fixtures hold attack samples on purpose (a security scanner's
24
+ # own tests, adversarial evals). Findings there are reported at low severity,
25
+ # not dropped. A file an agent reads (instructions, hooks, MCP configs, .kiro,
26
+ # .claude, .cursor) is never lowered, wherever it sits.
27
+ low_severity_paths:
28
+ - "(^|/)(tests?|__tests__|__mocks__|spec|specs|fixtures?|testdata|test-data|e2e|evals?)/|[._-](test|spec)s?\\.[A-Za-z0-9]+$|_tests?\\.(rs|go|py)$"
19
29
  owasp:
20
30
  - "LLM01:2025 Prompt Injection"
21
31
  - "ASI03 Prompt Injection via External Content"
@@ -5,7 +5,7 @@ applies_to:
5
5
  - mcp-config
6
6
  - config
7
7
  match:
8
- regex: "(before (responding|answering|using this tool)|(prior to|before) (invoking|calling|running|using) (this|any|the)\\b|do not (inform|tell|mention|notify|alert) the user|without (telling|informing|notifying|asking) the user|(keep|stay) (this |it )?(quiet|secret|hidden) from|this is required for (audit|telemetry|logging)|(send|include|attach|upload|pass|forward)[^.\\n]{0,60}(~/\\.ssh|id_rsa|\\.env\\b|\\.aws/credentials|private key))"
8
+ regex: "(before (responding|answering|using this tool)|(prior to|before) (invoking|calling|running|using) (this|any|the)\\b|do not (inform|tell|mention|notify|alert) the user|without (telling|informing|notifying|asking) the user|(keep|stay) (this |it )?(quiet|secret|hidden) from|this is required for (audit|telemetry|logging)|\\b(?:send|include|attach|upload|pass|forward)(?:s|es|ed|ing)?\\b[^.\\n]{0,60}(~/\\.ssh|id_rsa|\\.env\\b|\\.aws/credentials|private key))"
9
9
  # Only in files that describe MCP servers or tools. Model or prompt configs
10
10
  # that say \"do not mention\" are ordinary (seen in openai/codex).
11
11
  file_regex: "(\"mcpServers\"|\"inputSchema\"|\"input_schema\")"
@@ -12,8 +12,14 @@ match:
12
12
  # in q= or d= is an image setting (quality, density) that image CDNs and
13
13
  # Next.js image URLs carry, not data.
14
14
  regex: "!\\[[^\\]]*\\]\\(https?://[^)?\\s]+(?=\\?)[^)\\s]*(?:[?&](?:(?:d|q)=(?!\\d{1,4}(?:[&)\\s]|$))|(?:data|payload|content|text|msg|token|key|secret|password|pass|pwd|env|cookie|session|auth|creds?|leak|info|user|email)=)|\\{\\{|\\$\\{|%s|<[a-z_]+>|\\b(?:PLACEHOLDER|REPLACE_ME|INSERT)\\b)[^)\\s]*\\)"
15
- # Well-known badge services take query strings by design.
16
- exclude_regex: "\\]\\(https?://(?:(?:img\\.shields\\.io|shields\\.io|badgen\\.net|badge\\.fury\\.io|(?:app\\.)?codecov\\.io|coveralls\\.io|(?:api\\.)?travis-ci\\.(?:org|com)|(?:dl\\.)?circleci\\.com|api\\.netlify\\.com|deepwiki\\.com/badge|www\\.bestpractices\\.dev|api\\.securityscorecards\\.dev|(?:static\\.)?pepy\\.tech|sonarcloud\\.io|readthedocs\\.org|img\\.badgesize\\.io|snyk\\.io/test|discord(?:app)?\\.com/api/guilds|camo\\.githubusercontent\\.com|vercel\\.com/button|deploy\\.workers\\.cloudflare\\.com)/|github\\.com/[^)]*/(?:badge\\.svg|actions/workflows/))|\\]\\(https?://(?:github\\.com/[^)?]+\\?raw=true\\)|raw\\.githubusercontent\\.com/)"
15
+ # Well-known badge services take query strings by design. So do the image
16
+ # links Google Docs (googleusercontent, ?key=) and GitBook (alt=media&token=)
17
+ # make for pictures that were pasted into a document: the key or token is
18
+ # the picture's own address, issued by the host that serves it. Both are
19
+ # anchored: the host is whole dot-separated labels (so attacker-googleusercontent.com
20
+ # is not exempt), and the query is exactly ?key=... or ?alt=media&token=...
21
+ # with nothing before, between or after (so data cannot ride along).
22
+ exclude_regex: "\\]\\(https?://(?:(?:img\\.shields\\.io|shields\\.io|badgen\\.net|badge\\.fury\\.io|(?:app\\.)?codecov\\.io|coveralls\\.io|(?:api\\.)?travis-ci\\.(?:org|com)|(?:dl\\.)?circleci\\.com|api\\.netlify\\.com|deepwiki\\.com/badge|www\\.bestpractices\\.dev|api\\.securityscorecards\\.dev|(?:static\\.)?pepy\\.tech|sonarcloud\\.io|readthedocs\\.org|img\\.badgesize\\.io|snyk\\.io/test|discord(?:app)?\\.com/api/guilds|camo\\.githubusercontent\\.com|vercel\\.com/button|deploy\\.workers\\.cloudflare\\.com)/|github\\.com/[^)]*/(?:badge\\.svg|actions/workflows/))|\\]\\(https?://(?:github\\.com/[^)?]+\\?raw=true\\)|raw\\.githubusercontent\\.com/)|\\]\\(https?://(?:[a-z0-9-]+\\.)*googleusercontent\\.com/(?:docsz|d)/[^)\\s?]*\\?key=[A-Za-z0-9_-]+\\)|\\]\\(https?://(?:[a-z0-9-]+-)?files\\.gitbook\\.io/~/files/v0/b/gitbook-x-prod\\.appspot\\.com/o/[^)\\s?]*\\?alt=media\\\\?&token=[A-Za-z0-9-]+\\)"
17
23
  # An image inside Markdown code (backticks or a fenced block) is shown as
18
24
  # text and never loaded, so it cannot send anything (security docs quote
19
25
  # defanged examples that way).
@@ -15,6 +15,13 @@ match:
15
15
  # EX-002 (docs/FIELD_REPORT.md). A quoted phrase that runs on into a longer
16
16
  # instruction is still reported.
17
17
  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)'
18
+ # A phrase the passage itself forbids is a defence, not an attack: "never
19
+ # ignore earlier instructions", "users cannot bypass the prompt", "it must not
20
+ # attempt to tell the agent to ignore earlier instructions". The negation has
21
+ # to govern the phrase (it ends right before it, or opens a list of what must
22
+ # not be attempted); "do not mention this, tell the agent to ..." is still an
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+)?)?$'
18
25
  owasp:
19
26
  - "ASI02 Inadequate Human-in-the-Loop Controls"
20
27
  - "LLM06:2025 Excessive Agency"
@@ -13,6 +13,12 @@ match:
13
13
  # naming the servers on each leg; critical when a server on a leg has
14
14
  # auto-approved tools.
15
15
  analysis: trifecta
16
+ # Test and eval fixtures hold attack samples on purpose (a security scanner's
17
+ # own tests, adversarial evals). Findings there are reported at low severity,
18
+ # not dropped. A file an agent reads (instructions, hooks, MCP configs, .kiro,
19
+ # .claude, .cursor) is never lowered, wherever it sits.
20
+ low_severity_paths:
21
+ - "(^|/)(tests?|__tests__|__mocks__|spec|specs|fixtures?|testdata|test-data|e2e|evals?)/|[._-](test|spec)s?\\.[A-Za-z0-9]+$|_tests?\\.(rs|go|py)$"
16
22
  owasp:
17
23
  - "LLM01:2025 Prompt Injection"
18
24
  - "LLM06:2025 Excessive Agency"
package/dist/index.mjs CHANGED
@@ -4142,7 +4142,7 @@ var require_code = __commonJS({
4142
4142
  };
4143
4143
  exports._CodeOrName = _CodeOrName;
4144
4144
  exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
4145
- var Name2 = class extends _CodeOrName {
4145
+ var Name3 = class extends _CodeOrName {
4146
4146
  constructor(s) {
4147
4147
  super();
4148
4148
  if (!exports.IDENTIFIER.test(s))
@@ -4159,7 +4159,7 @@ var require_code = __commonJS({
4159
4159
  return { [this.str]: 1 };
4160
4160
  }
4161
4161
  };
4162
- exports.Name = Name2;
4162
+ exports.Name = Name3;
4163
4163
  var _Code = class extends _CodeOrName {
4164
4164
  constructor(code) {
4165
4165
  super();
@@ -4181,7 +4181,7 @@ var require_code = __commonJS({
4181
4181
  get names() {
4182
4182
  var _a;
4183
4183
  return (_a = this._names) !== null && _a !== void 0 ? _a : this._names = this._items.reduce((names, c) => {
4184
- if (c instanceof Name2)
4184
+ if (c instanceof Name3)
4185
4185
  names[c.str] = (names[c.str] || 0) + 1;
4186
4186
  return names;
4187
4187
  }, {});
@@ -4215,7 +4215,7 @@ var require_code = __commonJS({
4215
4215
  function addCodeArg(code, arg) {
4216
4216
  if (arg instanceof _Code)
4217
4217
  code.push(...arg._items);
4218
- else if (arg instanceof Name2)
4218
+ else if (arg instanceof Name3)
4219
4219
  code.push(arg);
4220
4220
  else
4221
4221
  code.push(interpolate(arg));
@@ -4241,7 +4241,7 @@ var require_code = __commonJS({
4241
4241
  if (a === '""')
4242
4242
  return b;
4243
4243
  if (typeof a == "string") {
4244
- if (b instanceof Name2 || a[a.length - 1] !== '"')
4244
+ if (b instanceof Name3 || a[a.length - 1] !== '"')
4245
4245
  return;
4246
4246
  if (typeof b != "string")
4247
4247
  return `${a.slice(0, -1)}${b}"`;
@@ -4249,7 +4249,7 @@ var require_code = __commonJS({
4249
4249
  return a.slice(0, -1) + b.slice(1);
4250
4250
  return;
4251
4251
  }
4252
- if (typeof b == "string" && b[0] === '"' && !(a instanceof Name2))
4252
+ if (typeof b == "string" && b[0] === '"' && !(a instanceof Name3))
4253
4253
  return `"${a}${b.slice(1)}`;
4254
4254
  return;
4255
4255
  }
@@ -11548,6 +11548,24 @@ var init_canary = __esm({
11548
11548
  }
11549
11549
  });
11550
11550
 
11551
+ // ../core/src/severity-paths.ts
11552
+ function keepsFullSeverity(rel, role) {
11553
+ const norm = rel.replace(/\\/g, "/");
11554
+ return NEVER_LOWERED_ROLES.has(role) || AGENT_PATH.test(norm);
11555
+ }
11556
+ function lowersSeverity(def, rel, role) {
11557
+ if (!def.low_severity_paths || keepsFullSeverity(rel, role)) return false;
11558
+ return def.low_severity_paths.some((p) => new RegExp(p, "i").test(rel));
11559
+ }
11560
+ var NEVER_LOWERED_ROLES, AGENT_PATH;
11561
+ var init_severity_paths = __esm({
11562
+ "../core/src/severity-paths.ts"() {
11563
+ "use strict";
11564
+ NEVER_LOWERED_ROLES = /* @__PURE__ */ new Set(["instruction", "memory", "hook", "mcp-config", "tool-result", "power"]);
11565
+ AGENT_PATH = /(^|\/)(\.kiro|\.claude|\.cursor)\/|(^|\/)\.github\/(?:[^/]*instructions[^/]*|instructions|prompts)(\/|$)/i;
11566
+ }
11567
+ });
11568
+
11551
11569
  // ../core/src/walker.ts
11552
11570
  import { opendir, stat, open } from "node:fs/promises";
11553
11571
  import { join as join4, relative as relative2, extname, basename as basename2 } from "node:path";
@@ -11616,6 +11634,7 @@ var MAX_FILE_SIZE, AGENT_FILE_HARD_LIMIT, AGENT_FACING_ROLES, LOCKFILE_NAMES, BI
11616
11634
  var init_walker = __esm({
11617
11635
  "../core/src/walker.ts"() {
11618
11636
  "use strict";
11637
+ init_severity_paths();
11619
11638
  MAX_FILE_SIZE = 1048576;
11620
11639
  AGENT_FILE_HARD_LIMIT = 10 * 1048576;
11621
11640
  AGENT_FACING_ROLES = /* @__PURE__ */ new Set(["instruction", "memory", "hook", "config", "mcp-config", "tool-result", "power"]);
@@ -22454,7 +22473,18 @@ var PolicySchema = external_exports.object({
22454
22473
  * which ordinary use rarely does, and then a single question is cheap next
22455
22474
  * to a leaked key. `mode: monitor` makes it monitor too.
22456
22475
  */
22457
- sessionGuard: external_exports.enum(["hold", "block", "monitor", "off"]).default("hold")
22476
+ sessionGuard: external_exports.enum(["hold", "block", "monitor", "off"]).default("hold"),
22477
+ /**
22478
+ * Who may release a call that Session Guard (EX-027) is holding:
22479
+ * `os`: the operating system confirms the owner (Touch ID or login
22480
+ * password on macOS). A forged `cli.json` release no longer works.
22481
+ * Falls back to `terminal` when the OS check is unavailable;
22482
+ * `terminal`: a release recorded by `exorcist approve` from a terminal,
22483
+ * as before.
22484
+ * Optional with no default: when absent the Shield picks `os` if it is
22485
+ * available, else `terminal`. Older Shields reject this key.
22486
+ */
22487
+ sessionRelease: external_exports.enum(["os", "terminal"]).optional()
22458
22488
  }).strict();
22459
22489
 
22460
22490
  // ../shield/src/state.ts
@@ -25619,6 +25649,13 @@ var MatchSchema = external_exports.object({
25619
25649
  // matching this regex (words such as "never", "such as", "injection"), is
25620
25650
  // being quoted as an example or warned against, not given as an order.
25621
25651
  quoted_example_cues: external_exports.string().optional(),
25652
+ // A phrase that the text itself forbids is a defence, not an attack ("it
25653
+ // must not attempt to tell the agent to ignore earlier instructions",
25654
+ // "users cannot bypass the prompt"). Checked against the text from the
25655
+ // start of the sentence up to the match (at most 200 characters), anchored
25656
+ // at its end with `$`, so the negation has to govern the phrase and not
25657
+ // merely appear somewhere before it (m7-precision).
25658
+ negated_cues: external_exports.string().optional(),
25622
25659
  // Matches separated only by line breaks, quotes, commas or `+` are one
25623
25660
  // encoded blob: one finding, checked as a whole.
25624
25661
  merge_adjacent: external_exports.boolean().optional(),
@@ -25640,6 +25677,12 @@ var MatchSchema = external_exports.object({
25640
25677
  // `detonation` is the Detonation Chamber (EX-024, m5-detonation): a
25641
25678
  // sandboxed model run, only with `--detonate`.
25642
25679
  analysis: external_exports.enum(["trifecta", "detonation"]).optional(),
25680
+ // unicode_class only: a single U+200B directly after `@` and before a name
25681
+ // is the way changelogs stop GitHub from notifying the person. Reported at
25682
+ // `severity` and not counted toward the escalation of many short runs.
25683
+ mention_guard: external_exports.object({
25684
+ severity: external_exports.enum(["critical", "high", "medium", "low"])
25685
+ }).optional(),
25643
25686
  minor_run: external_exports.object({
25644
25687
  max_length: external_exports.number().int().min(1),
25645
25688
  classes: external_exports.array(external_exports.string()).min(1),
@@ -25662,7 +25705,7 @@ var MatchSchema = external_exports.object({
25662
25705
  if ((val.exclude_regex !== void 0 || val.validate !== void 0) && val.regex === void 0 && val.json_path === void 0) {
25663
25706
  ctx2.addIssue({ code: external_exports.ZodIssueCode.custom, message: "match.exclude_regex and match.validate need match.regex or match.json_path" });
25664
25707
  }
25665
- for (const key of ["regex", "value_regex", "exclude_regex", "file_regex", "quoted_example_cues", "decoded_flag_regex"]) {
25708
+ for (const key of ["regex", "value_regex", "exclude_regex", "file_regex", "quoted_example_cues", "negated_cues", "decoded_flag_regex"]) {
25666
25709
  const pattern = val[key];
25667
25710
  if (pattern !== void 0 && !compiles(pattern)) {
25668
25711
  ctx2.addIssue({
@@ -25683,6 +25726,10 @@ var VirusDefinitionSchema = external_exports.object({
25683
25726
  enabled: external_exports.boolean().optional().default(true),
25684
25727
  // Repo-relative paths (regexes) this rule never looks at, e.g. lockfiles.
25685
25728
  skip_paths: external_exports.array(external_exports.string().refine(compiles, "skip_paths entries must be valid regular expressions")).optional(),
25729
+ // Repo-relative paths (regexes) where this rule reports at low severity
25730
+ // instead of its own (test and eval folders). Never applied to a file an
25731
+ // agent reads: see keepsFullSeverity in walker.ts.
25732
+ low_severity_paths: external_exports.array(external_exports.string().refine(compiles, "low_severity_paths entries must be valid regular expressions")).optional(),
25686
25733
  // Rules in the same group that report the same line of the same file are
25687
25734
  // one problem: only the most severe of them is kept.
25688
25735
  same_line_group: external_exports.string().min(1).optional()
@@ -26571,6 +26618,9 @@ function decodeHidden(text) {
26571
26618
  return out.slice(0, MAX_HIDDEN_RUNS);
26572
26619
  }
26573
26620
 
26621
+ // ../core/src/scanner/signature-engine.ts
26622
+ init_severity_paths();
26623
+
26574
26624
  // ../core/src/known-packages.ts
26575
26625
  var KNOWN_MCP_PACKAGES = [
26576
26626
  "@modelcontextprotocol/server-filesystem",
@@ -26733,7 +26783,7 @@ var EXEC_KEYS = /* @__PURE__ */ new Set([
26733
26783
  ]);
26734
26784
  var KEY_AT_LINE_START = /^\s*[{[,]?\s*(?:-\s*)?["']?([A-Za-z0-9_.-]+)["']?\s*:/;
26735
26785
  var KEY_ON_LINE = /(?:["']([A-Za-z0-9_.-]+)["']|(?:^|[\s{,[-])([A-Za-z0-9_.-]+))\s*:(?=\s|["'[{|>]|$)/g;
26736
- var IMPERATIVE_BEFORE = /\b(?:run|execute|exec|paste|type|enter|invoke)\b\W{0,3}$/i;
26786
+ var IMPERATIVE_BEFORE = /(?<![.\w$])\b(?:run|execute|exec|paste|type|enter|invoke)\b[^\w(]{0,3}$/i;
26737
26787
  var normKey = (k) => k.toLowerCase().replace(/[-_]/g, "");
26738
26788
  function inExecContext(rel, text, at, match = "") {
26739
26789
  if (AGENT_ENV_PATH.test(rel)) return true;
@@ -26741,6 +26791,10 @@ function inExecContext(rel, text, at, match = "") {
26741
26791
  const lineStart = text.lastIndexOf("\n", at - 1) + 1;
26742
26792
  const before = text.slice(lineStart, at);
26743
26793
  if (IMPERATIVE_BEFORE.test(before.slice(-40))) return true;
26794
+ if (/\.json$/i.test(rel)) {
26795
+ const j = jsonKeyAt(text, at);
26796
+ if (j.inString && j.key !== null) return EXEC_KEYS.has(normKey(j.key));
26797
+ }
26744
26798
  const keys = [...before.matchAll(KEY_ON_LINE)];
26745
26799
  const own = keys[keys.length - 1];
26746
26800
  if (own) return EXEC_KEYS.has(normKey(own[1] ?? own[2] ?? ""));
@@ -26811,6 +26865,81 @@ function decodeBlob(s) {
26811
26865
  if (/[^A-Za-z0-9+/]/.test(b)) return null;
26812
26866
  return Buffer.from(b, "base64").toString("utf8");
26813
26867
  }
26868
+ var jsonCache = null;
26869
+ function jsonStrings(text) {
26870
+ if (jsonCache && jsonCache.text === text) return jsonCache.strings;
26871
+ const strings2 = [];
26872
+ const stack = [];
26873
+ let i = 0;
26874
+ while (i < text.length) {
26875
+ const c = text[i];
26876
+ if (c === '"') {
26877
+ let j = i + 1;
26878
+ while (j < text.length && text[j] !== '"') j += text[j] === "\\" ? 2 : 1;
26879
+ let k = j + 1;
26880
+ while (k < text.length && /\s/.test(text[k] ?? "")) k++;
26881
+ const top = stack[stack.length - 1];
26882
+ if (top && top.kind === "{" && text[k] === ":") {
26883
+ try {
26884
+ top.key = JSON.parse(text.slice(i, j + 1));
26885
+ } catch {
26886
+ top.key = text.slice(i + 1, j);
26887
+ }
26888
+ } else {
26889
+ strings2.push({ start: i, end: j, key: top ? top.key : null });
26890
+ }
26891
+ i = j + 1;
26892
+ continue;
26893
+ }
26894
+ if (c === "{" || c === "[") {
26895
+ const top = stack[stack.length - 1];
26896
+ stack.push({ kind: c, key: c === "[" ? top ? top.key : null : null });
26897
+ } else if (c === "}" || c === "]") {
26898
+ stack.pop();
26899
+ } else if (c === ",") {
26900
+ const top = stack[stack.length - 1];
26901
+ if (top && top.kind === "{") top.key = null;
26902
+ }
26903
+ i++;
26904
+ }
26905
+ jsonCache = { text, strings: strings2 };
26906
+ return strings2;
26907
+ }
26908
+ function jsonKeyAt(text, at) {
26909
+ const strings2 = jsonStrings(text);
26910
+ let lo = 0;
26911
+ let hi = strings2.length - 1;
26912
+ while (lo <= hi) {
26913
+ const mid = lo + hi >> 1;
26914
+ const s = strings2[mid];
26915
+ if (!s) break;
26916
+ if (at < s.start) hi = mid - 1;
26917
+ else if (at > s.end) lo = mid + 1;
26918
+ else return { inString: true, key: s.key };
26919
+ }
26920
+ return { inString: false, key: null };
26921
+ }
26922
+ function isNegated(text, index, cues) {
26923
+ const prefix = text.slice(Math.max(0, index - 200), index);
26924
+ let cut = prefix.lastIndexOf("\n") + 1;
26925
+ for (const m of prefix.matchAll(/[.!?;](?=\s)/g)) cut = Math.max(cut, (m.index ?? 0) + 1);
26926
+ return cues.test(prefix.slice(cut));
26927
+ }
26928
+ var COMMAND_LIKE = /(https?:\/\/|\bcurl\b|\bwget\b|\|\s*(ba|z)?sh\b|powershell|\$\(|`)/i;
26929
+ var SQL_START = /^\s*(?:--[^\n]*\n\s*)*(?:select\s|insert\s+into\s|update\s+\S+\s+set\s|delete\s+from\s|create\s+(?:or\s+alter\s+)?(?:table|view|procedure|function|database|schema|index)\b|alter\s+table\b|with\s+\w+\s+as\s*\(|declare\s+@|merge\s+into\s)/i;
26930
+ var KQL_START = /^\s*(?:\/\/[^\n]*\n\s*)*(?:\.(?:create|alter|set|append|drop|show)\b|let\s+\w+\s*=|[A-Za-z_][\w.]*\s*\r?\n\s*\|\s*(?:where|project|summarize|extend|take|limit|join|order|sort|count|distinct|top|render|parse|mv-expand)\b)/i;
26931
+ var TMDL_START = /^\s*(?:table|model|namespace|culture|cultureInfo|relationship|expression|database)\b[^\n]*\r?\n\s+[A-Za-z]+\s*[:=]/;
26932
+ var MINISIGN = /^untrusted comment:/;
26933
+ var DECLARED_PAYLOAD = /"payloadType"\s*:\s*"InlineBase64"/i;
26934
+ function benignPayloadKind(decoded, around) {
26935
+ if (MINISIGN.test(decoded)) return "minisign key or signature";
26936
+ if (COMMAND_LIKE.test(decoded)) return null;
26937
+ if (SQL_START.test(decoded)) return "SQL script";
26938
+ if (KQL_START.test(decoded)) return "KQL script";
26939
+ if (TMDL_START.test(decoded)) return "semantic model definition";
26940
+ if (DECLARED_PAYLOAD.test(around)) return "declared InlineBase64 payload";
26941
+ return null;
26942
+ }
26814
26943
 
26815
26944
  // ../core/src/scanner/signature-engine.ts
26816
26945
  var MAX_SPAN = 120;
@@ -26864,13 +26993,42 @@ function locateJsonValue(original, value, occurrence = 0) {
26864
26993
  if (idx === -1) return { line: 1, col: 1 };
26865
26994
  return offsetToPosition(original, idx);
26866
26995
  }
26996
+ var OPTIONS_WITH_VALUE = /* @__PURE__ */ new Set([
26997
+ "--python",
26998
+ "--python-preference",
26999
+ "--with",
27000
+ "--with-editable",
27001
+ "--with-requirements",
27002
+ "--index",
27003
+ "--index-url",
27004
+ "--extra-index-url",
27005
+ "--default-index",
27006
+ "--directory",
27007
+ "--env-file",
27008
+ "--constraints",
27009
+ "--overrides",
27010
+ "--registry",
27011
+ "--cache",
27012
+ "--cache-dir",
27013
+ "--userconfig"
27014
+ ]);
27015
+ var PYTHON_VERSION = /^(?:(?:cpython|pypy)[-@]?)?\d+(?:\.\d+){0,2}(?:t|-[a-z0-9_.-]+)?$/i;
26867
27016
  function packageArg(args) {
26868
27017
  for (let i = 0; i < args.length; i++) {
26869
27018
  const a = args[i];
26870
27019
  if (typeof a !== "string") return null;
26871
27020
  if (a === "--package" || a === "-p" || a === "--from") {
26872
27021
  const v = args[i + 1];
26873
- return typeof v === "string" ? v : null;
27022
+ if (typeof v !== "string") return null;
27023
+ if (a === "-p" && PYTHON_VERSION.test(v)) {
27024
+ i++;
27025
+ continue;
27026
+ }
27027
+ return v;
27028
+ }
27029
+ if (OPTIONS_WITH_VALUE.has(a)) {
27030
+ i++;
27031
+ continue;
26874
27032
  }
26875
27033
  const eq = /^--(?:package|from)=(.+)$/.exec(a);
26876
27034
  if (eq) return eq[1] ?? null;
@@ -26900,7 +27058,7 @@ function looksLikeText(bytes) {
26900
27058
  const text = bytes.toString("latin1");
26901
27059
  if (/^\s*[{[]/.test(text)) return false;
26902
27060
  const words2 = text.split(/\s+/).filter((w) => /[A-Za-z]{2,}/.test(w)).length;
26903
- return words2 >= 4 || /(https?:\/\/|\bcurl\b|\bwget\b|\|\s*(ba|z)?sh\b|powershell|\$\(|`)/i.test(text);
27061
+ return words2 >= 4 || COMMAND_LIKE.test(text);
26904
27062
  }
26905
27063
  function rawMatches(re2, text) {
26906
27064
  const out = [];
@@ -26938,11 +27096,13 @@ function runSignatures(file, norm, defs, limitMs = REGEX_TIME_LIMIT_MS) {
26938
27096
  const active = [];
26939
27097
  const jobs = [];
26940
27098
  const vis = norm.visible;
27099
+ const lowered = /* @__PURE__ */ new Set();
26941
27100
  const ctx2 = makeContext(file, norm, defs, limitMs);
26942
27101
  for (const def of defs) {
26943
27102
  if (def.enabled === false) continue;
26944
27103
  if (!def.applies_to.includes(file.role)) continue;
26945
27104
  if (def.skip_paths?.some((p) => getRegex(p, "i").test(file.rel))) continue;
27105
+ if (lowersSeverity(def, file.rel, file.role)) lowered.add(def.id);
26946
27106
  const { match } = def;
26947
27107
  if (match.analysis) continue;
26948
27108
  if (match.file_regex && file.role === "config" && !getRegex(match.file_regex, "i").test(norm.plain)) continue;
@@ -27029,6 +27189,7 @@ function runSignatures(file, norm, defs, limitMs = REGEX_TIME_LIMIT_MS) {
27029
27189
  let run = [];
27030
27190
  const mineStart = findings.length;
27031
27191
  let minorRuns = 0;
27192
+ const guards = /* @__PURE__ */ new Set();
27032
27193
  let decodedRuns = 0;
27033
27194
  const flush = () => {
27034
27195
  const first = run[0];
@@ -27040,11 +27201,15 @@ function runSignatures(file, norm, defs, limitMs = REGEX_TIME_LIMIT_MS) {
27040
27201
  const { line, col } = offsetToPosition(norm.original, first.offset);
27041
27202
  const minor = match.minor_run;
27042
27203
  const isMinor = Boolean(minor && run.length <= minor.max_length && run.every((h) => minor.classes.includes(h.class)));
27043
- if (isMinor) minorRuns++;
27044
- const severity = isMinor && minor ? minor.severity : base.severity;
27204
+ const guard = match.mention_guard;
27205
+ const isGuard = Boolean(guard && run.length === 1 && first.codePoint === 8203 && norm.original[first.offset - 1] === "@" && /[A-Za-z0-9_]/.test(norm.original[first.offset + 1] ?? ""));
27206
+ if (isMinor && !isGuard) minorRuns++;
27207
+ const severity = isGuard && guard ? guard.severity : isMinor && minor ? minor.severity : base.severity;
27045
27208
  const decoded = decodedRuns < MAX_HIDDEN_RUNS ? decodedForRun(run) : void 0;
27046
27209
  if (decoded !== void 0) decodedRuns += 1;
27047
- findings.push({ ...base, severity, line, col, span: joinEscapes(run), ...decoded !== void 0 ? { decoded } : {} });
27210
+ const out2 = { ...base, severity, line, col, span: joinEscapes(run), ...decoded !== void 0 ? { decoded } : {} };
27211
+ if (isGuard) guards.add(out2);
27212
+ findings.push(out2);
27048
27213
  run = [];
27049
27214
  };
27050
27215
  for (const hit of norm.hiddenUnicode) {
@@ -27060,7 +27225,7 @@ function runSignatures(file, norm, defs, limitMs = REGEX_TIME_LIMIT_MS) {
27060
27225
  if (minorRuns >= MINOR_RUNS_ESCALATE) {
27061
27226
  for (let i = mineStart; i < findings.length; i++) {
27062
27227
  const f = findings[i];
27063
- if (f && f.ruleId === def.id) findings[i] = { ...f, severity: base.severity };
27228
+ if (f && f.ruleId === def.id && !guards.has(f)) findings[i] = { ...f, severity: base.severity };
27064
27229
  }
27065
27230
  }
27066
27231
  }
@@ -27103,7 +27268,8 @@ function runSignatures(file, norm, defs, limitMs = REGEX_TIME_LIMIT_MS) {
27103
27268
  }
27104
27269
  }
27105
27270
  }
27106
- return sameLineGroups(findings, defs);
27271
+ const out = lowered.size === 0 ? findings : findings.map((f) => lowered.has(f.ruleId) ? { ...f, severity: "low" } : f);
27272
+ return sameLineGroups(out, defs);
27107
27273
  }
27108
27274
  var SEVERITY_RANK = { critical: 4, high: 3, medium: 2, low: 1 };
27109
27275
  function sameLineGroups(findings, defs) {
@@ -27155,7 +27321,11 @@ function makeContext(file, norm, defs, limitMs) {
27155
27321
  let fences = null;
27156
27322
  let rescan = null;
27157
27323
  const rescanRules = (self) => {
27158
- rescan ??= defs.filter((d) => d.enabled !== false && d.id !== self.id && d.match.regex && !d.match.merge_adjacent && (d.applies_to.includes("instruction") || d.applies_to.includes("hook"))).map((d) => ({ re: getRegex(d.match.regex, "gi"), cues: d.match.quoted_example_cues ? getRegex(d.match.quoted_example_cues, "i") : null }));
27324
+ rescan ??= defs.filter((d) => d.enabled !== false && d.id !== self.id && d.match.regex && !d.match.merge_adjacent && (d.applies_to.includes("instruction") || d.applies_to.includes("hook"))).map((d) => ({
27325
+ re: getRegex(d.match.regex, "gi"),
27326
+ cues: d.match.quoted_example_cues ? getRegex(d.match.quoted_example_cues, "i") : null,
27327
+ neg: d.match.negated_cues ? getRegex(d.match.negated_cues, "i") : null
27328
+ }));
27159
27329
  return rescan;
27160
27330
  };
27161
27331
  return {
@@ -27169,6 +27339,7 @@ function makeContext(file, norm, defs, limitMs) {
27169
27339
  if (inMarkdownCode(norm.plain, at, fences)) return false;
27170
27340
  }
27171
27341
  if (m.quoted_example_cues && isQuotedExample(src, index, text.length, getRegex(m.quoted_example_cues, "i"))) return false;
27342
+ if (m.negated_cues && isNegated(src, index, getRegex(m.negated_cues, "i"))) return false;
27172
27343
  return true;
27173
27344
  },
27174
27345
  /**
@@ -27186,7 +27357,9 @@ function makeContext(file, norm, defs, limitMs) {
27186
27357
  if (piece === void 0) return false;
27187
27358
  if (m.validate !== "base64-text" && m.validate !== "encoded-text") return true;
27188
27359
  const decoded = decodeBlob(merged) ?? decodeBlob(piece) ?? "";
27189
- if (embeddedDocumentKind(decoded) === null) return true;
27360
+ const first = group[0];
27361
+ const around = first ? norm.plain.slice(Math.max(0, first.at - 300), first.at + merged.length + 300) : "";
27362
+ if (embeddedDocumentKind(decoded) === null && benignPayloadKind(decoded, around) === null) return true;
27190
27363
  const sample = decoded.slice(0, 2e5);
27191
27364
  if (m.decoded_flag_regex && getRegex(m.decoded_flag_regex, "i").test(sample)) return true;
27192
27365
  const rules = rescanRules(def);
@@ -27194,7 +27367,8 @@ function makeContext(file, norm, defs, limitMs) {
27194
27367
  if (hits === null) return true;
27195
27368
  return hits.some((h, i) => h.some(([index, t]) => {
27196
27369
  const cues = rules[i]?.cues;
27197
- return !cues || !isQuotedExample(sample, index, t.length, cues);
27370
+ const neg = rules[i]?.neg;
27371
+ return (!cues || !isQuotedExample(sample, index, t.length, cues)) && (!neg || !isNegated(sample, index, neg));
27198
27372
  }));
27199
27373
  }
27200
27374
  };
@@ -27561,6 +27735,8 @@ init_zod();
27561
27735
  import { constants } from "node:fs";
27562
27736
  import { lstat, open as open2 } from "node:fs/promises";
27563
27737
  import { join as join6 } from "node:path";
27738
+ init_severity_paths();
27739
+ init_walker();
27564
27740
  var TRIFECTA_RULE_ID = "EX-023";
27565
27741
  var MAX_PINS_BYTES = 4e6;
27566
27742
  function stripJsonc(text) {
@@ -27761,6 +27937,8 @@ function trifectaFinding(config2, map2, defs) {
27761
27937
  if (!map2.trifecta || map2.severity === null) return null;
27762
27938
  const def = defs.find((d) => d.id === TRIFECTA_RULE_ID && d.enabled !== false && d.match.analysis === "trifecta");
27763
27939
  if (!def) return null;
27940
+ if (def.skip_paths?.some((p) => new RegExp(p, "i").test(config2.file))) return null;
27941
+ const lowered = lowersSeverity(def, config2.file, classifyFile(config2.file));
27764
27942
  const legs = CAPABILITIES.map((c) => `${LEG_WORDS[c]} ${map2.legs[c].join(", ")}`).join("; ");
27765
27943
  const auto = map2.ghosts.filter((g) => g.autoApproved && g.capabilities.length > 0).map((g) => g.name);
27766
27944
  const autoText = auto.length > 0 ? ` Tools on ${auto.join(", ")} are auto-approved, so nothing asks you first.` : "";
@@ -27768,7 +27946,7 @@ function trifectaFinding(config2, map2, defs) {
27768
27946
  source: "signature",
27769
27947
  ruleId: def.id,
27770
27948
  title: def.title,
27771
- severity: map2.severity,
27949
+ severity: lowered ? "low" : map2.severity,
27772
27950
  file: config2.file,
27773
27951
  line: config2.anchor.line,
27774
27952
  col: config2.anchor.col,
@@ -27924,6 +28102,56 @@ function scanText(text, role, defs, label = "(text)", limitMs = REGEX_TIME_LIMIT
27924
28102
 
27925
28103
  // ../core/src/reporters/json-reporter.ts
27926
28104
  init_zod();
28105
+
28106
+ // ../core/src/redact-secrets.ts
28107
+ var MIN_LENGTH_FOR_PREFIX = 16;
28108
+ var PREFIX_CHARS = 4;
28109
+ var TOKEN_KINDS = [
28110
+ { type: "github-token", re: /^(?:gh[pousr]_[A-Za-z0-9]{36}|github_pat_[A-Za-z0-9_]{60,})$/ },
28111
+ { type: "anthropic-key", re: /^sk-ant-api\d\d-[A-Za-z0-9_-]{40,}$/ },
28112
+ { type: "openai-key", re: /^sk-(?:proj-)?[A-Za-z0-9_-]{40,}$/ },
28113
+ { type: "aws-access-key", re: /^AKIA[0-9A-Z]{16}$/ },
28114
+ { type: "slack-token", re: /^xox[baprs]-[0-9A-Za-z-]{20,}$/ },
28115
+ { type: "google-api-key", re: /^AIza[0-9A-Za-z_-]{35}$/ },
28116
+ { type: "stripe-key", re: /^sk_live_[0-9A-Za-z]{24,}$/ },
28117
+ { type: "npm-token", re: /^npm_[A-Za-z0-9]{36}$/ }
28118
+ ];
28119
+ var BARE_TOKEN = /\b(?:gh[pousr]_[A-Za-z0-9]{36}|github_pat_[A-Za-z0-9_]{60,}|sk-(?:proj-|ant-api\d\d-)?[A-Za-z0-9_-]{40,}|AKIA[0-9A-Z]{16}|xox[baprs]-[0-9A-Za-z-]{20,}|AIza[0-9A-Za-z_-]{35}|sk_live_[0-9A-Za-z]{24,}|npm_[A-Za-z0-9]{36})\b/g;
28120
+ var PEM = ["PRIVATE", "KEY"].join(" ");
28121
+ var PRIVATE_KEY = new RegExp(
28122
+ `-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP |ENCRYPTED )?${PEM}(?: BLOCK)?-----(?:[\\s\\S]*?-----END [A-Z ]*${PEM}(?: BLOCK)?-----|[\\s\\S]*$)`,
28123
+ "g"
28124
+ );
28125
+ var DATABASE_URL = /\b(DATABASE_URL=)([a-z+]+:\/\/[^\s:@/]+:[^\s@/]+@[^\s]+)/g;
28126
+ var SECRET_VARIABLE = /\b((?:AWS_SECRET_ACCESS_KEY|GITHUB_TOKEN|GH_TOKEN|OPENAI_API_KEY|ANTHROPIC_API_KEY|SLACK_BOT_TOKEN|STRIPE_SECRET_KEY|GOOGLE_API_KEY|NPM_TOKEN)=)(?!EXAMPLE_|\[redacted )([^\s]+)/g;
28127
+ var PLACEHOLDER_VALUE = /^["']?(?:\[?redacted\]?|x{3,}|\*{3,}|<|\$\{?[A-Za-z_]+\}?|your[_-]|changeme|placeholder|dummy|fake)/i;
28128
+ function typeOfToken(value) {
28129
+ return TOKEN_KINDS.find((k) => k.re.test(value))?.type ?? "secret-variable";
28130
+ }
28131
+ function redactionMarker(type2, secret) {
28132
+ const head = secret.length >= MIN_LENGTH_FOR_PREFIX ? `${secret.slice(0, PREFIX_CHARS)}\u2026, ` : "";
28133
+ return `[redacted ${type2}: ${head}${secret.length} chars]`;
28134
+ }
28135
+ function redactSecretText(text) {
28136
+ if (text.length === 0) return text;
28137
+ let out = text.replace(PRIVATE_KEY, (m) => `[redacted private-key: ${m.length} chars]`);
28138
+ out = out.replace(DATABASE_URL, (_m, name, value) => `${name}${redactionMarker("database-url", value)}`);
28139
+ out = out.replace(SECRET_VARIABLE, (m, name, value) => PLACEHOLDER_VALUE.test(value) ? m : `${name}${redactionMarker(typeOfToken(value.replace(/^["']|["',;]+$/g, "")), value)}`);
28140
+ out = out.replace(BARE_TOKEN, (m) => redactionMarker(typeOfToken(m), m));
28141
+ return out;
28142
+ }
28143
+ function redactFinding(f) {
28144
+ let span = redactSecretText(f.span);
28145
+ if (f.ruleId === "EX-011" && span === f.span && f.span.length > 0 && !f.span.includes("[redacted ")) {
28146
+ span = `[redacted secret: ${f.span.length} chars]`;
28147
+ }
28148
+ const out = { ...f, span };
28149
+ if (out.source === "heuristic") out.rationale = redactSecretText(out.rationale);
28150
+ if (out.source === "signature" && out.decoded !== void 0) out.decoded = redactSecretText(out.decoded);
28151
+ return out;
28152
+ }
28153
+
28154
+ // ../core/src/reporters/json-reporter.ts
27927
28155
  var ScanStatsSchema = external_exports.object({
27928
28156
  filesScanned: external_exports.number().int().nonnegative(),
27929
28157
  filesSkipped: external_exports.number().int().nonnegative(),
@@ -28071,6 +28299,18 @@ function plainFor(ruleId, fallbackTitle) {
28071
28299
  };
28072
28300
  }
28073
28301
 
28302
+ // ../core/src/exorcise.ts
28303
+ init_walker();
28304
+ var RULE_CLASSES = {
28305
+ "EX-001": ["zero-width", "bidi-override", "tag-block"],
28306
+ "EX-021": ["variation-selector"]
28307
+ };
28308
+ var ALL_CLASSES = /* @__PURE__ */ new Set([...RULE_CLASSES["EX-001"], ...RULE_CLASSES["EX-021"]]);
28309
+
28310
+ // ../core/src/redact-patch.ts
28311
+ var PEM2 = ["PRIVATE", "KEY"].join(" ");
28312
+ var MARKER_LINE = new RegExp(`^-----(?:BEGIN|END) [A-Z ]*${PEM2}(?: BLOCK)?-----\\s*$`);
28313
+
28074
28314
  // ../core/src/index.ts
28075
28315
  init_secrets_check();
28076
28316
  init_canary();
@@ -28171,7 +28411,7 @@ var DEFAULT_ZIP_LIMITS = {
28171
28411
  };
28172
28412
 
28173
28413
  // ../core/src/definitions/version.ts
28174
- var BUNDLED_DEFINITIONS_VERSION = "20261123.0";
28414
+ var BUNDLED_DEFINITIONS_VERSION = "20261124.0";
28175
28415
 
28176
28416
  // ../core/src/liveupdate.ts
28177
28417
  init_zod();
@@ -28315,14 +28555,6 @@ function findActiveInstalledSet(o = {}) {
28315
28555
  return null;
28316
28556
  }
28317
28557
 
28318
- // ../core/src/exorcise.ts
28319
- init_walker();
28320
- var RULE_CLASSES = {
28321
- "EX-001": ["zero-width", "bidi-override", "tag-block"],
28322
- "EX-021": ["variation-selector"]
28323
- };
28324
- var ALL_CLASSES = /* @__PURE__ */ new Set([...RULE_CLASSES["EX-001"], ...RULE_CLASSES["EX-021"]]);
28325
-
28326
28558
  // ../core/src/exorcise-registry.ts
28327
28559
  init_zod();
28328
28560
  var NpmLatest = external_exports.object({ version: external_exports.string().max(100) });
@@ -28516,6 +28748,40 @@ var SessionRecordSchema = external_exports.object({
28516
28748
  grants: external_exports.array(GrantSchema).max(MAX_GRANTS)
28517
28749
  }).strict();
28518
28750
 
28751
+ // ../shield/src/os-auth.ts
28752
+ var AVAILABLE_SCRIPT = [
28753
+ "ObjC.import('LocalAuthentication');",
28754
+ "ObjC.import('Foundation');",
28755
+ "function out(s) { $.NSFileHandle.fileHandleWithStandardOutput.writeData($(s + '\\n').dataUsingEncoding($.NSUTF8StringEncoding)); }",
28756
+ "const ctx = $.LAContext.alloc.init;",
28757
+ "const err = Ref();",
28758
+ "out(ctx.canEvaluatePolicyError(2, err) ? 'yes' : 'no');"
28759
+ ].join("\n");
28760
+ var VERIFY_SCRIPT = [
28761
+ "ObjC.import('LocalAuthentication');",
28762
+ "ObjC.import('Foundation');",
28763
+ "function out(s) { $.NSFileHandle.fileHandleWithStandardOutput.writeData($(s + '\\n').dataUsingEncoding($.NSUTF8StringEncoding)); }",
28764
+ "const raw = $.NSProcessInfo.processInfo.environment.objectForKey('EXORCIST_REASON');",
28765
+ "const reason = ObjC.unwrap(raw) || 'Release one held call';",
28766
+ "let result = null;",
28767
+ "const ctx = $.LAContext.alloc.init;",
28768
+ "const err = Ref();",
28769
+ "if (!ctx.canEvaluatePolicyError(2, err)) {",
28770
+ " out('error');",
28771
+ "} else {",
28772
+ " ctx.evaluatePolicyLocalizedReasonReply(2, $(reason), function (success, error) {",
28773
+ " if (success) { result = 'ok'; return; }",
28774
+ " let code = 0;",
28775
+ " try { code = error.code; } catch (e) { code = 0; }",
28776
+ " result = [-1, -2, -4, -9].indexOf(code) >= 0 ? 'denied' : 'error';",
28777
+ " });",
28778
+ " while (result === null) {",
28779
+ " $.NSRunLoop.currentRunLoop.runUntilDate($.NSDate.dateWithTimeIntervalSinceNow(0.1));",
28780
+ " }",
28781
+ " out(result);",
28782
+ "}"
28783
+ ].join("\n");
28784
+
28519
28785
  // ../shield/src/lockfile.ts
28520
28786
  init_zod();
28521
28787
  var Sha2562 = external_exports.string().regex(/^[0-9a-f]{64}$/);
@@ -28648,11 +28914,71 @@ function quarantineServer(o) {
28648
28914
  return { ok: true, value: e };
28649
28915
  }
28650
28916
 
28917
+ // ../shield/src/events.ts
28918
+ init_zod();
28919
+ var MAX_EVENT_BYTES = 1024 * 1024;
28920
+ var MAX_LINE_BYTES = 8 * 1024;
28921
+ var MAX_READ_BYTES = 8 * 1024 * 1024;
28922
+ var NAME_CHARS2 = 80;
28923
+ var WHY_CHARS = 400;
28924
+ var MESSAGE_CHARS = 600;
28925
+ var RULE_RE2 = /^[A-Z][A-Z0-9-]{1,15}$/;
28926
+ var KEY_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
28927
+ var Time2 = external_exports.string().max(40).refine((t) => !Number.isNaN(Date.parse(t)), "not a time");
28928
+ var Name2 = external_exports.string().max(NAME_CHARS2);
28929
+ var Rule = external_exports.string().regex(RULE_RE2);
28930
+ var Base = {
28931
+ v: external_exports.literal(1),
28932
+ time: Time2,
28933
+ pid: external_exports.number().int().positive(),
28934
+ server: Name2,
28935
+ session: external_exports.string().regex(KEY_RE).optional()
28936
+ };
28937
+ var StartEvent = external_exports.object({
28938
+ ...Base,
28939
+ kind: external_exports.literal("start"),
28940
+ mode: external_exports.enum(["enforce", "monitor"]),
28941
+ guard: external_exports.enum(["hold", "block", "monitor", "off"]),
28942
+ remote: external_exports.boolean(),
28943
+ /** How a held Session Guard call is released: in the system prompt (`os`) or with `exorcist approve session` (`terminal`). Absent in older logs. */
28944
+ release: external_exports.enum(["os", "terminal"]).optional()
28945
+ }).strict();
28946
+ var CallEvent = external_exports.object({
28947
+ ...Base,
28948
+ kind: external_exports.literal("call"),
28949
+ tool: Name2,
28950
+ decision: external_exports.enum(["allowed", "held", "blocked"]),
28951
+ ruleId: Rule.optional(),
28952
+ why: external_exports.string().max(WHY_CHARS).optional(),
28953
+ monitor: external_exports.literal(true).optional(),
28954
+ prompt: external_exports.number().int().positive().optional(),
28955
+ by: external_exports.literal("user").optional(),
28956
+ /** The hold is answered in the system prompt (Touch ID or login password), not in the agent's approval prompt. `prompt` then numbers the system prompt. */
28957
+ via: external_exports.literal("os").optional()
28958
+ }).strict();
28959
+ var ResultEvent = external_exports.object({
28960
+ ...Base,
28961
+ kind: external_exports.literal("result"),
28962
+ tool: Name2,
28963
+ decision: external_exports.enum(["withheld", "flagged"]),
28964
+ ruleId: Rule,
28965
+ why: external_exports.string().max(WHY_CHARS).optional()
28966
+ }).strict();
28967
+ var AlertEvent = external_exports.object({
28968
+ ...Base,
28969
+ kind: external_exports.literal("alert"),
28970
+ severity: external_exports.enum(["critical", "high", "medium"]),
28971
+ ruleId: Rule,
28972
+ tool: Name2.optional(),
28973
+ message: external_exports.string().max(MESSAGE_CHARS)
28974
+ }).strict();
28975
+ var ShieldEventSchema = external_exports.discriminatedUnion("kind", [StartEvent, CallEvent, ResultEvent, AlertEvent]);
28976
+
28651
28977
  // ../shield/src/launch.ts
28652
28978
  var MAX_HASHED_BYTES = 64 * 1024 * 1024;
28653
28979
 
28654
28980
  // ../shield/src/remote.ts
28655
- var MAX_EVENT_BYTES = 16 * 1024 * 1024;
28981
+ var MAX_EVENT_BYTES2 = 16 * 1024 * 1024;
28656
28982
 
28657
28983
  // ../shield/src/locate.ts
28658
28984
  import { existsSync as existsSync2, readdirSync as readdirSync3, statSync as statSync3 } from "node:fs";
@@ -28778,7 +29104,7 @@ function describe(findings, limit, quotes) {
28778
29104
  sorted.slice(0, limit).forEach((f, i) => {
28779
29105
  lines.push(`${i + 1}. [${f.severity.toUpperCase()}] ${plainFor(f.ruleId, f.title).headline}`);
28780
29106
  lines.push(` where: ${f.file}:${f.line}:${f.col} rule: ${f.ruleId}`);
28781
- if (quotes) lines.push(` quoted: ${JSON.stringify(reveal(f.span).slice(0, 80))}`);
29107
+ if (quotes) lines.push(` quoted: ${JSON.stringify(reveal(redactFinding(f).span).slice(0, 80))}`);
28782
29108
  lines.push(` fix: ${f.fix.replace(/\s+/g, " ").trim()}`);
28783
29109
  });
28784
29110
  if (sorted.length > limit) lines.push(`...and ${sorted.length - limit} more. Use a smaller folder or raise maxFindings.`);
@@ -28867,7 +29193,7 @@ Tell the user. They can undo this with: exorcist vault restore ${r.value.id}`
28867
29193
  }
28868
29194
 
28869
29195
  // src/index.ts
28870
- var VERSION = "0.1.1";
29196
+ var VERSION = "0.1.2";
28871
29197
  var ctx = {
28872
29198
  cwd: process.cwd(),
28873
29199
  definitionsDir: findDefinitionsDir2(process.cwd()) ?? "",
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@exorcist-98/mcp-server",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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.",
7
+ "mcpName": "io.github.pranavsaji/exorcist-98",
7
8
  "license": "Apache-2.0",
8
9
  "bin": {
9
10
  "exorcist-mcp": "./dist/index.mjs"