fairwire-email-gateway 0.0.0-stage → 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (unreleased)
4
+
5
+ - First version (Fairwire ver 1).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kurt Francisco
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,206 @@
1
- # Temporary Holding Version
1
+ # Fairwire Email Gateway
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Email gateway review from Proofpoint, Mimecast, Defender or similar exports: high-confidence phishing released from quarantine, allow-listed senders that sent malware, the people targeted most, mail pulled back late, outbound spam from an internal mailbox and data-loss rule hits. Names masked for the model. Drafts notes; never releases or deletes mail.
4
+
5
+ Part of **Fairwire**, the IT and network family of [Mythos Machines](https://fair-agents.com) agents. The software is free (MIT); you pay a fixed price for the setup on your files. It reads files your IT team exports, on your own computer, and drafts notes. Every change to a live device, firewall, DNS zone, directory or cloud account stays one named person's click.
6
+
7
+ ## What it checks
8
+
9
+ | Finding | What it means |
10
+ |---|---|
11
+ | `released_threat` | A message the gateway judged phishing or malware that someone released from quarantine. |
12
+ | `allowlist_sent_threat` | A sender on an allow list that sent phishing, malware or spam (allow lists skip checks). |
13
+ | `outbound_spam` | An internal mailbox sending many messages the gateway judged spam or phishing (a sign the account is compromised). |
14
+ | `late_clawback` | Phishing that reached inboxes and was pulled back later than your limit. |
15
+ | `most_targeted` | A person who received many phishing or malware messages (worth extra training or protection). |
16
+ | `dlp_hits` | An internal sender who triggered data-loss rules several times. |
17
+
18
+ Findings come back worst first (high, medium, low). A finding a named person has reviewed can be accepted as known, with a reason and a date to look again; it then moves to "Accepted as known" instead of counting as open.
19
+
20
+ ## Settings
21
+
22
+ Pass a settings file with `settings`. Every setting is optional; a misspelt setting is refused by name.
23
+
24
+ | Setting | What it does |
25
+ |---|---|
26
+ | `outbound_spam_min` | Outbound spam or phishing from one mailbox before it is flagged (default 20) |
27
+ | `clawback_minutes` | Minutes after delivery by which phishing should be pulled back (default 60) |
28
+ | `targeted_min` | Phishing or malware messages to one person before they count as most targeted (default 5) |
29
+ | `dlp_min` | Data-loss rule hits from one sender before they are flagged (default 3) |
30
+
31
+ ## What it never does
32
+
33
+ - `gateway_release_message` is refused: Fairwire Email Gateway never releases, deletes or pulls back a message.
34
+ - `gateway_change_allowlist` is refused: Fairwire Email Gateway never changes allow lists, block lists or policies.
35
+ - `email_gateway_request_send` waits for one named person's click, even in Auto (`binding_send`).
36
+ - `email_gateway_accept_learning` waits for one named person's click, even in Auto (`accept_learning`).
37
+ - `email_gateway_retire_memory` waits for one named person's click, even in Auto (`accept_learning`).
38
+ - `gateway_release_message` waits for one named person's click, even in Auto (`binding_send`).
39
+ - `gateway_change_allowlist` waits for one named person's click, even in Auto (`production_deploy`).
40
+
41
+ <!-- generated:start -->
42
+
43
+ ## A demo run
44
+
45
+ `npx -y fairwire-email-gateway demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
46
+
47
+ ```text
48
+ Fairwire Email Gateway demo (fictional data) in a temporary folder, Auto on for the draft only
49
+
50
+ ▶ Check the exported files
51
+ status: executed decision: allow
52
+ 60 message(s), 35 inbound (28.6% quarantined or blocked), 25 outbound, 11 threat(s): 6 open finding(s), 3 high.
53
+ high allowlist_sent_threat USR-a546b0bf
54
+ high outbound_spam USR-9da76359
55
+ high released_threat USR-3f16ee48
56
+ medium late_clawback USR-27a00472
57
+ low dlp_hits USR-e466f4ac
58
+ low most_targeted USR-de6606a5
59
+
60
+ ▶ Explain one finding
61
+ status: executed decision: allow
62
+ high released_threat: Message MSG-0027 to USR-3f16ee48 was judged Phish and released from quarantine. Fix: Pull the message back, check whether links were clicked or attachments opened, and review who may release threats.
63
+
64
+ ▶ Write the worklist
65
+ status: executed decision: allow
66
+ Email gateway review written: 60 message(s), 35 inbound (28.6% quarantined or blocked), 25 outbound, 11 threat(s): 6 open finding(s), 3 high.
67
+
68
+ ▶ Draft the note for a person
69
+ status: executed decision: allow (auto)
70
+ security note 2026-11-18 drafted with 1 open marker(s) ([TO CONFIRM security operations]). Nothing was sent.
71
+
72
+ ▶ Auto: approving it still waits for one named person
73
+ status: needs_approval decision: ask
74
+ reason: binding_send stays one-click, even in Auto
75
+
76
+ ▶ The agent tries to change the live system itself
77
+ status: blocked decision: block
78
+ reason: Fairwire Email Gateway never releases, deletes or pulls back a message.
79
+ ```
80
+
81
+ ## Tools
82
+
83
+ | Tool | What it does | Policy |
84
+ |---|---|---|
85
+ | `email_gateway_check` | Review the gateway log and list released threats, allow-list abuse, outbound spam, late pull-backs, targeted people and data-loss hits. | runs |
86
+ | `email_gateway_explain` | Every finding for one address or message. | runs |
87
+ | `email_gateway_write_report` | Write email-gateway.csv (one row per finding, with blank owner and decision columns) and email-gateway.html into out_dir (default fairwire-out/email_gateway). | runs |
88
+ | `email_gateway_draft_security_note` | Write drafts/security_note-<date>.md: the open findings at or above min_severity (default medium), each with what to do, addressed to security operations. | asks first (Auto can be opted in) |
89
+ | `email_gateway_request_send` | After one named human click (even in Auto), record that the reviewed security note draft is approved in security_note-requests.csv. | one named click, even in Auto (`binding_send`) |
90
+ | `email_gateway_recall` | Search this agent's own memory of the customer's setup: accepted facts (in use) and facts waiting for a person. | runs |
91
+ | `email_gateway_learn` | Propose one fact about the customer's setup for this agent to remember. | runs |
92
+ | `email_gateway_accept_learning` | A named person accepts or rejects a fact waiting in this agent's memory. | one named click, even in Auto (`accept_learning`) |
93
+ | `email_gateway_retire_memory` | A named person stops an accepted fact from applying. | one named click, even in Auto (`accept_learning`) |
94
+ | `gateway_release_message` | Fairwire Email Gateway never releases, deletes or pulls back a message. | refused |
95
+ | `gateway_change_allowlist` | Fairwire Email Gateway never changes allow lists, block lists or policies. | refused |
96
+
97
+ Any tool name not in this table is blocked, including names a model invents. `refused` tools are listed so a model can see they exist and are refused.
98
+
99
+ ## Columns it reads
100
+
101
+ Table inputs can be CSV, TSV, semicolon- or pipe-separated text, Excel `.xlsx`, JSON or JSONL. Columns are matched by the agent's own name, then by the English names below, then by their names in German, French, Spanish, Portuguese, Italian, Japanese, Chinese and Korean. Dates become `YYYY-MM-DD`; amounts and counts are read with either decimal mark. Every result lists under `sources` how each file was read.
102
+
103
+ ### Gateway messages (`messages`)
104
+
105
+ | Column | Type | Also read as | For example, in other languages |
106
+ |---|---|---|---|
107
+ | `message_id` (required) | text | Message ID, Message-ID, ID, Network Message ID | - |
108
+ | `received_at` | date and time | Received, Date, Timestamp, Received Time, Delivery Time | - |
109
+ | `direction` | text | Direction, Mail Direction, Flow | Richtung, Sens, 入出庫区分, 方向 |
110
+ | `sender` | text | Sender, From, Sender Address, P1 Sender | Absender, Expéditeur, 送信者, 发件人 |
111
+ | `recipient` | text | Recipient, To, Recipients, Recipient Address | Empfänger, Destinataire, 受信者, 收件人 |
112
+ | `verdict` | text | Verdict, Threat, Classification, Detection, Threat Type | Bewertung, Verdict, 判定, 判定结果 |
113
+ | `action` | text | Action, Delivery Action, Disposition, Status | Aktion, Action, アクション, 动作 |
114
+ | `allowlisted` | text | Allowlisted, Allow Listed, Safe Sender, Bypass, Override | - |
115
+ | `clawed_back_at` | date and time | Clawed Back, Removed At, ZAP Time, Remediated At, Pulled Back | - |
116
+ | `dlp_rule` | text | DLP Rule, Policy Match, DLP Policy, Content Rule | - |
117
+
118
+ ### Files from other countries
119
+
120
+ A German export in Windows-1252 with semicolons, `1.234,56` and `03.11.2026`, or a Japanese one in Shift_JIS with `2026/11/03`, is read the same way as the English file. [`fixtures/intl/`](fixtures/intl) has both versions of the demo data, and the eval cases `intl-de-*` and `intl-ja-*` require the same results as the English case. Columns named differently? Run `npx fairwire-email-gateway inspect <file>` (names and shapes only, never values) and name them in `fairwire-sources.json`:
121
+
122
+ ```json
123
+ { "files": { "exports/devices.csv": { "columns": { "host": "Gerätename" }, "date_order": "dmy" } } }
124
+ ```
125
+
126
+ ## Memory
127
+
128
+ fairwire-email-gateway can remember facts about your setup so the next run does not have to be told again. `email_gateway_learn` only proposes a fact; it changes nothing until a named person accepts it with `email_gateway_accept_learning`, which is one click even in Auto. Facts live in one hash-chained file per agent under `.fairwire/memory/`; if the chain does not verify, no fact is used. Credentials, personal identifiers and text that reads like instructions to an AI are refused. Run without memory with `--no-memory`.
129
+
130
+ | Kind | What an accepted fact changes |
131
+ |---|---|
132
+ | `known_exception` | that finding is listed under "Accepted as known" instead of as open, until review_by (when given) has passed. |
133
+ | `note` | nothing (shown by recall only) |
134
+
135
+ ```bash
136
+ fairwire-email-gateway memory list
137
+ fairwire-email-gateway memory accept MEM-1a2b3c4d5e6f --as "Your Name"
138
+ fairwire-email-gateway memory retire MEM-1a2b3c4d5e6f --as "Your Name" --reason "rule removed"
139
+ ```
140
+
141
+ ## Install
142
+
143
+ Node 20 or newer. No other dependencies.
144
+
145
+ ```bash
146
+ npx -y fairwire-email-gateway demo
147
+ npx -y fairwire-email-gateway mcp --root /path/to/your/files
148
+ ```
149
+
150
+ Claude Desktop, Cursor and other MCP hosts:
151
+
152
+ ```json
153
+ {
154
+ "mcpServers": {
155
+ "fairwire-email-gateway": {
156
+ "command": "npx",
157
+ "args": [
158
+ "-y",
159
+ "fairwire-email-gateway",
160
+ "mcp",
161
+ "--root",
162
+ "/path/to/your/files"
163
+ ]
164
+ }
165
+ }
166
+ }
167
+ ```
168
+
169
+ Claude Code: `claude mcp add fairwire-email-gateway -- npx -y fairwire-email-gateway mcp --root .`, or install the `fairwire-email-gateway` plugin from this repository's marketplace.
170
+
171
+ ## Modes and approvals
172
+
173
+ - **Review** (`--mode review`): reads and reports only.
174
+ - **Assist** (default): the policy above. A tool that asks returns an `approval_id`; a person approves it once with `fairwire-email-gateway approve <id> --as "Your Name"` (or on the local approvals page, `fairwire-email-gateway approvals`), and the same call is repeated.
175
+ - **Auto** (`--mode auto --auto <tool,...>`): opt-in per tool, with step caps and a kill switch (`fairwire-email-gateway kill`). Paying, sending, posting to a ledger or a live system and accepting a learned fact stay **one named click even in Auto**; an approval is tied to the sha256 of the reviewed draft, so a changed draft needs a new click.
176
+
177
+ ## CLI
178
+
179
+ ```bash
180
+ fairwire-email-gateway tools # every tool, its policy and arguments
181
+ fairwire-email-gateway sources # the columns each input is read from
182
+ fairwire-email-gateway inspect <file> # how a file would be read (names and shapes, never values)
183
+ fairwire-email-gateway call email_gateway_check '{"messages":"<messages>"}'
184
+ fairwire-email-gateway eval # the private eval cases on the fictional fixtures
185
+ fairwire-email-gateway demo
186
+ ```
187
+
188
+ ## Audit log and data
189
+
190
+ Every call is written to `.fairwire/audit.jsonl` under the root: hash-chained JSON lines, with arguments stored as a hash, signed with an Ed25519 key when you configure one. Everything runs on your machine on files you choose. No network calls, no telemetry, no credentials. The bundled fixtures are fictional.
191
+
192
+ <!-- generated:end -->
193
+
194
+ ## Limits
195
+
196
+ - Reads only the files you export and give it. It does not log in to a firewall, switch, controller, cloud console, identity provider or any other live system.
197
+ - Verdicts are the gateway's own; a message it missed is not in this review. Pair it with sign-in logs for compromised accounts.
198
+ - Mail authentication records (SPF, DKIM, DMARC) are checked by the Fairbooks mail authentication agent, not here.
199
+ - Thresholds are working defaults in a settings file you control; they are not a vendor rule, a requirement of any standard or a security guarantee.
200
+ - Results returned to the AI model have the names of people, sign-in names, e-mail addresses, phone numbers and client addresses masked. The files written here keep the real values: keep them in a secure folder.
201
+ - It changes nothing on a live device, firewall, DNS zone, directory or cloud account. Every change it suggests is a draft that one named person applies.
202
+ - Export layouts were written from knowledge of common exports and have not been tested on live customer accounts. Run `inspect` on a new export and name columns in `fairwire-sources.json` when they differ.
203
+
204
+ ## Licence
205
+
206
+ MIT. Fictional data only in `fixtures/`.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from 'node:url';
3
+ import { main } from 'fairwire-core';
4
+ import { manifest } from '../src/manifest.js';
5
+ import { demo } from '../src/demo.js';
6
+
7
+ main(manifest, { bin: 'fairwire-email-gateway', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
@@ -0,0 +1,336 @@
1
+ {
2
+ "suite": "fairwire-email-gateway",
3
+ "root": "..",
4
+ "data_note": "Fictional gateway messages in ../fixtures. No model is called.",
5
+ "cases": [
6
+ {
7
+ "id": "check-totals",
8
+ "tool": "email_gateway_check",
9
+ "args": {
10
+ "messages": "fixtures/messages.csv",
11
+ "settings": "fixtures/settings.json"
12
+ },
13
+ "expect": {
14
+ "equals": {
15
+ "result.messages": 60,
16
+ "result.inbound": 35,
17
+ "result.outbound": 25,
18
+ "result.threats": 11,
19
+ "result.quarantined_pct": 28.6,
20
+ "result.open": 6,
21
+ "result.high": 3
22
+ }
23
+ }
24
+ },
25
+ {
26
+ "id": "every-planted-issue",
27
+ "tool": "email_gateway_check",
28
+ "args": {
29
+ "messages": "fixtures/messages.csv",
30
+ "settings": "fixtures/settings.json"
31
+ },
32
+ "expect": {
33
+ "contains": [
34
+ "released_threat",
35
+ "MSG-0027",
36
+ "allowlist_sent_threat",
37
+ "judged malware",
38
+ "outbound_spam",
39
+ "22 outbound",
40
+ "late_clawback",
41
+ "150 minutes",
42
+ "most_targeted",
43
+ "6 phishing",
44
+ "dlp_hits",
45
+ "Customer list"
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "id": "addresses-masked",
51
+ "tool": "email_gateway_check",
52
+ "args": {
53
+ "messages": "fixtures/messages.csv"
54
+ },
55
+ "expect": {
56
+ "not_contains": [
57
+ "corp.example",
58
+ "supplier.example",
59
+ "cfo@"
60
+ ],
61
+ "matches": [
62
+ "USR-[0-9a-f]{8}"
63
+ ]
64
+ }
65
+ },
66
+ {
67
+ "id": "stricter-pull-back",
68
+ "tool": "email_gateway_check",
69
+ "args": {
70
+ "messages": "fixtures/messages.csv",
71
+ "settings": "fixtures/settings-strict.json"
72
+ },
73
+ "expect": {
74
+ "equals": {
75
+ "result.open": 6
76
+ },
77
+ "not_contains": [
78
+ "late_clawback"
79
+ ],
80
+ "contains": [
81
+ "received 3 phishing"
82
+ ]
83
+ }
84
+ },
85
+ {
86
+ "id": "explain-message",
87
+ "tool": "email_gateway_explain",
88
+ "args": {
89
+ "messages": "fixtures/messages.csv",
90
+ "settings": "fixtures/settings.json",
91
+ "address": "MSG-0027"
92
+ },
93
+ "expect": {
94
+ "contains": [
95
+ "released_threat"
96
+ ],
97
+ "equals": {
98
+ "result.findings": 1
99
+ }
100
+ }
101
+ },
102
+ {
103
+ "id": "draft-after-approval",
104
+ "tool": "email_gateway_draft_security_note",
105
+ "approve": "Pat Example",
106
+ "args": {
107
+ "messages": "fixtures/messages.csv",
108
+ "settings": "fixtures/settings.json"
109
+ },
110
+ "expect": {
111
+ "status": "executed",
112
+ "contains": [
113
+ "Nothing was sent"
114
+ ],
115
+ "equals": {
116
+ "result.items": 4,
117
+ "result.open_markers": 1
118
+ }
119
+ }
120
+ },
121
+ {
122
+ "id": "review-mode-still-reads",
123
+ "tool": "email_gateway_check",
124
+ "mode": "review",
125
+ "args": {
126
+ "messages": "fixtures/messages.csv",
127
+ "settings": "fixtures/settings.json"
128
+ },
129
+ "expect": {
130
+ "status": "executed",
131
+ "equals": {
132
+ "result.messages": 60,
133
+ "result.inbound": 35,
134
+ "result.outbound": 25,
135
+ "result.threats": 11,
136
+ "result.quarantined_pct": 28.6,
137
+ "result.open": 6,
138
+ "result.high": 3
139
+ }
140
+ },
141
+ "generated": true
142
+ },
143
+ {
144
+ "id": "severity-filter",
145
+ "tool": "email_gateway_check",
146
+ "args": {
147
+ "messages": "fixtures/messages.csv",
148
+ "settings": "fixtures/settings.json",
149
+ "severity": "high"
150
+ },
151
+ "expect": {
152
+ "status": "executed",
153
+ "equals": {
154
+ "result.findings": 3
155
+ }
156
+ },
157
+ "generated": true
158
+ },
159
+ {
160
+ "id": "missing-argument-named",
161
+ "tool": "email_gateway_check",
162
+ "args": {},
163
+ "expect": {
164
+ "status": "error",
165
+ "contains": [
166
+ "messages"
167
+ ]
168
+ },
169
+ "generated": true
170
+ },
171
+ {
172
+ "id": "file-outside-root-refused",
173
+ "tool": "email_gateway_check",
174
+ "args": {
175
+ "messages": "../../../outside.csv",
176
+ "settings": "fixtures/settings.json"
177
+ },
178
+ "expect": {
179
+ "status": "error",
180
+ "contains": [
181
+ "outside"
182
+ ]
183
+ },
184
+ "generated": true
185
+ },
186
+ {
187
+ "id": "invented-tool-name-refused",
188
+ "tool": "email_gateway_apply_every_fix_now",
189
+ "args": {},
190
+ "expect": {
191
+ "status": "blocked"
192
+ },
193
+ "generated": true
194
+ },
195
+ {
196
+ "id": "write-report-writes-files",
197
+ "tool": "email_gateway_write_report",
198
+ "args": {
199
+ "messages": "fixtures/messages.csv",
200
+ "settings": "fixtures/settings.json"
201
+ },
202
+ "expect": {
203
+ "status": "executed",
204
+ "contains": [
205
+ "email-gateway.csv",
206
+ "email-gateway.html"
207
+ ]
208
+ },
209
+ "generated": true
210
+ },
211
+ {
212
+ "id": "recall-memory-starts-empty",
213
+ "tool": "email_gateway_recall",
214
+ "args": {},
215
+ "expect": {
216
+ "status": "executed",
217
+ "contains": [
218
+ "memory is empty"
219
+ ]
220
+ },
221
+ "generated": true
222
+ },
223
+ {
224
+ "id": "accept-learning-stays-one-click",
225
+ "tool": "email_gateway_accept_learning",
226
+ "mode": "auto",
227
+ "args": {
228
+ "id": "MEM-000000000000",
229
+ "decision": "accept"
230
+ },
231
+ "expect": {
232
+ "status": "needs_approval"
233
+ },
234
+ "generated": true
235
+ },
236
+ {
237
+ "id": "never-gateway-release-message",
238
+ "tool": "gateway_release_message",
239
+ "mode": "auto",
240
+ "args": {},
241
+ "expect": {
242
+ "status": "blocked"
243
+ },
244
+ "generated": true
245
+ },
246
+ {
247
+ "id": "never-gateway-change-allowlist",
248
+ "tool": "gateway_change_allowlist",
249
+ "mode": "auto",
250
+ "args": {},
251
+ "expect": {
252
+ "status": "blocked"
253
+ },
254
+ "generated": true
255
+ },
256
+ {
257
+ "id": "draft-waits-for-a-person",
258
+ "tool": "email_gateway_draft_security_note",
259
+ "args": {
260
+ "messages": "fixtures/messages.csv",
261
+ "settings": "fixtures/settings.json"
262
+ },
263
+ "expect": {
264
+ "status": "needs_approval",
265
+ "decision": "ask"
266
+ },
267
+ "generated": true
268
+ },
269
+ {
270
+ "id": "review-mode-drafts-nothing",
271
+ "tool": "email_gateway_draft_security_note",
272
+ "mode": "review",
273
+ "args": {
274
+ "messages": "fixtures/messages.csv",
275
+ "settings": "fixtures/settings.json"
276
+ },
277
+ "expect": {
278
+ "status": "blocked"
279
+ },
280
+ "generated": true
281
+ },
282
+ {
283
+ "id": "request-stays-one-click",
284
+ "tool": "email_gateway_request_send",
285
+ "mode": "auto",
286
+ "args": {
287
+ "draft": "fixtures/README.md",
288
+ "draft_sha256": "0000000000000000000000000000000000000000000000000000000000000000"
289
+ },
290
+ "expect": {
291
+ "status": "needs_approval"
292
+ },
293
+ "generated": true
294
+ },
295
+ {
296
+ "id": "intl-de-check-totals",
297
+ "tool": "email_gateway_check",
298
+ "args": {
299
+ "messages": "fixtures/intl/de/messages.csv",
300
+ "settings": "fixtures/settings.json"
301
+ },
302
+ "expect": {
303
+ "equals": {
304
+ "result.messages": 60,
305
+ "result.inbound": 35,
306
+ "result.outbound": 25,
307
+ "result.threats": 11,
308
+ "result.quarantined_pct": 28.6,
309
+ "result.open": 6,
310
+ "result.high": 3
311
+ }
312
+ },
313
+ "note": "German export of the same data (fixtures/intl/de); must match the English case \"check-totals\"."
314
+ },
315
+ {
316
+ "id": "intl-ja-check-totals",
317
+ "tool": "email_gateway_check",
318
+ "args": {
319
+ "messages": "fixtures/intl/ja/messages.csv",
320
+ "settings": "fixtures/settings.json"
321
+ },
322
+ "expect": {
323
+ "equals": {
324
+ "result.messages": 60,
325
+ "result.inbound": 35,
326
+ "result.outbound": 25,
327
+ "result.threats": 11,
328
+ "result.quarantined_pct": 28.6,
329
+ "result.open": 6,
330
+ "result.high": 3
331
+ }
332
+ },
333
+ "note": "Japanese export of the same data (fixtures/intl/ja); must match the English case \"check-totals\"."
334
+ }
335
+ ]
336
+ }
@@ -0,0 +1,6 @@
1
+ # Fairwire Email Gateway fixtures
2
+
3
+ Fictional gateway log for corp.example (all addresses made up, on reserved .example domains).
4
+
5
+ - `messages.csv`: 60 messages. One phishing message was released to an accounts clerk; an allow-listed supplier address sent three malware messages; a sales mailbox sent 22 spam messages at 2 am; a payroll phishing message sat in an inbox for 150 minutes; the CFO received six phishing messages; an analyst sent a customer list outside three times.
6
+ - `settings.json`: the default limits written out.
@@ -0,0 +1,12 @@
1
+ # Fixtures from other countries
2
+
3
+ Generated by `node scripts/make-intl-fixtures.mjs` from the English fixtures one
4
+ folder up. The same fictional data, written the way a local export writes it:
5
+
6
+ - `de/`: German column names, Windows-1252 text, semicolons, comma decimals
7
+ (1.234,56), day-first dotted dates (03.11.2026), kilograms and kilometres.
8
+ - `ja/`: Japanese column names, Shift_JIS text, year-first dates (2026/11/03),
9
+ kilograms and kilometres.
10
+
11
+ Values (names, codes, charge wording) stay in English. The eval cases
12
+ `intl-de-*` and `intl-ja-*` expect exactly the same results as the English case.
@@ -0,0 +1,61 @@
1
+ message_id;received_at;Richtung;Absender;Empf�nger;Bewertung;Aktion;allowlisted;clawed_back_at;dlp_rule
2
+ MSG-0001;16.11.2026 09:00:00;inbound;news@vendor.example;staff0@corp.example;Clean;Delivered;no;;
3
+ MSG-0002;16.11.2026 09:01:00;inbound;news@vendor.example;staff1@corp.example;Clean;Delivered;no;;
4
+ MSG-0003;16.11.2026 09:02:00;inbound;news@vendor.example;staff2@corp.example;Clean;Delivered;no;;
5
+ MSG-0004;16.11.2026 09:03:00;inbound;news@vendor.example;staff3@corp.example;Clean;Delivered;no;;
6
+ MSG-0005;16.11.2026 09:04:00;inbound;news@vendor.example;staff4@corp.example;Clean;Delivered;no;;
7
+ MSG-0006;16.11.2026 09:05:00;inbound;news@vendor.example;staff0@corp.example;Clean;Delivered;no;;
8
+ MSG-0007;16.11.2026 09:06:00;inbound;news@vendor.example;staff1@corp.example;Clean;Delivered;no;;
9
+ MSG-0008;16.11.2026 09:07:00;inbound;news@vendor.example;staff2@corp.example;Clean;Delivered;no;;
10
+ MSG-0009;16.11.2026 09:08:00;inbound;news@vendor.example;staff3@corp.example;Clean;Delivered;no;;
11
+ MSG-0010;16.11.2026 09:09:00;inbound;news@vendor.example;staff4@corp.example;Clean;Delivered;no;;
12
+ MSG-0011;16.11.2026 09:10:00;inbound;news@vendor.example;staff0@corp.example;Clean;Delivered;no;;
13
+ MSG-0012;16.11.2026 09:11:00;inbound;news@vendor.example;staff1@corp.example;Clean;Delivered;no;;
14
+ MSG-0013;16.11.2026 09:12:00;inbound;news@vendor.example;staff2@corp.example;Clean;Delivered;no;;
15
+ MSG-0014;16.11.2026 09:13:00;inbound;news@vendor.example;staff3@corp.example;Clean;Delivered;no;;
16
+ MSG-0015;16.11.2026 09:14:00;inbound;news@vendor.example;staff4@corp.example;Clean;Delivered;no;;
17
+ MSG-0016;16.11.2026 09:15:00;inbound;news@vendor.example;staff0@corp.example;Clean;Delivered;no;;
18
+ MSG-0017;16.11.2026 09:16:00;inbound;news@vendor.example;staff1@corp.example;Clean;Delivered;no;;
19
+ MSG-0018;16.11.2026 09:17:00;inbound;news@vendor.example;staff2@corp.example;Clean;Delivered;no;;
20
+ MSG-0019;16.11.2026 09:18:00;inbound;news@vendor.example;staff3@corp.example;Clean;Delivered;no;;
21
+ MSG-0020;16.11.2026 09:19:00;inbound;news@vendor.example;staff4@corp.example;Clean;Delivered;no;;
22
+ MSG-0021;16.11.2026 10:00:00;inbound;billing@pay-update.example;cfo@corp.example;Phish;Quarantined;no;;
23
+ MSG-0022;16.11.2026 10:01:00;inbound;billing@pay-update.example;cfo@corp.example;Phish;Quarantined;no;;
24
+ MSG-0023;16.11.2026 10:02:00;inbound;billing@pay-update.example;cfo@corp.example;Phish;Quarantined;no;;
25
+ MSG-0024;16.11.2026 10:03:00;inbound;billing@pay-update.example;cfo@corp.example;Phish;Quarantined;no;;
26
+ MSG-0025;16.11.2026 10:04:00;inbound;billing@pay-update.example;cfo@corp.example;Phish;Quarantined;no;;
27
+ MSG-0026;16.11.2026 10:05:00;inbound;billing@pay-update.example;cfo@corp.example;Phish;Quarantined;no;;
28
+ MSG-0027;16.11.2026 10:30:00;inbound;billing@pay-update.example;ap.clerk@corp.example;Phish;Released;no;;
29
+ MSG-0028;16.11.2026 11:00:00;inbound;partner@supplier.example;buyer@corp.example;Malware;Delivered;yes;;
30
+ MSG-0029;16.11.2026 11:01:00;inbound;partner@supplier.example;buyer@corp.example;Malware;Delivered;yes;;
31
+ MSG-0030;16.11.2026 11:02:00;inbound;partner@supplier.example;buyer@corp.example;Malware;Delivered;yes;;
32
+ MSG-0031;16.11.2026 12:00:00;inbound;hr@payroll-portal.example;staff1@corp.example;Phish;Delivered;no;16.11.2026 14:30:00;
33
+ MSG-0032;17.11.2026 02:00:00;outbound;sales.rep@corp.example;prospect0@outside.example;Spam;Blocked;no;;
34
+ MSG-0033;17.11.2026 02:01:00;outbound;sales.rep@corp.example;prospect1@outside.example;Spam;Blocked;no;;
35
+ MSG-0034;17.11.2026 02:02:00;outbound;sales.rep@corp.example;prospect2@outside.example;Spam;Blocked;no;;
36
+ MSG-0035;17.11.2026 02:03:00;outbound;sales.rep@corp.example;prospect3@outside.example;Spam;Blocked;no;;
37
+ MSG-0036;17.11.2026 02:04:00;outbound;sales.rep@corp.example;prospect4@outside.example;Spam;Blocked;no;;
38
+ MSG-0037;17.11.2026 02:05:00;outbound;sales.rep@corp.example;prospect5@outside.example;Spam;Blocked;no;;
39
+ MSG-0038;17.11.2026 02:06:00;outbound;sales.rep@corp.example;prospect6@outside.example;Spam;Blocked;no;;
40
+ MSG-0039;17.11.2026 02:07:00;outbound;sales.rep@corp.example;prospect7@outside.example;Spam;Blocked;no;;
41
+ MSG-0040;17.11.2026 02:08:00;outbound;sales.rep@corp.example;prospect8@outside.example;Spam;Blocked;no;;
42
+ MSG-0041;17.11.2026 02:09:00;outbound;sales.rep@corp.example;prospect9@outside.example;Spam;Blocked;no;;
43
+ MSG-0042;17.11.2026 02:10:00;outbound;sales.rep@corp.example;prospect10@outside.example;Spam;Blocked;no;;
44
+ MSG-0043;17.11.2026 02:11:00;outbound;sales.rep@corp.example;prospect11@outside.example;Spam;Blocked;no;;
45
+ MSG-0044;17.11.2026 02:12:00;outbound;sales.rep@corp.example;prospect12@outside.example;Spam;Blocked;no;;
46
+ MSG-0045;17.11.2026 02:13:00;outbound;sales.rep@corp.example;prospect13@outside.example;Spam;Blocked;no;;
47
+ MSG-0046;17.11.2026 02:14:00;outbound;sales.rep@corp.example;prospect14@outside.example;Spam;Blocked;no;;
48
+ MSG-0047;17.11.2026 02:15:00;outbound;sales.rep@corp.example;prospect15@outside.example;Spam;Blocked;no;;
49
+ MSG-0048;17.11.2026 02:16:00;outbound;sales.rep@corp.example;prospect16@outside.example;Spam;Blocked;no;;
50
+ MSG-0049;17.11.2026 02:17:00;outbound;sales.rep@corp.example;prospect17@outside.example;Spam;Blocked;no;;
51
+ MSG-0050;17.11.2026 02:18:00;outbound;sales.rep@corp.example;prospect18@outside.example;Spam;Blocked;no;;
52
+ MSG-0051;17.11.2026 02:19:00;outbound;sales.rep@corp.example;prospect19@outside.example;Spam;Blocked;no;;
53
+ MSG-0052;17.11.2026 02:20:00;outbound;sales.rep@corp.example;prospect20@outside.example;Spam;Blocked;no;;
54
+ MSG-0053;17.11.2026 02:21:00;outbound;sales.rep@corp.example;prospect21@outside.example;Spam;Blocked;no;;
55
+ MSG-0054;17.11.2026 15:00:00;outbound;analyst@corp.example;personal.mail@outside.example;Clean;Delivered;no;;Customer list
56
+ MSG-0055;17.11.2026 15:01:00;outbound;analyst@corp.example;personal.mail@outside.example;Clean;Delivered;no;;Customer list
57
+ MSG-0056;17.11.2026 15:02:00;outbound;analyst@corp.example;personal.mail@outside.example;Clean;Delivered;no;;Customer list
58
+ MSG-0057;17.11.2026 09:00:00;inbound;promo@deals.example;staff2@corp.example;Spam;Quarantined;no;;
59
+ MSG-0058;17.11.2026 09:01:00;inbound;promo@deals.example;staff2@corp.example;Spam;Quarantined;no;;
60
+ MSG-0059;17.11.2026 09:02:00;inbound;promo@deals.example;staff2@corp.example;Spam;Quarantined;no;;
61
+ MSG-0060;17.11.2026 09:03:00;inbound;promo@deals.example;staff2@corp.example;Spam;Quarantined;no;;
@@ -0,0 +1,61 @@
1
+ message_id,received_at,���o�ɋ敪,���M��,��M��,����,�A�N�V����,allowlisted,clawed_back_at,dlp_rule
2
+ MSG-0001,2026/11/16 09:00:00,inbound,news@vendor.example,staff0@corp.example,Clean,Delivered,no,,
3
+ MSG-0002,2026/11/16 09:01:00,inbound,news@vendor.example,staff1@corp.example,Clean,Delivered,no,,
4
+ MSG-0003,2026/11/16 09:02:00,inbound,news@vendor.example,staff2@corp.example,Clean,Delivered,no,,
5
+ MSG-0004,2026/11/16 09:03:00,inbound,news@vendor.example,staff3@corp.example,Clean,Delivered,no,,
6
+ MSG-0005,2026/11/16 09:04:00,inbound,news@vendor.example,staff4@corp.example,Clean,Delivered,no,,
7
+ MSG-0006,2026/11/16 09:05:00,inbound,news@vendor.example,staff0@corp.example,Clean,Delivered,no,,
8
+ MSG-0007,2026/11/16 09:06:00,inbound,news@vendor.example,staff1@corp.example,Clean,Delivered,no,,
9
+ MSG-0008,2026/11/16 09:07:00,inbound,news@vendor.example,staff2@corp.example,Clean,Delivered,no,,
10
+ MSG-0009,2026/11/16 09:08:00,inbound,news@vendor.example,staff3@corp.example,Clean,Delivered,no,,
11
+ MSG-0010,2026/11/16 09:09:00,inbound,news@vendor.example,staff4@corp.example,Clean,Delivered,no,,
12
+ MSG-0011,2026/11/16 09:10:00,inbound,news@vendor.example,staff0@corp.example,Clean,Delivered,no,,
13
+ MSG-0012,2026/11/16 09:11:00,inbound,news@vendor.example,staff1@corp.example,Clean,Delivered,no,,
14
+ MSG-0013,2026/11/16 09:12:00,inbound,news@vendor.example,staff2@corp.example,Clean,Delivered,no,,
15
+ MSG-0014,2026/11/16 09:13:00,inbound,news@vendor.example,staff3@corp.example,Clean,Delivered,no,,
16
+ MSG-0015,2026/11/16 09:14:00,inbound,news@vendor.example,staff4@corp.example,Clean,Delivered,no,,
17
+ MSG-0016,2026/11/16 09:15:00,inbound,news@vendor.example,staff0@corp.example,Clean,Delivered,no,,
18
+ MSG-0017,2026/11/16 09:16:00,inbound,news@vendor.example,staff1@corp.example,Clean,Delivered,no,,
19
+ MSG-0018,2026/11/16 09:17:00,inbound,news@vendor.example,staff2@corp.example,Clean,Delivered,no,,
20
+ MSG-0019,2026/11/16 09:18:00,inbound,news@vendor.example,staff3@corp.example,Clean,Delivered,no,,
21
+ MSG-0020,2026/11/16 09:19:00,inbound,news@vendor.example,staff4@corp.example,Clean,Delivered,no,,
22
+ MSG-0021,2026/11/16 10:00:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
23
+ MSG-0022,2026/11/16 10:01:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
24
+ MSG-0023,2026/11/16 10:02:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
25
+ MSG-0024,2026/11/16 10:03:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
26
+ MSG-0025,2026/11/16 10:04:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
27
+ MSG-0026,2026/11/16 10:05:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
28
+ MSG-0027,2026/11/16 10:30:00,inbound,billing@pay-update.example,ap.clerk@corp.example,Phish,Released,no,,
29
+ MSG-0028,2026/11/16 11:00:00,inbound,partner@supplier.example,buyer@corp.example,Malware,Delivered,yes,,
30
+ MSG-0029,2026/11/16 11:01:00,inbound,partner@supplier.example,buyer@corp.example,Malware,Delivered,yes,,
31
+ MSG-0030,2026/11/16 11:02:00,inbound,partner@supplier.example,buyer@corp.example,Malware,Delivered,yes,,
32
+ MSG-0031,2026/11/16 12:00:00,inbound,hr@payroll-portal.example,staff1@corp.example,Phish,Delivered,no,2026/11/16 14:30:00,
33
+ MSG-0032,2026/11/17 02:00:00,outbound,sales.rep@corp.example,prospect0@outside.example,Spam,Blocked,no,,
34
+ MSG-0033,2026/11/17 02:01:00,outbound,sales.rep@corp.example,prospect1@outside.example,Spam,Blocked,no,,
35
+ MSG-0034,2026/11/17 02:02:00,outbound,sales.rep@corp.example,prospect2@outside.example,Spam,Blocked,no,,
36
+ MSG-0035,2026/11/17 02:03:00,outbound,sales.rep@corp.example,prospect3@outside.example,Spam,Blocked,no,,
37
+ MSG-0036,2026/11/17 02:04:00,outbound,sales.rep@corp.example,prospect4@outside.example,Spam,Blocked,no,,
38
+ MSG-0037,2026/11/17 02:05:00,outbound,sales.rep@corp.example,prospect5@outside.example,Spam,Blocked,no,,
39
+ MSG-0038,2026/11/17 02:06:00,outbound,sales.rep@corp.example,prospect6@outside.example,Spam,Blocked,no,,
40
+ MSG-0039,2026/11/17 02:07:00,outbound,sales.rep@corp.example,prospect7@outside.example,Spam,Blocked,no,,
41
+ MSG-0040,2026/11/17 02:08:00,outbound,sales.rep@corp.example,prospect8@outside.example,Spam,Blocked,no,,
42
+ MSG-0041,2026/11/17 02:09:00,outbound,sales.rep@corp.example,prospect9@outside.example,Spam,Blocked,no,,
43
+ MSG-0042,2026/11/17 02:10:00,outbound,sales.rep@corp.example,prospect10@outside.example,Spam,Blocked,no,,
44
+ MSG-0043,2026/11/17 02:11:00,outbound,sales.rep@corp.example,prospect11@outside.example,Spam,Blocked,no,,
45
+ MSG-0044,2026/11/17 02:12:00,outbound,sales.rep@corp.example,prospect12@outside.example,Spam,Blocked,no,,
46
+ MSG-0045,2026/11/17 02:13:00,outbound,sales.rep@corp.example,prospect13@outside.example,Spam,Blocked,no,,
47
+ MSG-0046,2026/11/17 02:14:00,outbound,sales.rep@corp.example,prospect14@outside.example,Spam,Blocked,no,,
48
+ MSG-0047,2026/11/17 02:15:00,outbound,sales.rep@corp.example,prospect15@outside.example,Spam,Blocked,no,,
49
+ MSG-0048,2026/11/17 02:16:00,outbound,sales.rep@corp.example,prospect16@outside.example,Spam,Blocked,no,,
50
+ MSG-0049,2026/11/17 02:17:00,outbound,sales.rep@corp.example,prospect17@outside.example,Spam,Blocked,no,,
51
+ MSG-0050,2026/11/17 02:18:00,outbound,sales.rep@corp.example,prospect18@outside.example,Spam,Blocked,no,,
52
+ MSG-0051,2026/11/17 02:19:00,outbound,sales.rep@corp.example,prospect19@outside.example,Spam,Blocked,no,,
53
+ MSG-0052,2026/11/17 02:20:00,outbound,sales.rep@corp.example,prospect20@outside.example,Spam,Blocked,no,,
54
+ MSG-0053,2026/11/17 02:21:00,outbound,sales.rep@corp.example,prospect21@outside.example,Spam,Blocked,no,,
55
+ MSG-0054,2026/11/17 15:00:00,outbound,analyst@corp.example,personal.mail@outside.example,Clean,Delivered,no,,Customer list
56
+ MSG-0055,2026/11/17 15:01:00,outbound,analyst@corp.example,personal.mail@outside.example,Clean,Delivered,no,,Customer list
57
+ MSG-0056,2026/11/17 15:02:00,outbound,analyst@corp.example,personal.mail@outside.example,Clean,Delivered,no,,Customer list
58
+ MSG-0057,2026/11/17 09:00:00,inbound,promo@deals.example,staff2@corp.example,Spam,Quarantined,no,,
59
+ MSG-0058,2026/11/17 09:01:00,inbound,promo@deals.example,staff2@corp.example,Spam,Quarantined,no,,
60
+ MSG-0059,2026/11/17 09:02:00,inbound,promo@deals.example,staff2@corp.example,Spam,Quarantined,no,,
61
+ MSG-0060,2026/11/17 09:03:00,inbound,promo@deals.example,staff2@corp.example,Spam,Quarantined,no,,
@@ -0,0 +1,61 @@
1
+ message_id,received_at,direction,sender,recipient,verdict,action,allowlisted,clawed_back_at,dlp_rule
2
+ MSG-0001,2026-11-16 09:00:00,inbound,news@vendor.example,staff0@corp.example,Clean,Delivered,no,,
3
+ MSG-0002,2026-11-16 09:01:00,inbound,news@vendor.example,staff1@corp.example,Clean,Delivered,no,,
4
+ MSG-0003,2026-11-16 09:02:00,inbound,news@vendor.example,staff2@corp.example,Clean,Delivered,no,,
5
+ MSG-0004,2026-11-16 09:03:00,inbound,news@vendor.example,staff3@corp.example,Clean,Delivered,no,,
6
+ MSG-0005,2026-11-16 09:04:00,inbound,news@vendor.example,staff4@corp.example,Clean,Delivered,no,,
7
+ MSG-0006,2026-11-16 09:05:00,inbound,news@vendor.example,staff0@corp.example,Clean,Delivered,no,,
8
+ MSG-0007,2026-11-16 09:06:00,inbound,news@vendor.example,staff1@corp.example,Clean,Delivered,no,,
9
+ MSG-0008,2026-11-16 09:07:00,inbound,news@vendor.example,staff2@corp.example,Clean,Delivered,no,,
10
+ MSG-0009,2026-11-16 09:08:00,inbound,news@vendor.example,staff3@corp.example,Clean,Delivered,no,,
11
+ MSG-0010,2026-11-16 09:09:00,inbound,news@vendor.example,staff4@corp.example,Clean,Delivered,no,,
12
+ MSG-0011,2026-11-16 09:10:00,inbound,news@vendor.example,staff0@corp.example,Clean,Delivered,no,,
13
+ MSG-0012,2026-11-16 09:11:00,inbound,news@vendor.example,staff1@corp.example,Clean,Delivered,no,,
14
+ MSG-0013,2026-11-16 09:12:00,inbound,news@vendor.example,staff2@corp.example,Clean,Delivered,no,,
15
+ MSG-0014,2026-11-16 09:13:00,inbound,news@vendor.example,staff3@corp.example,Clean,Delivered,no,,
16
+ MSG-0015,2026-11-16 09:14:00,inbound,news@vendor.example,staff4@corp.example,Clean,Delivered,no,,
17
+ MSG-0016,2026-11-16 09:15:00,inbound,news@vendor.example,staff0@corp.example,Clean,Delivered,no,,
18
+ MSG-0017,2026-11-16 09:16:00,inbound,news@vendor.example,staff1@corp.example,Clean,Delivered,no,,
19
+ MSG-0018,2026-11-16 09:17:00,inbound,news@vendor.example,staff2@corp.example,Clean,Delivered,no,,
20
+ MSG-0019,2026-11-16 09:18:00,inbound,news@vendor.example,staff3@corp.example,Clean,Delivered,no,,
21
+ MSG-0020,2026-11-16 09:19:00,inbound,news@vendor.example,staff4@corp.example,Clean,Delivered,no,,
22
+ MSG-0021,2026-11-16 10:00:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
23
+ MSG-0022,2026-11-16 10:01:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
24
+ MSG-0023,2026-11-16 10:02:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
25
+ MSG-0024,2026-11-16 10:03:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
26
+ MSG-0025,2026-11-16 10:04:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
27
+ MSG-0026,2026-11-16 10:05:00,inbound,billing@pay-update.example,cfo@corp.example,Phish,Quarantined,no,,
28
+ MSG-0027,2026-11-16 10:30:00,inbound,billing@pay-update.example,ap.clerk@corp.example,Phish,Released,no,,
29
+ MSG-0028,2026-11-16 11:00:00,inbound,partner@supplier.example,buyer@corp.example,Malware,Delivered,yes,,
30
+ MSG-0029,2026-11-16 11:01:00,inbound,partner@supplier.example,buyer@corp.example,Malware,Delivered,yes,,
31
+ MSG-0030,2026-11-16 11:02:00,inbound,partner@supplier.example,buyer@corp.example,Malware,Delivered,yes,,
32
+ MSG-0031,2026-11-16 12:00:00,inbound,hr@payroll-portal.example,staff1@corp.example,Phish,Delivered,no,2026-11-16 14:30:00,
33
+ MSG-0032,2026-11-17 02:00:00,outbound,sales.rep@corp.example,prospect0@outside.example,Spam,Blocked,no,,
34
+ MSG-0033,2026-11-17 02:01:00,outbound,sales.rep@corp.example,prospect1@outside.example,Spam,Blocked,no,,
35
+ MSG-0034,2026-11-17 02:02:00,outbound,sales.rep@corp.example,prospect2@outside.example,Spam,Blocked,no,,
36
+ MSG-0035,2026-11-17 02:03:00,outbound,sales.rep@corp.example,prospect3@outside.example,Spam,Blocked,no,,
37
+ MSG-0036,2026-11-17 02:04:00,outbound,sales.rep@corp.example,prospect4@outside.example,Spam,Blocked,no,,
38
+ MSG-0037,2026-11-17 02:05:00,outbound,sales.rep@corp.example,prospect5@outside.example,Spam,Blocked,no,,
39
+ MSG-0038,2026-11-17 02:06:00,outbound,sales.rep@corp.example,prospect6@outside.example,Spam,Blocked,no,,
40
+ MSG-0039,2026-11-17 02:07:00,outbound,sales.rep@corp.example,prospect7@outside.example,Spam,Blocked,no,,
41
+ MSG-0040,2026-11-17 02:08:00,outbound,sales.rep@corp.example,prospect8@outside.example,Spam,Blocked,no,,
42
+ MSG-0041,2026-11-17 02:09:00,outbound,sales.rep@corp.example,prospect9@outside.example,Spam,Blocked,no,,
43
+ MSG-0042,2026-11-17 02:10:00,outbound,sales.rep@corp.example,prospect10@outside.example,Spam,Blocked,no,,
44
+ MSG-0043,2026-11-17 02:11:00,outbound,sales.rep@corp.example,prospect11@outside.example,Spam,Blocked,no,,
45
+ MSG-0044,2026-11-17 02:12:00,outbound,sales.rep@corp.example,prospect12@outside.example,Spam,Blocked,no,,
46
+ MSG-0045,2026-11-17 02:13:00,outbound,sales.rep@corp.example,prospect13@outside.example,Spam,Blocked,no,,
47
+ MSG-0046,2026-11-17 02:14:00,outbound,sales.rep@corp.example,prospect14@outside.example,Spam,Blocked,no,,
48
+ MSG-0047,2026-11-17 02:15:00,outbound,sales.rep@corp.example,prospect15@outside.example,Spam,Blocked,no,,
49
+ MSG-0048,2026-11-17 02:16:00,outbound,sales.rep@corp.example,prospect16@outside.example,Spam,Blocked,no,,
50
+ MSG-0049,2026-11-17 02:17:00,outbound,sales.rep@corp.example,prospect17@outside.example,Spam,Blocked,no,,
51
+ MSG-0050,2026-11-17 02:18:00,outbound,sales.rep@corp.example,prospect18@outside.example,Spam,Blocked,no,,
52
+ MSG-0051,2026-11-17 02:19:00,outbound,sales.rep@corp.example,prospect19@outside.example,Spam,Blocked,no,,
53
+ MSG-0052,2026-11-17 02:20:00,outbound,sales.rep@corp.example,prospect20@outside.example,Spam,Blocked,no,,
54
+ MSG-0053,2026-11-17 02:21:00,outbound,sales.rep@corp.example,prospect21@outside.example,Spam,Blocked,no,,
55
+ MSG-0054,2026-11-17 15:00:00,outbound,analyst@corp.example,personal.mail@outside.example,Clean,Delivered,no,,Customer list
56
+ MSG-0055,2026-11-17 15:01:00,outbound,analyst@corp.example,personal.mail@outside.example,Clean,Delivered,no,,Customer list
57
+ MSG-0056,2026-11-17 15:02:00,outbound,analyst@corp.example,personal.mail@outside.example,Clean,Delivered,no,,Customer list
58
+ MSG-0057,2026-11-17 09:00:00,inbound,promo@deals.example,staff2@corp.example,Spam,Quarantined,no,,
59
+ MSG-0058,2026-11-17 09:01:00,inbound,promo@deals.example,staff2@corp.example,Spam,Quarantined,no,,
60
+ MSG-0059,2026-11-17 09:02:00,inbound,promo@deals.example,staff2@corp.example,Spam,Quarantined,no,,
61
+ MSG-0060,2026-11-17 09:03:00,inbound,promo@deals.example,staff2@corp.example,Spam,Quarantined,no,,
@@ -0,0 +1,4 @@
1
+ {
2
+ "clawback_minutes": 240,
3
+ "targeted_min": 2
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "clawback_minutes": 60,
3
+ "targeted_min": 5
4
+ }
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "fairwire-email-gateway",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "mcpName": "io.github.fpavia111-creator/fairwire-email-gateway",
5
+ "description": "Fairwire Email Gateway: Email gateway review from Proofpoint, Mimecast, Defender or similar exports: high-confidence phishing released from quarantine, allow-listed senders that sent malware, the people targeted most, mail pulled back late, outbound spam from an internal mailbox and data-loss rule hits. Names masked for the model. Drafts notes; never releases or deletes mail.",
6
+ "type": "module",
7
+ "license": "MIT",
8
+ "author": "Kurt Francisco",
9
+ "engines": {
10
+ "node": ">=20"
11
+ },
12
+ "main": "src/index.js",
13
+ "exports": {
14
+ ".": "./src/index.js",
15
+ "./package.json": "./package.json"
16
+ },
17
+ "bin": {
18
+ "fairwire-email-gateway": "bin/fairwire-email-gateway.js"
19
+ },
20
+ "files": [
21
+ "src",
22
+ "bin",
23
+ "fixtures",
24
+ "evals",
25
+ "README.md",
26
+ "CHANGELOG.md",
27
+ "LICENSE",
28
+ "server.json"
29
+ ],
30
+ "scripts": {
31
+ "test": "node scripts/run-tests.cjs",
32
+ "demo": "node bin/fairwire-email-gateway.js demo",
33
+ "eval": "node bin/fairwire-email-gateway.js eval"
34
+ },
35
+ "dependencies": {
36
+ "fairwire-core": "^0.1.0"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/fpavia111-creator/fairwire-agents.git",
41
+ "directory": "packages/fairwire-email-gateway"
42
+ },
43
+ "homepage": "https://github.com/fpavia111-creator/fairwire-agents/tree/master/packages/fairwire-email-gateway#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/fpavia111-creator/fairwire-agents/issues"
46
+ },
47
+ "keywords": [
48
+ "mcp",
49
+ "mcp-server",
50
+ "it-operations",
51
+ "network",
52
+ "fairwire",
53
+ "email-security",
54
+ "phishing",
55
+ "quarantine",
56
+ "proofpoint",
57
+ "mimecast"
58
+ ]
59
+ }
package/server.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.fpavia111-creator/fairwire-email-gateway",
4
+ "title": "Fairwire Email Gateway",
5
+ "description": "Fairwire Email Gateway: Email gateway review from Proofpoint, Mimecast, Defender or similar…",
6
+ "version": "0.1.0",
7
+ "repository": {
8
+ "url": "https://github.com/fpavia111-creator/fairwire-agents",
9
+ "source": "github",
10
+ "subfolder": "packages/fairwire-email-gateway"
11
+ },
12
+ "websiteUrl": "https://fair-agents.com/fairwire.html",
13
+ "packages": [
14
+ {
15
+ "registryType": "npm",
16
+ "identifier": "fairwire-email-gateway",
17
+ "version": "0.1.0",
18
+ "transport": {
19
+ "type": "stdio"
20
+ },
21
+ "packageArguments": [
22
+ {
23
+ "type": "positional",
24
+ "value": "mcp"
25
+ },
26
+ {
27
+ "type": "named",
28
+ "name": "--root",
29
+ "description": "Folder holding the exports this agent may read and write (it cannot reach outside it)",
30
+ "isRequired": true,
31
+ "format": "filepath",
32
+ "valueHint": "exports_folder"
33
+ }
34
+ ]
35
+ }
36
+ ]
37
+ }
package/src/demo.js ADDED
@@ -0,0 +1,19 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { readFileSync } from 'node:fs';
3
+ import { standardDemo } from 'fairwire-core';
4
+
5
+ // The demo runs the eval case "check-totals" and the agent's draft on the fictional fixtures.
6
+ const cases = JSON.parse(readFileSync(new URL('../evals/cases.json', import.meta.url), 'utf8')).cases;
7
+ const base = cases.find((c) => c.id === 'check-totals');
8
+ const explain = cases.find((c) => /_explain$/.test(c.tool) && !c.expect.status);
9
+ const draft = cases.find((c) => /_draft_/.test(c.tool) && c.approve);
10
+
11
+ export async function demo(manifest) {
12
+ const refused = manifest.tools.filter((t) => (manifest.policy.rules.find((r) => r.tool === t.name) || {}).decision === 'block')[0];
13
+ await standardDemo(manifest, fileURLToPath(new URL('../fixtures', import.meta.url)), {
14
+ title: 'Fairwire Email Gateway demo', args: base.args,
15
+ explain: explain ? { label: 'Explain one finding', args: explain.args } : null,
16
+ draft: draft ? { label: 'Draft the note for a person', args: draft.args } : null,
17
+ refused: refused ? refused.name : null,
18
+ });
19
+ }
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { manifest } from './manifest.js';
2
+ export * from './logic.js';
package/src/logic.js ADDED
@@ -0,0 +1,49 @@
1
+ // Fairwire Email Gateway: email security gateway report review. Pure functions.
2
+ import { num, str, low, yes, minutesBetween, pct, finding } from 'fairwire-core';
3
+
4
+ export const CHECKS = Object.freeze({
5
+ released_threat: 'A message the gateway judged phishing or malware that someone released from quarantine.',
6
+ allowlist_sent_threat: 'A sender on an allow list that sent phishing, malware or spam (allow lists skip checks).',
7
+ outbound_spam: 'An internal mailbox sending many messages the gateway judged spam or phishing (a sign the account is compromised).',
8
+ late_clawback: 'Phishing that reached inboxes and was pulled back later than your limit.',
9
+ most_targeted: 'A person who received many phishing or malware messages (worth extra training or protection).',
10
+ dlp_hits: 'An internal sender who triggered data-loss rules several times.',
11
+ });
12
+
13
+ export const MESSAGE_FIELDS = Object.freeze({
14
+ message_id: { aliases: ['Message ID', 'Message-ID', 'ID', 'Network Message ID'], required: true },
15
+ received_at: { type: 'datetime', aliases: ['Received', 'Date', 'Timestamp', 'Received Time', 'Delivery Time'] },
16
+ direction: { aliases: ['Direction', 'Mail Direction', 'Flow'] },
17
+ sender: { aliases: ['Sender', 'From', 'Sender Address', 'P1 Sender'], pii: 'user' },
18
+ recipient: { aliases: ['Recipient', 'To', 'Recipients', 'Recipient Address'], pii: 'user' },
19
+ verdict: { aliases: ['Verdict', 'Threat', 'Classification', 'Detection', 'Threat Type'] },
20
+ action: { aliases: ['Action', 'Delivery Action', 'Disposition', 'Status'] },
21
+ allowlisted: { aliases: ['Allowlisted', 'Allow Listed', 'Safe Sender', 'Bypass', 'Override'] },
22
+ clawed_back_at: { type: 'datetime', aliases: ['Clawed Back', 'Removed At', 'ZAP Time', 'Remediated At', 'Pulled Back'] },
23
+ dlp_rule: { aliases: ['DLP Rule', 'Policy Match', 'DLP Policy', 'Content Rule'] },
24
+ });
25
+
26
+ export const SETTINGS_SCHEMA = { type: 'object', additionalProperties: false, properties: {
27
+ outbound_spam_min: { type: 'integer', minimum: 1, description: 'Outbound spam or phishing from one mailbox before it is flagged (default 20)' },
28
+ clawback_minutes: { type: 'number', minimum: 1, description: 'Minutes after delivery by which phishing should be pulled back (default 60)' },
29
+ targeted_min: { type: 'integer', minimum: 1, description: 'Phishing or malware messages to one person before they count as most targeted (default 5)' },
30
+ dlp_min: { type: 'integer', minimum: 1, description: 'Data-loss rule hits from one sender before they are flagged (default 3)' },
31
+ } };
32
+ export const DEFAULTS = Object.freeze({ outbound_spam_min: 20, clawback_minutes: 60, targeted_min: 5, dlp_min: 3 });
33
+
34
+ const THREAT = /phish|malware|virus|impersonation|bec|credential/i;
35
+ const SPAMMY = /phish|malware|virus|spam|impersonation/i;
36
+
37
+ export function reviewMail(rows, settings = {}) {
38
+ const s = { ...DEFAULTS, ...settings };
39
+ const ms = rows.filter((r) => str(r.message_id)).map((r) => ({ id: str(r.message_id), at: str(r.received_at), dir: /out/i.test(str(r.direction)) ? 'outbound' : /intern/i.test(str(r.direction)) ? 'internal' : 'inbound', sender: low(r.sender), recipient: low(r.recipient), verdict: str(r.verdict), action: low(r.action), allow: yes(r.allowlisted) === true, claw: str(r.clawed_back_at), dlp: str(r.dlp_rule) }));
40
+ const items = []; const group = (pred, key) => { const m = new Map(); for (const x of ms) if (pred(x)) m.set(key(x), [...(m.get(key(x)) || []), x]); return m; };
41
+ for (const x of ms) if (THREAT.test(x.verdict) && /releas/.test(x.action)) items.push(finding('released_threat', 'high', x.id, `Message ${x.id} to ${x.recipient} was judged ${x.verdict} and released from quarantine.`, 'Pull the message back, check whether links were clicked or attachments opened, and review who may release threats.', { subject: x.recipient }));
42
+ for (const [sender, list] of group((x) => x.allow && SPAMMY.test(x.verdict), (x) => x.sender)) items.push(finding('allowlist_sent_threat', 'high', sender, `${sender} is allow-listed and sent ${list.length} message(s) judged ${[...new Set(list.map((x) => low(x.verdict)))].sort().join(', ')}.`, 'Remove the allow-list entry; allow lists should name a specific use, not skip all checks.', { subject: sender, messages: list.length }));
43
+ for (const [sender, list] of group((x) => x.dir === 'outbound' && SPAMMY.test(x.verdict), (x) => x.sender)) if (list.length >= s.outbound_spam_min) items.push(finding('outbound_spam', 'high', sender, `${sender} sent ${list.length} outbound messages judged spam or phishing.`, 'Treat the mailbox as compromised: reset the password, revoke sessions and check its inbox rules.', { subject: sender, messages: list.length }));
44
+ for (const x of ms) if (THREAT.test(x.verdict) && x.claw && x.at) { const mins = minutesBetween(x.at, x.claw); if (mins !== null && mins > s.clawback_minutes) items.push(finding('late_clawback', 'medium', x.id, `Message ${x.id} (${x.verdict}) sat in ${x.recipient}'s inbox for ${mins} minutes before it was pulled back.`, 'Check whether the person clicked; look at why the pull-back was slow.', { subject: x.recipient })); }
45
+ for (const [rcpt, list] of group((x) => x.dir === 'inbound' && THREAT.test(x.verdict), (x) => x.recipient)) if (list.length >= s.targeted_min) items.push(finding('most_targeted', 'low', rcpt, `${rcpt} received ${list.length} phishing or malware message(s).`, 'Offer this person targeted training and phishing-resistant MFA.', { subject: rcpt, messages: list.length }));
46
+ for (const [sender, list] of group((x) => x.dir !== 'inbound' && !!x.dlp, (x) => x.sender)) if (list.length >= s.dlp_min) items.push(finding('dlp_hits', 'low', sender, `${sender} triggered data-loss rules ${list.length} times (${[...new Set(list.map((x) => x.dlp))].sort().join(', ')}).`, 'Talk to the person or their manager; it is often a process that needs a safer way to share.', { subject: sender, messages: list.length }));
47
+ const inbound = ms.filter((x) => x.dir === 'inbound');
48
+ return { messages: ms.length, inbound: inbound.length, outbound: ms.filter((x) => x.dir === 'outbound').length, threats: ms.filter((x) => THREAT.test(x.verdict)).length, quarantined_pct: pct(inbound.filter((x) => /quarant|block|reject/.test(x.action)).length, inbound.length), items };
49
+ }
@@ -0,0 +1,31 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { wireAgent, fileArg, SETTINGS_ARG, settingsFrom, LIMITS } from 'fairwire-core';
3
+ import { MESSAGE_FIELDS, SETTINGS_SCHEMA, DEFAULTS, reviewMail } from './logic.js';
4
+
5
+ const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
6
+ const args = {
7
+ messages: fileArg('Email gateway message log under --root (Proofpoint, Mimecast, Defender for Office 365, Barracuda or any CSV, Excel or JSON): one row per message and recipient with direction, sender, verdict, action, allow-list flag, pull-back time and data-loss rule'),
8
+ settings: SETTINGS_ARG('outbound_spam_min, clawback_minutes, targeted_min, dlp_min'),
9
+ };
10
+
11
+ export const manifest = wireAgent({
12
+ pkg, prefix: 'email_gateway', title: 'Fairwire Email Gateway',
13
+ description: 'Reviews email security gateway logs: phishing or malware released from quarantine, allow-listed senders that sent threats, internal mailboxes sending spam, phishing pulled back late, the people targeted most and repeated data-loss rule hits. Addresses are masked for the model. Drafts notes; never releases or deletes mail.',
14
+ args, required: ['messages'],
15
+ sources: { messages: { label: 'Gateway messages', args: ['messages'], fields: MESSAGE_FIELDS } },
16
+ configSchemas: { email_gateway_settings: SETTINGS_SCHEMA },
17
+ run: (a, ctx) => reviewMail(ctx.records(a.messages, 'messages'), settingsFrom(a, ctx, 'email_gateway_settings', DEFAULTS)),
18
+ summary: (o) => `${o.messages} message(s), ${o.inbound} inbound (${o.quarantined_pct}% quarantined or blocked), ${o.outbound} outbound, ${o.threats} threat(s): ${o.open} open finding(s), ${o.high} high.`,
19
+ check: { title: 'Review the email gateway', description: 'Review the gateway log and list released threats, allow-list abuse, outbound spam, late pull-backs, targeted people and data-loss hits.' },
20
+ explain: { arg: 'address', argSchema: { type: 'string', maxLength: 300, description: 'Address or message id from email_gateway_check (a pseudonym is fine)' }, title: 'Explain one address or message', description: 'Every finding for one address or message.', match: (i, v, ctx) => i.key === v || i.subject === v || (ctx.pii && (ctx.pii.same(i.key, v, 'user') || ctx.pii.same(i.subject, v, 'user'))) },
21
+ report: {
22
+ title: 'Email gateway review', base: 'email-gateway',
23
+ limits: [LIMITS.files, 'Verdicts are the gateway\'s own; a message it missed is not in this review. Pair it with sign-in logs for compromised accounts.', 'Mail authentication records (SPF, DKIM, DMARC) are checked by the Fairbooks mail authentication agent, not here.', LIMITS.defaults, LIMITS.pii, LIMITS.live],
24
+ },
25
+ note: { noun: 'security_note', verb: 'send', category: 'binding_send', actor: 'the email security owner', to: 'security operations', subject: 'Email threats to follow up', ask: 'Please handle released threats and the suspected compromised mailbox today.' },
26
+ refused: [
27
+ { name: 'gateway_release_message', category: 'binding_send', description: 'Fairwire Email Gateway never releases, deletes or pulls back a message.' },
28
+ { name: 'gateway_change_allowlist', category: 'production_deploy', description: 'Fairwire Email Gateway never changes allow lists, block lists or policies.' },
29
+ ],
30
+ prompt: { title: 'Review the email gateway', description: 'Walks the host model through a gateway review with Fairwire Email Gateway.', text: 'You are helping a security lead review email gateway logs with fairwire-email-gateway. Addresses are pseudonyms. 1. Call email_gateway_check; lead with released threats and outbound spam. 2. Use email_gateway_explain for an address. 3. Call email_gateway_write_report (the file has real addresses). 4. Offer email_gateway_draft_security_note; email_gateway_request_send waits for one named click.' },
31
+ });