Skip to content

Commit c552d38

Browse files
authored
Merge #2: document tripwire deception + rules engine in README
docs: document tripwire deception + rules engine in README
2 parents 998561c + d7bf670 commit c552d38

2 files changed

Lines changed: 87 additions & 1 deletion

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ Thumbs.db
3636
npm-debug.log*
3737
yarn-debug.log*
3838
yarn-error.log*
39+
40+
# harness (botasaurus) run artifacts
41+
packages/webdecoy/output/

README.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Advanced bot detection and protection for Node.js applications with TLS fingerpr
88
## Features
99

1010
- **Advanced Bot Detection** - Detect automated tools, scrapers, and malicious bots
11+
- **Tripwire Deception** - Deterministic, zero-false-positive honeypot links & paths that catch stealth scrapers by *intent* (going where a human can't) — even ones built to defeat browser fingerprinting
1112
- **TLS Fingerprinting** - JA3 and JA4 fingerprint analysis for deeper inspection
1213
- **Two-Tier Analysis** - Fast local checks + comprehensive server-side verification
1314
- **Smart Decision Making** - Allow, block, or challenge based on threat level
@@ -21,6 +22,9 @@ Advanced bot detection and protection for Node.js applications with TLS fingerpr
2122
|---------|---------|-------------|
2223
| [@webdecoy/node](https://www.npmjs.com/package/@webdecoy/node) | [![npm](https://img.shields.io/npm/v/@webdecoy/node.svg)](https://www.npmjs.com/package/@webdecoy/node) | Core SDK for Node.js |
2324
| [@webdecoy/express](https://www.npmjs.com/package/@webdecoy/express) | [![npm](https://img.shields.io/npm/v/@webdecoy/express.svg)](https://www.npmjs.com/package/@webdecoy/express) | Express.js middleware |
25+
| [@webdecoy/fastify](https://www.npmjs.com/package/@webdecoy/fastify) | [![npm](https://img.shields.io/npm/v/@webdecoy/fastify.svg)](https://www.npmjs.com/package/@webdecoy/fastify) | Fastify plugin |
26+
| [@webdecoy/nextjs](https://www.npmjs.com/package/@webdecoy/nextjs) | [![npm](https://img.shields.io/npm/v/@webdecoy/nextjs.svg)](https://www.npmjs.com/package/@webdecoy/nextjs) | Next.js middleware |
27+
| [@webdecoy/client](https://www.npmjs.com/package/@webdecoy/client) | [![npm](https://img.shields.io/npm/v/@webdecoy/client.svg)](https://www.npmjs.com/package/@webdecoy/client) | Browser-side signal collector |
2428

2529
## Quick Start
2630

@@ -56,6 +60,64 @@ if (!result.allowed) {
5660
}
5761
```
5862

63+
## Tripwire Deception
64+
65+
Fingerprint-based detection loses to purpose-built stealth scrapers (e.g. [botasaurus](https://github.com/omkarcloud/botasaurus)) that present a genuine browser fingerprint. **Tripwires win a different fight:** a hidden honeypot link or path that a real user can never reach — so any request for it is automated *by construction*. It's deterministic, **zero-false-positive**, and needs **no API key**.
66+
67+
```typescript
68+
import { WebDecoy, tripwire, honeytoken } from '@webdecoy/node';
69+
70+
// A hidden decoy link + the path it points at
71+
const trap = honeytoken();
72+
73+
const webdecoy = new WebDecoy({
74+
rules: [
75+
// Block any request to the honeytoken path, plus built-in scanner-bait
76+
// paths (/.env, /.git/config, /wp-config.php, ...)
77+
tripwire({ paths: [trap.path] }),
78+
],
79+
});
80+
81+
// Inject the (invisible, nofollow) decoy link into your HTML. Real users never
82+
// see or click it; a link-following scraper requests it and is blocked.
83+
html = html.replace('</body>', `${trap.linkHtml}</body>`);
84+
```
85+
86+
A tripwire hit makes `protect()` return `allowed: false` and reports a violation — enforced automatically by the Express/Fastify/Next middleware (403), no extra code. Register your own paths, prefixes, or patterns too:
87+
88+
```typescript
89+
tripwire({
90+
paths: ['/admin-backup.zip'],
91+
prefixes: ['/.git/'],
92+
patterns: [/\/wp-admin\//],
93+
includeDefaults: true, // built-in scanner-bait paths (default: true)
94+
action: 'DENY', // or 'THROTTLE'
95+
dryRun: false, // log only, don't block (observe before enforcing)
96+
});
97+
```
98+
99+
> Tripwires are one of the SDK's **rules**, alongside [`rateLimit()`](#rules) and `filter()` — all evaluated locally before any server call.
100+
101+
## Rules
102+
103+
Rules run locally (no API key required) before any server verification; the first `DENY`/`THROTTLE` wins and short-circuits the request.
104+
105+
```typescript
106+
import { WebDecoy, rateLimit, tripwire, filter } from '@webdecoy/node';
107+
108+
const webdecoy = new WebDecoy({
109+
rules: [
110+
rateLimit({ max: 100, window: 60 }), // 100 req / 60s per IP
111+
tripwire({ paths: ['/.env', '/wp-config.php'] }), // honeypot paths
112+
filter({ expression: 'ip.tor or ip.vpn', action: 'DENY' }), // needs apiKey (IP enrichment)
113+
],
114+
});
115+
```
116+
117+
- **`rateLimit({ max, window, algorithm?, action?, keyBy? })`** — fixed or sliding window, keyed by IP (or a custom function).
118+
- **`tripwire({ paths?, prefixes?, patterns?, includeDefaults? })`** — deterministic honeypot-path detection (see [Tripwire Deception](#tripwire-deception)).
119+
- **`filter({ expression, action? })`** — an expression language over IP reputation/geo (e.g. `ip.tor`, `ip.country in ["CN", "RU"]`); requires an API key for enrichment.
120+
59121
## Framework Integrations
60122

61123
### Express.js
@@ -121,7 +183,11 @@ const webdecoy = new WebDecoy({
121183

122184
## How It Works
123185

124-
Web Decoy uses a two-tier detection system:
186+
Web Decoy uses a layered detection system:
187+
188+
### Tier 0: Tripwires (Deterministic)
189+
190+
Requests for hidden honeypot paths are blocked immediately, before any scoring — a zero-false-positive signal that catches stealth scrapers fingerprinting misses. See [Tripwire Deception](#tripwire-deception).
125191

126192
### Tier 1: Local Analysis (Fast)
127193

@@ -213,9 +279,26 @@ import type {
213279
TLSInfo,
214280
LocalAnalysis,
215281
SDKDetectionRequest,
282+
// Rules & deception
283+
Rule,
284+
RateLimitConfig,
285+
FilterConfig,
286+
TripwireConfig,
287+
Honeytoken,
288+
HoneytokenOptions,
216289
} from '@webdecoy/node';
217290
```
218291

292+
### `tripwire(config?)` / `honeytoken(options?)`
293+
294+
Deterministic honeypot-path detection. `tripwire()` returns a `Rule` for the
295+
`rules` array; `honeytoken()` returns `{ path, linkHtml }` — a hidden decoy link
296+
and the tripwire path it points at. See [Tripwire Deception](#tripwire-deception).
297+
298+
### `rateLimit(config)` / `filter(config)`
299+
300+
Additional local rules for the `rules` array. See [Rules](#rules).
301+
219302
## Getting an API Key
220303

221304
1. Sign up at [app.webdecoy.com](https://app.webdecoy.com)

0 commit comments

Comments
 (0)