@samimcodes/ai-shield 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/README.md +41 -2
- package/dist/index.cjs +1489 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +47 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +1470 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware-DNRM5IlO.d.cts +657 -0
- package/dist/middleware-DNRM5IlO.d.ts +657 -0
- package/dist/middleware.cjs +1465 -0
- package/dist/middleware.cjs.map +1 -0
- package/dist/middleware.d.cts +3 -0
- package/dist/middleware.d.ts +3 -0
- package/dist/middleware.js +1448 -0
- package/dist/middleware.js.map +1 -0
- package/package.json +68 -4
package/README.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ai-shield
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Enterprise-grade Express.js & TypeScript middleware that protects web applications from unauthorized AI crawlers by feeding them synthetic poisoned data while preserving SEO for legitimate search engines.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
├── core/
|
|
10
|
+
│ ├── detector.ts # Bot fingerprinting engine (UA patterns, IP ranges, TLS JA3)
|
|
11
|
+
│ ├── poison.ts # Synthetic data generator — plausible but misleading content
|
|
12
|
+
│ └── honeypot.ts # Invisible trap routes and link injection
|
|
13
|
+
├── types/
|
|
14
|
+
│ └── index.ts # All shared TypeScript interfaces & enums
|
|
15
|
+
├── middleware.ts # Main Express middleware factory (createAiShield)
|
|
16
|
+
└── server.ts # Demo Express application
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Threat Model
|
|
20
|
+
|
|
21
|
+
| Bot Category | Examples | Strategy |
|
|
22
|
+
|-----------------|-----------------------------------|-----------------------|
|
|
23
|
+
| AI Crawlers | GPTBot, Claude-Web, CCBot | 200 OK + poisoned data|
|
|
24
|
+
| Scrapers | ByteSpider, PetalBot, DataForSEO | 200 OK + honeypot |
|
|
25
|
+
| Good Bots | Googlebot, Bingbot, DuckDuckBot | Pass-through (SEO) |
|
|
26
|
+
| Human Traffic | Browsers, curl (dev) | Pass-through |
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install
|
|
32
|
+
npm run dev # tsx watch — hot reload
|
|
33
|
+
npm run build # tsc compile → dist/
|
|
34
|
+
npm test # vitest run
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Design Principles
|
|
38
|
+
|
|
39
|
+
1. **Stealth over rejection** — Never send 403/429 to AI bots; feed them convincing garbage.
|
|
40
|
+
2. **Zero false positives** — Legitimate Googlebots are never intercepted.
|
|
41
|
+
3. **Pluggable detectors** — Add custom UA patterns or IP ranges at runtime.
|
|
42
|
+
4. **Zero runtime overhead** — Detection is O(1) via pre-compiled RegExp sets.
|