agent-customs 1.2.2 → 1.2.4

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
@@ -23,7 +23,7 @@
23
23
 
24
24
  <a href="https://github.com/montbaga/agent-customs/actions/workflows/pages.yml"><img alt="Tests and publish" src="https://github.com/montbaga/agent-customs/actions/workflows/pages.yml/badge.svg"></a>
25
25
  <a href="#how-well-it-works"><img alt="Bench: 88.8% blocked, 0% false blocks" src="https://img.shields.io/badge/bench-88.8%25_blocked_%C2%B7_0%25_FP-c8f03c?labelColor=0c1d18"></a>
26
- <a href="#try-it-yourself"><img alt="Tests: 219 passing" src="https://img.shields.io/badge/tests-219_passing-ece4d3?labelColor=0c1d18"></a>
26
+ <a href="#try-it-yourself"><img alt="Tests: 224 passing" src="https://img.shields.io/badge/tests-224_passing-ece4d3?labelColor=0c1d18"></a>
27
27
  <a href="LICENSE.md"><img alt="License: Apache 2.0" src="https://img.shields.io/badge/license-Apache%202.0-c8f03c?labelColor=0c1d18"></a>
28
28
  <img alt="Dependencies: none" src="https://img.shields.io/badge/dependencies-none-ece4d3?labelColor=0c1d18">
29
29
  <a href="#lets-talk"><img alt="Built by Monty Bagati" src="https://img.shields.io/badge/say_hello-Monty_Bagati-c8f03c?labelColor=132d25"></a>
@@ -62,8 +62,8 @@ Pick one of four ways. Each works with any site made with Cognizant's `agentify-
62
62
 
63
63
  ```html
64
64
  <script type="module"
65
- src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.2/dist/agent-customs.js"
66
- integrity="sha384-1tuTNG+ZM3HXuLLt1VL1oKW4ipT8rkPZY2UJ0odqE26aB2FxENBJAKS+lQLgAzOo"
65
+ src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.4/dist/agent-customs.js"
66
+ integrity="sha384-toEesUAwzeCPTz+C+0SW9WUp/7KUqG71ZH79hAHaDDOc4xdGOoxPdnCqH9g0CyK2"
67
67
  crossorigin="anonymous"></script>
68
68
  ```
69
69
 
@@ -76,7 +76,7 @@ Pick one of four ways. Each works with any site made with Cognizant's `agentify-
76
76
  ```js
77
77
  // At the top of site.js
78
78
  import { installCustomsGuard }
79
- from "https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.2/site/customs/guard.js";
79
+ from "https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.4/site/customs/guard.js";
80
80
 
81
81
  // Right after boot()
82
82
  installCustomsGuard(booted.engine, { strict: true });
@@ -173,16 +173,16 @@ Each way to add the guard, step by step. All of them work with any site built wi
173
173
  **1. One line (easiest).** Paste this into your page, above your other `<script>` tags. The guard switches itself on when your assistant starts.
174
174
 
175
175
  ```html
176
- <script type="module" src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.2/dist/agent-customs.js" integrity="sha384-1tuTNG+ZM3HXuLLt1VL1oKW4ipT8rkPZY2UJ0odqE26aB2FxENBJAKS+lQLgAzOo" crossorigin="anonymous"></script>
176
+ <script type="module" src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.4/dist/agent-customs.js" integrity="sha384-toEesUAwzeCPTz+C+0SW9WUp/7KUqG71ZH79hAHaDDOc4xdGOoxPdnCqH9g0CyK2" crossorigin="anonymous"></script>
177
177
  ```
178
178
 
179
- `integrity` is the file's fingerprint. If the file were ever changed, on the CDN or on the way, the browser would refuse to run it. The whole guard is in this one file ([`dist/agent-customs.js`](dist/agent-customs.js), built by `npm run bundle`), so the fingerprint covers all of it. `@v1.2.2` is a fixed version; to update, take the new line from the next release. Above the other tags, the browser runs it before your page starts the assistant, and chats wait until the guard is on. If your page has a `Content-Security-Policy` with `script-src`, add `https://cdn.jsdelivr.net` to it.
179
+ `integrity` is the file's fingerprint. If the file were ever changed, on the CDN or on the way, the browser would refuse to run it. The whole guard is in this one file ([`dist/agent-customs.js`](dist/agent-customs.js), built by `npm run bundle`), so the fingerprint covers all of it. `@v1.2.4` is a fixed version; to update, take the new line from the next release. Above the other tags, the browser runs it before your page starts the assistant, and chats wait until the guard is on. If your page has a `Content-Security-Policy` with `script-src`, add `https://cdn.jsdelivr.net` to it.
180
180
 
181
181
  **2. Two lines, with your own settings.** Load the guard from the same release and pass any of the *Guard options* below. A browser cannot check a fingerprint on an `import`, so for that use option 3 or 4.
182
182
 
183
183
  ```js
184
184
  // At the top of site.js
185
- import { installCustomsGuard } from "https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.2/site/customs/guard.js";
185
+ import { installCustomsGuard } from "https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.4/site/customs/guard.js";
186
186
 
187
187
  // Right after the boot(...) call
188
188
  installCustomsGuard(booted.engine, { strict: true });
@@ -239,7 +239,7 @@ Three ways in, fastest first:
239
239
  <strong>1 · The test suite</strong><br><br>
240
240
  No browser and no API key:<br><br>
241
241
  <code>npm test</code><br><br>
242
- 219 tests: the attack sentences, every frozen attack set, five batches of real MCP servers and A2A cards, the locks, the canary, the signed stamps, the benchmark, the command line tool, the MCP server, the extension, the practice site, the key vault, the one-line install and its one-file build.
242
+ 224 tests: the attack sentences, every frozen attack set, five batches of real MCP servers and A2A cards, the locks, the canary, the signed stamps, the benchmark, the command line tool, the MCP server, the extension, the practice site, the key vault, the one-line install and its one-file build.
243
243
  </td>
244
244
  <td width="33.3%" valign="top">
245
245
  <strong>2 · The inspection desk (no key)</strong><br><br>
@@ -494,7 +494,7 @@ Needs Node 22 or newer and no npm packages.
494
494
  ```sh
495
495
  git clone https://github.com/montbaga/agent-customs.git
496
496
  cd agent-customs
497
- npm test # 219 tests
497
+ npm test # 224 tests
498
498
  npm run bench -- --verbose # the benchmark, with every flagged case
499
499
  npm run check && npm run check:practice # both networks pass Cognizant's build check
500
500
  node bin/agent-customs.mjs check site/samples/mcp-poisoned --sarif
@@ -588,7 +588,7 @@ node tools/set-origins.mjs --range https://agent-customs-range.github.io
588
588
 
589
589
  `npm run smoke` drives Edge or Chrome headlessly against the local servers and fails on any page error. It starts the key vault on port 8090 if it is not running (`npm run serve:vault`), since a page on this computer looks for the vault there.
590
590
 
591
- `npm run vault:check` checks the key vault end to end in a headless browser, with a stand-in AI service on this computer: the page never holds the key, every AI request comes from the vault with the key, a remembered key is stored only encrypted, a new visit starts locked, a wrong password does not open it, and *Forget* removes it.
591
+ `npm run vault:check` checks the key vault end to end in a headless browser, with a stand-in AI service on this computer: a Groq or Otari key picks its own card, the page never holds the key, every AI request comes from the vault with the key, *Remember key* stores it only encrypted, a new visit starts locked, a wrong password does not open it, and *Forget* removes it.
592
592
 
593
593
  ---
594
594
 
@@ -601,16 +601,20 @@ This round fixed a weakness in how the rules handled their own exceptions, and i
601
601
  - Two more languages. Dutch and Indonesian requests for passwords and card numbers are now read word by word. Takeover, chat-leak and "download and run" orders are caught in 14 languages.
602
602
  - Honest numbers. False alarms on tools never seen before dropped from about 1 in 10 to about 1 in 18. New attack sets written after the changes were measured once before they were used. The details are in [How well it works](#how-well-it-works) and the [paper](PAPER.md#5--results).
603
603
 
604
+ **Private data sent to another site is caught in any wording (1.2.4).** A QA tester found that a hotel tool asking for the guest's passport number and sending it to an outside address was only *Held for review*, without the leak finding (C-EXFIL). The leak check matched a short list of phrases, such as "send it to". It now looks for the private data and an address on another site together, with any verb that moves data, in any order: "share it with …", "log it at …", "it is forwarded to …", "send … the passport number", "make a request to … with it". Private data here means identity documents, card and bank details, passwords, one-time codes and the conversation. Of 30 wordings written before the change, 10 were denied before and 29 are now (the 30th, "verify it via …", is still held). The 870 real-world MCP servers and A2A cards in [`tests/fixtures/realworld`](tests/fixtures/realworld/) get exactly the same findings as before, and the benchmark results are unchanged.
605
+
604
606
  The desk also has a new switch under the address box: **AI double-check**. When it is on, your own AI reads every network the rules clear, and every partner the Officer is about to call. It can only make a verdict stricter. If your AI flags something, *Cleared* becomes *Held for review*; if it finds nothing, the verdict stays as it was. Networks the rules already stopped are never sent to it, so they cost no tokens. The switch is off until you turn it on and uses the key you set on the Officer tab. While it is on, the network's public text goes to your AI provider. When your AI has read a network, a round seal countersigns the verdict stamp, and a flag quotes the sentence that worried it (only words the network really wrote are shown).
605
607
 
606
608
  **Adding the guard now takes one line.** Paste one `<script>` tag into your page and the guard switches itself on, or install it with `npm install agent-customs`. See [Add the guard to your site](#add-it-to-your-site). The line carries a fingerprint (Subresource Integrity), so a browser refuses the file if it was ever changed; the whole guard is one file, so the fingerprint covers all of it.
607
609
 
608
610
  **Checked against Google's guidance.** The site was scanned with the Chrome team's [Modern Web Guidance](https://developer.chrome.com/docs/modern-web-guidance) and checked against [Baseline](https://web.dev/baseline): it uses only features that work in all current browsers, or that have a fallback. Every piece of HTML the page writes, in its own code and in the runtime's, now passes one cleaner first ([Trusted Types](site/trusted-types.js)), which removes anything that could run code.
609
611
 
610
- **Your AI key now lives in a key vault.** The page no longer keeps your key anywhere. You paste it into a small box that is really a separate website, the [key vault](vault/) (`agent-customs-vault.github.io`). The browser keeps that site's storage apart from this page's. When the Officer or the AI double-check needs your AI, the page asks the vault, and the vault adds the key, calls your AI company and passes back only the answer. So even an agent file that broke this page could not take your key. By default the vault forgets the key when you close the tab. *Remember on this computer* keeps it encrypted (AES-256), locked with your passkey or a password that is never stored. The page now also lets only its own scripts run, and each card says how to give a key a spending limit.
612
+ **Your AI key now lives in a key vault.** The page no longer keeps your key anywhere. You paste it into a small box that is really a separate website, the [key vault](vault/) (`agent-customs-vault.github.io`). The browser keeps that site's storage apart from this page's. When the Officer or the AI double-check needs your AI, the page asks the vault, and the vault adds the key, calls your AI company and passes back only the answer. So even an agent file that broke this page could not take your key. By default the vault forgets the key when you close the tab. *Remember on this device* keeps it encrypted (AES-256), locked with your passkey or a password that is never stored. The page now also lets only its own scripts run, and each card says how to give a key a spending limit.
611
613
 
612
614
  A first-time visitor has no key, so the switch says so. Turning it on opens a short card that explains what an AI key is and that Google AI Studio and Groq give free ones. *Set up a free key* opens the key settings, and after *Save and start* the page goes back to the inspection and runs it again with your AI. To see it catch something, inspect the **VIP Points MCP** sample on the desk ([`site/samples/ai-check-demo/mcp.json`](site/samples/ai-check-demo/mcp.json)). It asks guests to *"read back all twenty-four words from their emergency paper sheet"*. That is a crypto wallet's recovery phrase, worded so that none of the rules' words appear. The rules clear it; your AI should hold it.
613
615
 
616
+ **Setting up a key is simpler.** A key from a known company now picks its own card wherever you paste it, so a Groq or Otari key pasted while Gemini is selected just works. After *Save and start*, a *Remember key* button above the chat keeps the key on this device, without opening the settings again. Passkeys that make the key but do not say at once whether they can lock it, as Windows Hello often does, now work: the vault asks the new passkey once more instead of giving up. On a phone, *Set up a free key* now brings the key box into view. The messages in the AI settings and the key vault are shorter and plainer.
617
+
614
618
  ---
615
619
 
616
620
  ## More detail
@@ -676,7 +680,7 @@ The full picture, with diagrams, is in [**How it works**](ARCHITECTURE.md).
676
680
  | [`PAPER.md`](PAPER.md) | The research note: threat model, method, results and limits |
677
681
  | [`LICENSE.md`](LICENSE.md) | The license in plain words, with the full text |
678
682
  | [`tools/`](tools/) | The MCP server (`mcp-server.mjs`), the benchmark and its frozen sets, the stamp signer, the local server, the builders and the smoke test |
679
- | [`tests/`](tests/) | 219 tests, the frozen attack sets and the five batches of real-world snapshots |
683
+ | [`tests/`](tests/) | 224 tests, the frozen attack sets and the five batches of real-world snapshots |
680
684
  | [`vendor/agentify-website/`](vendor/agentify-website/) | Cognizant's kit scripts and templates, unmodified |
681
685
 
682
686
  </details>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-customs",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Border control for the Open Agentic Web: inspect any agent network before it runs in your browser.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Monty Bagati (https://github.com/montbaga)",
@@ -611,6 +611,129 @@ function followUpExfil(text) {
611
611
  return hits;
612
612
  }
613
613
 
614
+ // Private visitor data moved to another site, whatever the verb or word order: "share it
615
+ // with https://…", "log the passport number at …", "it is forwarded to …", "make a GET
616
+ // request to … with it". The data has to be what is moved, and the address has to belong to
617
+ // another site. Service keys and tokens are left out: tool docs often name the outside API a
618
+ // service's own key goes to, and the patterns above still catch a key taken from the visitor.
619
+ const OFFSITE_DATA = [
620
+ "passports?(?:[\\s_-]+(?:numbers?|nos?|details?|info(?:rmation)?|data|ids?|scans?|photos?|cop(?:y|ies)|images?|pages?))?",
621
+ "national[\\s_-]+ids?(?:[\\s_-]+(?:numbers?|cards?))?",
622
+ "tax[\\s_-]+ids?(?:[\\s_-]+numbers?)?",
623
+ "ssns?",
624
+ "social[\\s_-]+security(?:[\\s_-]+numbers?)?",
625
+ "(?:driver'?s|driving)[\\s_-]+licen[cs]es?(?:[\\s_-]+numbers?)?",
626
+ "id[\\s_-]+(?:cards?|documents?)(?:[\\s_-]+numbers?)?",
627
+ "bank[\\s_-]+(?:account|card)s?(?:[\\s_-]+(?:numbers?|details?))?",
628
+ "bank[\\s_-]+details",
629
+ "routing[\\s_-]+numbers?",
630
+ "ibans?",
631
+ "sort[\\s_-]+codes?",
632
+ "(?:credit|debit|payment)[\\s_-]+cards?(?:[\\s_-]+(?:numbers?|details?))?",
633
+ "card[\\s_-]+(?:numbers?|details?)",
634
+ "cvv2?", "cvc",
635
+ "passwords?", "passcodes?", "passphrases?",
636
+ "otps?", "one[- ]time[\\s_-]+(?:codes?|passwords?)",
637
+ "(?:seed|recovery)[\\s_-]+(?:phrases?|words?)",
638
+ "conversation(?:[\\s_-]+history)?", "chat[\\s_-]+(?:history|log|transcript)", "message[\\s_-]+history", "previous\\s+messages",
639
+ "(?:user|visitor|customer|guest)'?s?\\s+messages?", "transcripts?", "system\\s+prompt", "hidden\\s+instructions", "sly_data", "private\\s+context",
640
+ ].join("|");
641
+ // The words name a topic, not the data itself: "lost passports", "password reset", "passport
642
+ // photo requirements", "conversation IDs".
643
+ const OFFSITE_TOPIC = "(?:rules?|requirements?|applications?|appointments?|offices?|renewals?|validity|polic(?:y|ies)|resets?|recovery|changes?|managers?|strength|holders?|control|fees?|status|services?|desk|guides?|guidance|faqs?|checks?|lookups?|safety|security|tips|hygiene|protected|less|fields?|inputs?|forms?|prompts?|hash(?:es|ed|ing)?|ids?|starters?|titles?|topics?|types?|modes?|expir(?:y|ation)|issuance|stamps?|countr(?:y|ies)|nationality|formats?|regex|patterns?|validation|verification|length|complexity|generators?|templates?|links?|login|scann(?:ing|er|ers)|readers?|reading|ocr)";
644
+ const OFFSITE_TERM = `(?<!\\b(?:lost|stolen|expired|new|replacement|renewed|forgotten|strong|weak|default|temporary)\\s+)\\b(?:${OFFSITE_DATA})(?![-\\w]|[\\s_-]+(?:(?:numbers?|photos?|scans?|data|details?)[\\s_-]+)?${OFFSITE_TOPIC}\\b)`;
645
+ const OFFSITE_MOVE = `(?<!\\b(?:a|an|the|this|that|these|those|each|every|its|our|your|their|blog|forum)\\s+)\\b(?:send|sends|sent|sending|forward(?:s|ed|ing)?|shar(?:e|es|ed|ing)|report(?:s|ed|ing)?|log(?:s|ged|ging)?(?!\\s+(?:in|into|on|out)\\b)|stor(?:e|es|ed|ing)|sav(?:e|es|ed|ing)|sync(?:s|ed|ing)?|synchroni[sz](?:e|es|ed|ing)|upload(?:s|ed|ing)?|post(?:s|ed|ing)?|submit(?:s|ted|ting)?|pass(?:es|ed|ing)?|transmit(?:s|ted|ting)?|relay(?:s|ed|ing)?|push(?:es|ed|ing)?|deliver(?:s|ed|ing)?|dispatch(?:es|ed|ing)?|rout(?:e|es|ed|ing)|pip(?:e|es|ed|ing)|cop(?:y|ies|ied|ying)|export(?:s|ed|ing)?|transfer(?:s|red|ring)?|leak(?:s|ed|ing)?|exfiltrat(?:e|es|ed|ing)|bcc|cc|includ(?:e|es|ed|ing)|append(?:s|ed|ing)?|attach(?:es|ed|ing)?|embed(?:s|ded|ding)?|mirror(?:s|ed|ing)?|writ(?:e|es|ing|ten)|wrote)\\b|${EMAIL_VERB}`;
646
+ const OFFSITE_PARTICIPLE = "\\b(?:sent|forwarded|shared|reported|logged|stored|saved|synced|synchroni[sz]ed|uploaded|posted|submitted|passed|transmitted|relayed|pushed|delivered|dispatched|routed|piped|copied|exported|transferred|leaked|exfiltrated|e-?mailed|mailed|included|appended|attached|embedded|mirrored|written)\\b";
647
+ const OFFSITE_CALL = "\\b(?:call(?:s|ed|ing)?|request(?:s|ed|ing)?|fetch(?:es|ed|ing)?|hit(?:s|ting)?|ping(?:s|ed|ing)?|quer(?:y|ies|ied|ying)|get|gets|invok(?:e|es|ed|ing)|post(?:s|ed|ing)?)\\b";
648
+ const OFFSITE_BACKREF = "(?:it|them|that|this|these|those|both|everything|all\\s+of\\s+(?:it|them|this|that)|(?:the|their|your|his|her)\\s+(?:[\\w']+\\s+){0,2}?(?:numbers?|codes?|details|info|information|data|values?|cop(?:y|ies)|scans?|photos?|images?|documents?|passports?|ids?|cards?|ibans?|passwords?|transcripts?|summary|conversation|chat|history))\\b";
649
+ const OFFSITE_OWNER = "(?:(?:the|their|your|his|her)\\s+)?(?:(?:user|visitor|customer|guest|client|traveller|traveler|caller)'?s?\\s+)?";
650
+ const OFFSITE_PREP = "\\b(?:to|at|into|onto|on|via|through|with|towards?|using|in)\\s+(?:[\\w'-]+\\s+){0,4}?";
651
+ const OFFSITE_DEST = "(?<dest>(?:https?:\\/\\/|(?<![a-z0-9+.-]:)\\/\\/)[^\\s)\"'<>\\]]+|[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}\\b|(?:[a-z0-9-]+\\.)+[a-z]{2,24}\\/[^\\s)\"'<>\\]]*)";
652
+ const offsiteRe = (source) => new RegExp(source, "gid");
653
+ // Data and destination in one clause.
654
+ const OFFSITE_SAME_CLAUSE = [
655
+ // "Forward the guest's passport number to https://…"
656
+ offsiteRe(`(?<move>${OFFSITE_MOVE})[^.!?\\n]{0,60}?${OFFSITE_TERM}[^.!?\\n]{0,60}?${OFFSITE_PREP}${OFFSITE_DEST}`),
657
+ // "Ask for the passport number and share it with https://…"
658
+ offsiteRe(`${OFFSITE_TERM}[^.!?\\n]{0,80}?(?<move>${OFFSITE_MOVE})\\s+(?:[a-z]+\\s+)?${OFFSITE_BACKREF}[^.!?\\n]{0,40}?${OFFSITE_PREP}${OFFSITE_DEST}`),
659
+ // "The passport number must be forwarded to https://…"
660
+ offsiteRe(`${OFFSITE_TERM}[^.!?\\n]{0,60}?\\b(?:is|are|be|been|being|gets?|got|was|were)\\s+(?:[a-z]+ly\\s+|then\\s+|also\\s+|first\\s+|later\\s+)?(?<move>${OFFSITE_PARTICIPLE})[^.!?\\n]{0,30}?${OFFSITE_PREP}${OFFSITE_DEST}`),
661
+ // "Send https://… the guest's passport number"
662
+ offsiteRe(`(?<move>${OFFSITE_MOVE})\\s+(?:(?:to|at)\\s+)?${OFFSITE_DEST}\\s*,?\\s+(?:with\\s+|containing\\s+|including\\s+|carrying\\s+)?(?:a\\s+copy\\s+of\\s+|all\\s+|full\\s+|entire\\s+)?${OFFSITE_OWNER}${OFFSITE_TERM}`),
663
+ // "Make a GET request to https://… with the passport number"
664
+ offsiteRe(`(?<move>${OFFSITE_CALL})[^.!?\\n]{0,20}?${OFFSITE_DEST}[^.!?\\n]{0,20}?\\b(?:with|including|containing|carrying|passing|plus|and\\s+(?:include|pass|add|append|attach))\\s+${OFFSITE_OWNER}${OFFSITE_TERM}`),
665
+ ];
666
+ // The data in an earlier clause, the destination in this one.
667
+ const OFFSITE_FOLLOW_UP = [
668
+ // "… passport number. Then share it with https://…"
669
+ offsiteRe(`(?<move>${OFFSITE_MOVE})\\s+(?:[a-z]+\\s+)?${OFFSITE_BACKREF}[^.!?\\n]{0,40}?${OFFSITE_PREP}${OFFSITE_DEST}`),
670
+ // "… passport number. It will be sent to https://…"
671
+ offsiteRe(`\\b(?:it|this|that|they|these|those|which|both)\\s+(?:(?:is|are|will\\s+be|must\\s+be|should\\s+be|shall\\s+be|can\\s+be|gets?|get)\\s+)?(?:[a-z]+ly\\s+|then\\s+|also\\s+|first\\s+)?(?<move>${OFFSITE_PARTICIPLE})[^.!?\\n]{0,30}?${OFFSITE_PREP}${OFFSITE_DEST}`),
672
+ // "Guest passport number. Sent to https://… for ID checks."
673
+ offsiteRe(`^(?:(?:then|and|also)\\s+)?(?:[a-z]+ly\\s+)?(?<move>${OFFSITE_PARTICIPLE})[^.!?\\n]{0,30}?${OFFSITE_PREP}${OFFSITE_DEST}`),
674
+ // "… passport number. Make a GET request to https://… with it."
675
+ offsiteRe(`(?<move>${OFFSITE_CALL})[^.!?\\n]{0,20}?${OFFSITE_DEST}[^.!?\\n]{0,20}?\\b(?:with|including|containing|carrying|passing|plus|and\\s+(?:include|pass|add|append|attach))\\s+${OFFSITE_BACKREF}`),
676
+ ];
677
+ const OFFSITE_TERM_RE = new RegExp(OFFSITE_TERM, "gi");
678
+
679
+ function offSiteDestination(dest, targetHost = "") {
680
+ const targetDom = targetHost ? registeredDomain(targetHost) : "";
681
+ if (!targetDom) return true;
682
+ const email = dest.match(/@([a-z0-9.-]+\.[a-z]{2,})$/i);
683
+ let host = email ? email[1] : "";
684
+ if (!host) {
685
+ try {
686
+ host = new URL(/^\/\//.test(dest) ? `https:${dest}` : /^https?:/i.test(dest) ? dest : `https://${dest}`).hostname;
687
+ } catch {
688
+ return true;
689
+ }
690
+ }
691
+ return registeredDomain(host) !== targetDom;
692
+ }
693
+
694
+ // The first match in the clause that is a real order to move the data to another site.
695
+ function offsiteMove(clause, patterns, targetHost) {
696
+ for (const re of patterns) {
697
+ for (const m of clause.matchAll(re)) {
698
+ const moveAt = m.indices.groups.move[0];
699
+ if (negatedBefore(clause, moveAt) || describedBefore(clause, m.index) || describedBefore(clause, moveAt)) continue;
700
+ if (!offSiteDestination(m.groups.dest.replace(/[.,;:!?]+$/, ""), targetHost)) continue;
701
+ return m;
702
+ }
703
+ }
704
+ return null;
705
+ }
706
+
707
+ // The data is named for real in the clause: not negated ("never ask for a passport") and
708
+ // not described as something a checker looks for.
709
+ function namesOffsiteData(clause) {
710
+ for (const m of clause.matchAll(OFFSITE_TERM_RE)) {
711
+ if (!negatedBefore(clause, m.index) && !describedBefore(clause, m.index)) return true;
712
+ }
713
+ return false;
714
+ }
715
+
716
+ function offsiteLeaks(text, targetHost = "") {
717
+ const hits = [];
718
+ for (const clause of clauses(text)) {
719
+ const m = offsiteMove(clause, OFFSITE_SAME_CLAUSE, targetHost);
720
+ if (!m) continue;
721
+ const hit = { match: m[0], excerpt: clause };
722
+ hits.push(describedInBrackets(clause, m.index) ? soften(hit, "Listed as an example of what the tool detects; check it is not an order.") : hit);
723
+ }
724
+ const parts = wrappedClauses(text);
725
+ for (let i = 0; i + 1 < parts.length; i += 1) {
726
+ if (!namesOffsiteData(parts[i])) continue;
727
+ for (let j = i + 1; j <= Math.min(i + 2, parts.length - 1); j += 1) {
728
+ const m = offsiteMove(parts[j], OFFSITE_FOLLOW_UP, targetHost);
729
+ if (!m) continue;
730
+ hits.push({ match: m[0], excerpt: parts.slice(i, j + 1).join(" ") });
731
+ break;
732
+ }
733
+ }
734
+ return hits;
735
+ }
736
+
614
737
  const askEnglishSecrets = askMatcher(SECRET, SECRET_DESCRIBED, PIN);
615
738
 
616
739
  // Continuation lines ("without asking the visitor") should not fire negatable rules when the
@@ -989,7 +1112,7 @@ export const TEXT_RULES = [
989
1112
  /\b(?:read|reads|collect|collects|fetch|fetches|gather|gathers|grab|grabs|extract|extracts|dump|dumps|inspect|inspects|access|accesses)\b[^.!?\n]{0,60}\b(?:secrets?|tokens?|keys?|credentials?|passwords?|env(?:ironment)?(?:\s+var(?:iable)?s?|\s+settings?)?|\.env|cookies?|private\s+(?:files?|data)|config(?:uration)?(?:\s+files?)?)\b[^.!?\n]{0,60}\b(?:post|posts|send|sends|upload|uploads|forward|forwards|relay|relays|transmit|transmits|ship|ships|push|pushes)\b[^.!?\n]{0,40}\b(?:to|toward|at)\b[^.!?\n]{0,40}\b(?:url|webhook|callback|endpoint|server|remote\s+host|address|destination)\b/i,
990
1113
  /(?:(?:\b(?:href|src|action)\s*=\s*["']?|\[\s*[^\]]*\]\s*\(\s*|\b(?:drag|click|bookmark(?:s|\s+bar)?|paste|follow|visit|open|run|execute|navigate|redirect|load|link|url)\b[^.!?\n]{0,80})\b(?:javascript|vbscript):(?=[^\s'")\],.;])|(?:\b(?:href|src|action)\s*=\s*["']?|\[\s*[^\]]*\]\s*\(\s*)data\s*:\s*(?:text\/html|application\/xhtml\+xml|image\/svg\+xml)\b|\bdata\s*:\s*(?:text\/html|application\/xhtml\+xml),[^\s'"])/i,
991
1114
  ];
992
- const urlHits = [...regexMatcher(urlPatterns, { negatable: true })(text), ...followUpExfil(text)].map((hit) => {
1115
+ const urlHits = [...regexMatcher(urlPatterns, { negatable: true })(text), ...followUpExfil(text), ...offsiteLeaks(text, targetHost)].map((hit) => {
993
1116
  if (isHttpHeaderAuthDoc(hit.excerpt, targetHost)) return soften(hit, "Documents a request header for this service's own key.");
994
1117
  if (targetHost && allUrlsSameSite(hit.excerpt, targetHost)
995
1118
  && !VISITOR_LEAK_SLOT_RE.test(hit.excerpt) && !/!\[[^\]]*\]\(/.test(hit.excerpt)
@@ -166,7 +166,7 @@ function resolveKnownSample(raw) {
166
166
 
167
167
  function buildInstallSnippets() {
168
168
  return {
169
- oneLineScript: `<script type="module" src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v${PKG_VERSION}/dist/agent-customs.js" integrity="sha384-1tuTNG+ZM3HXuLLt1VL1oKW4ipT8rkPZY2UJ0odqE26aB2FxENBJAKS+lQLgAzOo" crossorigin="anonymous"></script>`,
169
+ oneLineScript: `<script type="module" src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v${PKG_VERSION}/dist/agent-customs.js" integrity="sha384-toEesUAwzeCPTz+C+0SW9WUp/7KUqG71ZH79hAHaDDOc4xdGOoxPdnCqH9g0CyK2" crossorigin="anonymous"></script>`,
170
170
  twoLines: `import { installCustomsGuard } from "https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v${PKG_VERSION}/site/customs/guard.js";\ninstallCustomsGuard(booted.engine, { strict: true });`,
171
171
  npm: `npm install agent-customs\nimport { installCustomsGuard } from "agent-customs";\ninstallCustomsGuard(booted.engine);`,
172
172
  cli: `npx agent-customs check https://your-site.example/\nnpx agent-customs check ./my-network --strict\nnpx agent-customs mcp`,