@sandrobuilds/tracerney 0.10.0 → 0.10.1
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 +0 -73
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,17 +125,6 @@ All patterns are deterministic regex matches — **no behavioral changes, sub-mi
|
|
|
125
125
|
- **Structured threat metadata** — detailed fingerprints for audit trails and tracking
|
|
126
126
|
- **Advanced rate limiting** — prevents cost spikes with intelligent throttling
|
|
127
127
|
|
|
128
|
-
### Layer 1 Forensic Routing
|
|
129
|
-
|
|
130
|
-
Layer 1 is the Executioner for binary violations. It stops immediately — no tokens wasted, no second opinion needed. Layer 2 is only called when Layer 1 is inconclusive.
|
|
131
|
-
|
|
132
|
-
| Event | Action | Why |
|
|
133
|
-
|---|---|---|
|
|
134
|
-
| API Key / SSH Key | **Layer 1 stops immediately** | Binary. Zero legitimate export use-case. |
|
|
135
|
-
| Email / Phone / CC / SSN | **Layer 1 stops immediately** | Clear PII violation. No reasoning required. |
|
|
136
|
-
| Unauthorized Domain | **Layer 1 stops immediately** | Network boundary violation. Deterministic. |
|
|
137
|
-
| Complex Encoding / Obfuscation | **Escalated to Layer 2** | Probabilistic. Needs a brain to verify. |
|
|
138
|
-
|
|
139
128
|
## Layer 2: LLM Sentinel Deep Dive
|
|
140
129
|
|
|
141
130
|
Layer 2 adds advanced security with LLM Sentinel, an AI-powered verification system that analyzes LLM responses for injection patterns and validates output safety. Combines local pattern detection (Layer 1) with server-side verification for defense-in-depth protection.
|
|
@@ -237,68 +226,6 @@ The verify-prompt endpoint returns structured responses. Success (HTTP 200) incl
|
|
|
237
226
|
}
|
|
238
227
|
```
|
|
239
228
|
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## Egress Shield (Add-on)
|
|
243
|
-
|
|
244
|
-
Runs automatically inside `scanPrompt()` — no extra method needed. Every prompt is scanned for PII, secrets, and active exfiltration patterns before the injection check runs.
|
|
245
|
-
|
|
246
|
-
The SDK marks it `suspicious` and surfaces the label. You decide the penalty.
|
|
247
|
-
|
|
248
|
-
```typescript
|
|
249
|
-
const result = await tracer.scanPrompt(input);
|
|
250
|
-
|
|
251
|
-
if (result.suspicious) {
|
|
252
|
-
console.log(result.label); // "SUSPICIOUS_EGRESS" | "SUSPICIOUS_SECRET" | "SUSPICIOUS_PII"
|
|
253
|
-
console.log(result.reason); // "Detected 1 finding(s): Markdown Image with URL Query Params"
|
|
254
|
-
|
|
255
|
-
// Fintech — hard block
|
|
256
|
-
if (result.label === 'SUSPICIOUS_EGRESS') {
|
|
257
|
-
return NextResponse.json({ error: 'Security violation' }, { status: 400 });
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// Any app — log and continue
|
|
261
|
-
console.warn(`[${result.label}] ${result.reason}`);
|
|
262
|
-
}
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
### What it detects
|
|
266
|
-
|
|
267
|
-
**`SUSPICIOUS_EGRESS`** — Active exfiltration attempts
|
|
268
|
-
```
|
|
269
|
-

|
|
270
|
-
[Download](https://billing.io/track?data={"key":"secret"})
|
|
271
|
-
https://admin:password@prod.db.internal.com
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
**`SUSPICIOUS_SECRET`** — Credential leaks
|
|
275
|
-
```
|
|
276
|
-
sk-ant-api03-xxx... (Anthropic)
|
|
277
|
-
AKIAIOSFODNN7EXAMPLE (AWS)
|
|
278
|
-
sk_live_xxx... (Stripe)
|
|
279
|
-
ghp_xxx... (GitHub)
|
|
280
|
-
4111 1111 1111 1111 (Credit card)
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
**`SUSPICIOUS_PII`** — Personal data
|
|
284
|
-
```
|
|
285
|
-
sandro@example.com
|
|
286
|
-
(415) 867-5309
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
### The Suspicious Manifest
|
|
290
|
-
|
|
291
|
-
| Trigger | Label | Recommended action |
|
|
292
|
-
|---|---|---|
|
|
293
|
-
| Email / Phone | `SUSPICIOUS_PII` | Usually Redact |
|
|
294
|
-
| API Keys / SSH / CC / SSN | `SUSPICIOUS_SECRET` | Usually Block |
|
|
295
|
-
| External URL smuggling | `SUSPICIOUS_EGRESS` | Always Block |
|
|
296
|
-
| Zero-width / BiDi / Base64 | `SUSPICIOUS_ENCODING` | Audit / Block |
|
|
297
|
-
|
|
298
|
-
When multiple patterns fire, the highest-severity label wins — `SUSPICIOUS_EGRESS` always dominates.
|
|
299
|
-
|
|
300
|
-
---
|
|
301
|
-
|
|
302
229
|
## Production Usage
|
|
303
230
|
|
|
304
231
|
### Basic Setup (Layer 1 only)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sandrobuilds/tracerney",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Lightweight prompt injection detection with 933 patterns (259 core + 675 Garak). Layer 1 pattern matching (<0.021ms) + optional Layer 2 (AI verification). Runs 100% locally with zero data storage.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|