flare-redact 1.4.1 → 1.5.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 +91 -0
- package/README.md +107 -0
- package/SECURITY.md +36 -0
- package/bin/flare-gateway.mjs +6 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -1
- package/dist/detectors.d.ts +17 -0
- package/dist/detectors.d.ts.map +1 -1
- package/dist/detectors.js.map +1 -1
- package/dist/engine.d.ts +5 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +50 -7
- package/dist/engine.js.map +1 -1
- package/dist/gateway/body.d.ts +90 -0
- package/dist/gateway/body.d.ts.map +1 -0
- package/dist/gateway/body.js +185 -0
- package/dist/gateway/body.js.map +1 -0
- package/dist/gateway/cli.d.ts +26 -0
- package/dist/gateway/cli.d.ts.map +1 -0
- package/dist/gateway/cli.js +230 -0
- package/dist/gateway/cli.js.map +1 -0
- package/dist/gateway/config.d.ts +110 -0
- package/dist/gateway/config.d.ts.map +1 -0
- package/dist/gateway/config.js +212 -0
- package/dist/gateway/config.js.map +1 -0
- package/dist/gateway/index.d.ts +21 -0
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +21 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/runtime.d.ts +80 -0
- package/dist/gateway/runtime.d.ts.map +1 -0
- package/dist/gateway/runtime.js +0 -0
- package/dist/gateway/runtime.js.map +1 -0
- package/dist/gateway/server.d.ts +37 -0
- package/dist/gateway/server.d.ts.map +1 -0
- package/dist/gateway/server.js +560 -0
- package/dist/gateway/server.js.map +1 -0
- package/dist/pack.d.ts +88 -0
- package/dist/pack.d.ts.map +1 -0
- package/dist/pack.js +350 -0
- package/dist/pack.js.map +1 -0
- package/docker/Dockerfile +47 -0
- package/docker/README.md +219 -0
- package/docker/docker-compose.yml +55 -0
- package/docker/flare-gateway.example.json +48 -0
- package/package.json +27 -4
- package/spec/SPEC.md +469 -0
- package/spec/conformance/README.md +60 -0
- package/spec/conformance/cases.json +149 -0
- package/spec/conformance/expected.json +1683 -0
- package/spec/detectors.json +1812 -0
- package/spec/detectors.schema.json +196 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"spec": "FRS-1",
|
|
3
|
+
"pack": "flare-redact/core",
|
|
4
|
+
"description": "Inputs and options every FRS-1 engine must agree on. Expectations live in expected.json and are regenerated with `npm run spec:conformance`. Options use the JSON wire names (camelCase); a case with no `checks` is checked for both `redact` and `scan`.",
|
|
5
|
+
"cases": [
|
|
6
|
+
{ "name": "clean/plain-prose", "input": "the quick brown fox jumps over the lazy dog" },
|
|
7
|
+
{ "name": "clean/numbers", "input": "order 12345 shipped on 2026-08-05 for 42.50 EUR" },
|
|
8
|
+
{ "name": "clean/uuid", "input": "request 9f8b7a6c-5d4e-3f2a-1b0c-9d8e7f6a5b4c completed" },
|
|
9
|
+
|
|
10
|
+
{ "name": "email/basic", "input": "contact ada@example.com for access" },
|
|
11
|
+
{ "name": "email/multiple", "input": "ada@example.com, grace@example.org and alan@sub.example.co.uk" },
|
|
12
|
+
{ "name": "email/in-object", "input": { "user": { "email": "ada@example.com", "label": "primary" } } },
|
|
13
|
+
{ "name": "email/negative-at-only", "input": "meet me @ noon" },
|
|
14
|
+
|
|
15
|
+
{ "name": "aws/access-key", "input": "AWS key AKIAIOSFODNN7EXAMPLE in the config" },
|
|
16
|
+
{ "name": "aws/access-key-spaced", "input": "key AKIA IOSFODNN7EXAMPLE pasted from the console" },
|
|
17
|
+
{ "name": "aws/access-key-negative", "input": "AKIAIOSFODNN7EXAMPL is one character short" },
|
|
18
|
+
{ "name": "aws/secret-key", "input": "aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" },
|
|
19
|
+
|
|
20
|
+
{ "name": "github/classic-token", "input": "ghp_1234567890abcdefghijklmnopqrstuvwxyz" },
|
|
21
|
+
{ "name": "github/fine-grained", "input": "github_pat_11ABCDEFG0abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789ab" },
|
|
22
|
+
{ "name": "gitlab/token", "input": "CI_TOKEN glpat-ABCDEFGHIJKLMNOPQRST here" },
|
|
23
|
+
{ "name": "slack/token", "input": "xoxb-1234567890-abcdefghijklmnop" },
|
|
24
|
+
{ "name": "stripe/live-key", "input": "sk_live_abcdefghijklmnopqrstuvwx" },
|
|
25
|
+
{ "name": "stripe/webhook-secret", "input": "whsec_abcdefghijklmnopqrstuvwxyz012345" },
|
|
26
|
+
{ "name": "anthropic/key", "input": "sk-ant-api03-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" },
|
|
27
|
+
{ "name": "openai/key", "input": "sk-proj-abcdefghijklmnopqrstuvwxyz012345" },
|
|
28
|
+
{ "name": "openai/does-not-eat-anthropic", "input": "sk-ant-api03-BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "options": { "only": ["openai_key"] } },
|
|
29
|
+
{ "name": "openrouter/key", "input": "sk-or-v1-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" },
|
|
30
|
+
{ "name": "google/api-key", "input": "AIzaSyA0123456789abcdefghijklmnopqrstuvw" },
|
|
31
|
+
{ "name": "sendgrid/key", "input": "SG.abcdefghijklmnopqrst.0123456789abcdefghijklmnopqrstuvwx" },
|
|
32
|
+
{ "name": "twilio/key", "input": "ACde0123456789abcdef0123456789abcd" },
|
|
33
|
+
{ "name": "npm/token", "input": "npm_abcdefghijklmnopqrstuvwxyz0123456789" },
|
|
34
|
+
{ "name": "huggingface/token", "input": "hf_abcdefghijklmnopqrstuvwxyz0123456789" },
|
|
35
|
+
{ "name": "vault/hashicorp-token", "input": "hvs.CAESIJabcdefghijklmnopqrstuvwxyz0123456789" },
|
|
36
|
+
{ "name": "telegram/bot-token", "input": "123456789:AAHabcdefghijklmnopqrstuvwxyz0123456" },
|
|
37
|
+
{ "name": "discord/webhook", "input": "https://discord.com/api/webhooks/012345678901234567/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ab" },
|
|
38
|
+
{ "name": "azure/storage-key", "input": "AccountKey=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" },
|
|
39
|
+
{ "name": "gcp/service-account", "input": "{\"type\":\"service_account\",\"private_key_id\":\"0123456789abcdef0123456789abcdef01234567\"}" },
|
|
40
|
+
{ "name": "gcp/refresh-token", "input": "refresh 1//0abcdefghijklmnopqrstuvwxyz0123" },
|
|
41
|
+
{ "name": "sentry/dsn", "input": "SENTRY_DSN=https://0123456789abcdef0123456789abcdef@o1.ingest.sentry.io/12345" },
|
|
42
|
+
{ "name": "doppler/token", "input": "dp.st.dev.abcdefghijklmnopqrstuvwxyz0123456789ABCD" },
|
|
43
|
+
{ "name": "postman/key", "input": "PMAK-0123456789abcdef01234567-0123456789abcdef0123456789abcdef01" },
|
|
44
|
+
|
|
45
|
+
{ "name": "jwt/basic", "input": "Authorization eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U" },
|
|
46
|
+
{ "name": "bearer/header", "input": "Authorization: Bearer abcdefghijklmnopqrstuvwx" },
|
|
47
|
+
{ "name": "basic/header", "input": "Authorization: Basic YWRtaW46aHVudGVyMg==" },
|
|
48
|
+
{ "name": "url/credentials", "input": "DATABASE_URL=postgres://app:s3cr3t-pass@db.internal:5432/main" },
|
|
49
|
+
{ "name": "private-key/pem", "input": "-----BEGIN RSA PRIVATE KEY-----\nMIIBOgIBAAJBAKj34GkxFhD90vcNLYLInFEX6Ppy1tPf9Cnzj4p4WGeKLs1Pt8Qu\n-----END RSA PRIVATE KEY-----" },
|
|
50
|
+
|
|
51
|
+
{ "name": "assignment/english", "input": "password=hunter2000" },
|
|
52
|
+
{ "name": "assignment/quoted", "input": "client_secret: \"abcd-1234-efgh\"" },
|
|
53
|
+
{ "name": "assignment/chinese", "input": "密码: chao-ji-mi-mi" },
|
|
54
|
+
{ "name": "assignment/azerbaijani", "input": "şifrə = cox-gizli-parol" },
|
|
55
|
+
{ "name": "assignment/russian", "input": "пароль: ochen-sekretno" },
|
|
56
|
+
{ "name": "assignment/turkish", "input": "parola=gizli-anahtar-2026" },
|
|
57
|
+
{ "name": "assignment/too-short", "input": "pwd=abc" },
|
|
58
|
+
|
|
59
|
+
{ "name": "card/visa", "input": "card 4111 1111 1111 1111 charged" },
|
|
60
|
+
{ "name": "card/negative-luhn", "input": "card 4111 1111 1111 1112 declined" },
|
|
61
|
+
{ "name": "iban/de", "input": "transfer to DE89370400440532013000 today" },
|
|
62
|
+
{ "name": "iban/gb", "input": "IBAN GB82WEST12345698765432" },
|
|
63
|
+
{ "name": "iban/negative", "input": "code DE89370400440532013001 is not an IBAN" },
|
|
64
|
+
|
|
65
|
+
{ "name": "obfuscated-email/brackets", "input": "reach me at ada [at] example [dot] com" },
|
|
66
|
+
{ "name": "obfuscated-email/parens", "input": "grace (at) example (dot) org" },
|
|
67
|
+
|
|
68
|
+
{ "name": "keys/sensitive-object", "input": { "apiKey": "abc", "note": "safe", "password": "hunter2" } },
|
|
69
|
+
{ "name": "keys/multilingual-object", "input": { "wachtwoord": "geheim", "şifrə": "gizli", "密码": "mimi" } },
|
|
70
|
+
{ "name": "keys/nested-structure", "input": { "db": { "token": "t0ken", "url": "postgres://u:p@h/d" }, "list": ["ada@example.com", 42, true, null] } },
|
|
71
|
+
{ "name": "keys/disabled", "input": { "password": "hunter2" }, "options": { "redactKeys": false } },
|
|
72
|
+
|
|
73
|
+
{ "name": "evasion/zero-width-assignment", "input": "password=hunter2000" },
|
|
74
|
+
{ "name": "evasion/zero-width-email", "input": "mail ada@example.com now" },
|
|
75
|
+
|
|
76
|
+
{ "name": "allow/exact-value", "input": "support@example.com and ada@example.com", "options": { "allow": ["support@example.com"] } },
|
|
77
|
+
{ "name": "terms/plain", "input": "project Bluebird ships in Q3", "options": { "terms": ["Bluebird"] } },
|
|
78
|
+
{ "name": "terms/replacement", "input": "project Bluebird ships in Q3", "options": { "terms": { "Bluebird": "[PROJECT]" } } },
|
|
79
|
+
{ "name": "terms/word-boundary", "input": "Bluebirds are not Bluebird", "options": { "terms": ["Bluebird"] } },
|
|
80
|
+
{ "name": "terms/case-sensitive", "input": "bluebird and Bluebird", "options": { "terms": ["Bluebird"], "termsCaseSensitive": true } },
|
|
81
|
+
|
|
82
|
+
{ "name": "mode/label", "input": "ada@example.com", "options": { "mode": "label" } },
|
|
83
|
+
{ "name": "mode/hash", "input": "ada@example.com", "options": { "mode": "hash", "transformSecret": "conformance-key" } },
|
|
84
|
+
{ "name": "mode/pseudonym", "input": "ada@example.com", "options": { "mode": "pseudonym", "transformSecret": "conformance-key" } },
|
|
85
|
+
{ "name": "mode/surrogate-email", "input": "ada@example.com", "options": { "mode": "surrogate", "transformSecret": "conformance-key" } },
|
|
86
|
+
{ "name": "mode/surrogate-card", "input": "4111 1111 1111 1111", "options": { "mode": "surrogate", "transformSecret": "conformance-key" } },
|
|
87
|
+
{ "name": "mode/mask-string", "input": "ada@example.com and AKIAIOSFODNN7EXAMPLE", "options": { "mask": "<hidden>" } },
|
|
88
|
+
|
|
89
|
+
{ "name": "phone/e164", "input": "call me on +90 532 123 45 67 tomorrow", "options": { "enable": ["phone"] } },
|
|
90
|
+
{ "name": "phone/parenthesised", "input": "phone (555) 123-4567", "options": { "enable": ["phone"] } },
|
|
91
|
+
{ "name": "phone/negative-date", "input": "released on 07.24.2026 exactly", "options": { "enable": ["phone"] } },
|
|
92
|
+
{ "name": "network/ipv4", "input": "peer 192.168.1.10 connected", "options": { "enable": ["ipv4"] } },
|
|
93
|
+
{ "name": "network/ipv6", "input": "peer 2001:0db8:85a3:0000:0000:8a2e:0370:7334", "options": { "enable": ["ipv6"] } },
|
|
94
|
+
{ "name": "network/mac", "input": "nic 00:1b:44:11:3a:b7", "options": { "enable": ["mac_address"] } },
|
|
95
|
+
{ "name": "network/internal-url", "input": "see http://192.168.0.5:8080/admin for logs", "options": { "enable": ["internal_url"] } },
|
|
96
|
+
{ "name": "network/coordinates", "input": "last seen at 40.7128,-74.0060 yesterday", "options": { "enable": ["coordinates"] } },
|
|
97
|
+
|
|
98
|
+
{ "name": "entropy/enabled", "input": "value Zm9vYmFyYmF6cXV4MTIzNDU2Nzg5 stored", "options": { "enable": ["high_entropy"] } },
|
|
99
|
+
{ "name": "entropy/refined-uuid", "input": "commit 9f8b7a6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f00", "options": { "enable": ["high_entropy"], "refineConfidence": true, "minConfidence": 0.5 } },
|
|
100
|
+
{ "name": "entropy/refined-secret", "input": "api_key GkL3nQ7pRt2vXz9WbYc4Hs6MdF8jA1eU", "options": { "enable": ["high_entropy"], "refineConfidence": true, "minConfidence": 0.5 } },
|
|
101
|
+
|
|
102
|
+
{ "name": "id/us-ssn", "input": "SSN 123-45-6789 on file", "options": { "enable": ["us_ssn"] } },
|
|
103
|
+
{ "name": "id/tr-tckn", "input": "TCKN 10000000146", "options": { "enable": ["tr"] } },
|
|
104
|
+
{ "name": "id/br-cpf", "input": "CPF 529.982.247-25", "options": { "enable": ["br"] } },
|
|
105
|
+
{ "name": "id/es-dni", "input": "DNI 12345678Z", "options": { "enable": ["es"] } },
|
|
106
|
+
{ "name": "id/nl-bsn", "input": "BSN 111222333", "options": { "enable": ["nl"] } },
|
|
107
|
+
{ "name": "id/pl-pesel", "input": "PESEL 44051401359", "options": { "enable": ["pl"] } },
|
|
108
|
+
{ "name": "id/de-tax", "input": "IdNr 26954371827", "options": { "enable": ["de"] } },
|
|
109
|
+
{ "name": "id/it-codice-fiscale", "input": "CF RSSMRA85M01H501Q", "options": { "enable": ["it"] } },
|
|
110
|
+
{ "name": "id/ca-sin", "input": "SIN 046 454 286", "options": { "enable": ["ca"] } },
|
|
111
|
+
{ "name": "id/fr-nir", "input": "NIR 1 84 12 76 451 089 46", "options": { "enable": ["fr"] } },
|
|
112
|
+
{ "name": "id/in-aadhaar", "input": "Aadhaar 2345 6789 0124", "options": { "enable": ["in"] } },
|
|
113
|
+
{ "name": "id/au-tfn", "input": "TFN 123 456 782", "options": { "enable": ["au"] } },
|
|
114
|
+
{ "name": "id/cn-resident", "input": "ID 11010519491231002X", "options": { "enable": ["cn"] } },
|
|
115
|
+
{ "name": "id/jp-my-number", "input": "My Number 1234 5678 9018", "options": { "enable": ["jp"] } },
|
|
116
|
+
{ "name": "id/uk-nhs", "input": "NHS 943 476 5919", "options": { "enable": ["uk_nhs"] } },
|
|
117
|
+
{ "name": "id/vin", "input": "VIN 1HGBH41JXMN109186", "options": { "enable": ["vin"] } },
|
|
118
|
+
{ "name": "id/aba-routing", "input": "routing 021000021", "options": { "enable": ["aba_routing"] } },
|
|
119
|
+
{ "name": "id/negative-random-digits", "input": "sequence 123456789012 means nothing", "options": { "enable": ["pii", "id"] } },
|
|
120
|
+
|
|
121
|
+
{ "name": "crypto/eth-address", "input": "wallet 0x52908400098527886E0F7030069857D2E4169EE7", "options": { "enable": ["crypto"] } },
|
|
122
|
+
{ "name": "crypto/btc-address", "input": "send to 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "options": { "enable": ["crypto"] } },
|
|
123
|
+
|
|
124
|
+
{ "name": "contextual/person-name", "input": "full name: Grace Hopper", "options": { "enable": ["contextual"] } },
|
|
125
|
+
{ "name": "contextual/person-name-is", "input": "customer name is Ada Lovelace", "options": { "enable": ["contextual"] } },
|
|
126
|
+
{ "name": "contextual/street-address", "input": "address: 221 Baker Street", "options": { "enable": ["contextual"] } },
|
|
127
|
+
{ "name": "contextual/date-of-birth", "input": "date of birth: 1980-04-17", "options": { "enable": ["contextual"] } },
|
|
128
|
+
|
|
129
|
+
{ "name": "selection/only-email", "input": "ada@example.com AKIAIOSFODNN7EXAMPLE", "options": { "only": ["email"] } },
|
|
130
|
+
{ "name": "selection/disable-email", "input": "ada@example.com AKIAIOSFODNN7EXAMPLE", "options": { "disable": ["email"] } },
|
|
131
|
+
{ "name": "selection/only-tag", "input": "ada@example.com AKIAIOSFODNN7EXAMPLE", "options": { "only": ["pii"] } },
|
|
132
|
+
{ "name": "selection/min-confidence", "input": "call +90 532 123 45 67", "options": { "enable": ["phone"], "minConfidence": 0.95 } },
|
|
133
|
+
|
|
134
|
+
{ "name": "overlap/token-inside-assignment", "input": "api_key=ghp_1234567890abcdefghijklmnopqrstuvwxyz" },
|
|
135
|
+
{ "name": "overlap/entropy-versus-key", "input": "AKIAIOSFODNN7EXAMPLE", "options": { "enable": ["high_entropy"] } },
|
|
136
|
+
{ "name": "overlap/email-inside-url-credentials", "input": "https://ada@example.com:pw@host/path" },
|
|
137
|
+
|
|
138
|
+
{ "name": "structure/array-of-records", "input": [ { "email": "ada@example.com", "id": 1 }, { "email": "grace@example.org", "id": 2 } ] },
|
|
139
|
+
{ "name": "structure/scalars-preserved", "input": { "count": 7, "missing": null, "ok": true, "ratio": 0.5, "text": "ada@example.com" } },
|
|
140
|
+
{ "name": "structure/multiline-text", "input": "line one\npassword=hunter2000\nline three ada@example.com" },
|
|
141
|
+
|
|
142
|
+
{ "name": "include-values/scan", "input": "ada@example.com", "options": { "includeValues": true }, "checks": ["scan"] },
|
|
143
|
+
|
|
144
|
+
{ "name": "vault/round-trip", "input": "email ada@example.com and grace@example.org", "vault": { "placeholderStyle": "readable" }, "checks": ["vault"] },
|
|
145
|
+
{ "name": "vault/stable-placeholder", "input": "ada@example.com then ada@example.com again", "vault": { "placeholderStyle": "readable" }, "checks": ["vault"] },
|
|
146
|
+
{ "name": "vault/structured", "input": { "cc": ["grace@example.org"], "password": "hunter2", "to": "ada@example.com" }, "vault": { "placeholderStyle": "readable" }, "checks": ["vault"] },
|
|
147
|
+
{ "name": "vault/array-order", "input": ["ada@example.com", "grace@example.org", "ada@example.com"], "vault": { "placeholderStyle": "readable" }, "checks": ["vault"] }
|
|
148
|
+
]
|
|
149
|
+
}
|