diff --git a/README.md b/README.md index 5eb5ff9..0a624b3 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,18 @@ [Quick start](#quick-start--no-api-key) · [Choose your framework](#choose-your-framework) · [Verify a detection](#verify-your-first-detection) · [SDK documentation](https://docs.webdecoy.com/sdk-plugins/node-sdk/?utm_source=github&utm_medium=readme&utm_campaign=node_sdk_install) · [Examples](#examples) +## Try it in your browser + +**[Open the Express playground in StackBlitz](https://stackblitz.com/github/WebDecoy/node/tree/main/playgrounds/express?file=app.mjs)** · **[Watch the 30-second demo](https://youtu.be/4jeuH3tKeos)** + +Send an ordinary request, then a decoy request. Inspect the actual HTTP response +and local tripwire verdict. Start in monitor mode; enable enforcement explicitly +in the playground to compare the response. No WebDecoy account or API key required. +StackBlitz runs the standalone Express example in a browser Node.js runtime. +See the [playground source and local alternative](playgrounds/express/README.md). + +[![Watch the WebDecoy Express demo: send a request and inspect the decision](docs/assets/node-demo.png)](https://youtu.be/4jeuH3tKeos) + ## What you can do | Need | Start here | diff --git a/docs/assets/node-demo.png b/docs/assets/node-demo.png new file mode 100644 index 0000000..1ae49dc Binary files /dev/null and b/docs/assets/node-demo.png differ diff --git a/package.json b/package.json index de1c4e7..2a21442 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,11 @@ "build": "turbo run build", "dev": "turbo run dev", "lint": "turbo run lint", - "test": "turbo run test", + "test": "turbo run test && npm run test:playground", "clean": "turbo run clean && rm -rf node_modules", "format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", - "check:edge": "npm run check:edge -w @webdecoy/node -w @webdecoy/nextjs -w @webdecoy/hono" + "check:edge": "npm run check:edge -w @webdecoy/node -w @webdecoy/nextjs -w @webdecoy/hono", + "test:playground": "npm ci --prefix playgrounds/express --ignore-scripts --no-audit --no-fund && npm test --prefix playgrounds/express" }, "devDependencies": { "@changesets/cli": "^2.27.1", diff --git a/packages/webdecoy/README.md b/packages/webdecoy/README.md index aa9a8dc..27a64ab 100644 --- a/packages/webdecoy/README.md +++ b/packages/webdecoy/README.md @@ -11,6 +11,8 @@ TypeScript bot detection and protection for Node.js and edge runtimes. Run honey Full documentation: [docs.webdecoy.com/sdk-plugins/node-sdk](https://docs.webdecoy.com/sdk-plugins/node-sdk/). Copy-paste install snippets for every stack: [docs.webdecoy.com/installation/install-with-ai](https://docs.webdecoy.com/installation/install-with-ai/). +**[Try the Express playground in your browser](https://stackblitz.com/github/WebDecoy/node/tree/main/playgrounds/express?file=app.mjs)** · [Watch the 30-second demo](https://youtu.be/4jeuH3tKeos) + ## Using a framework? Install its adapter Most apps should install a framework adapter alongside this package. The adapters handle request mapping, client IP, monitor mode and honeytoken injection for you. Install `@webdecoy/node` too: it is where `tripwire()`, `rateLimit()` and the other rules are imported from. diff --git a/playgrounds/express/.stackblitzrc b/playgrounds/express/.stackblitzrc new file mode 100644 index 0000000..09e22c0 --- /dev/null +++ b/playgrounds/express/.stackblitzrc @@ -0,0 +1,3 @@ +{ + "startCommand": "npm run dev" +} diff --git a/playgrounds/express/README.md b/playgrounds/express/README.md new file mode 100644 index 0000000..747728e --- /dev/null +++ b/playgrounds/express/README.md @@ -0,0 +1,48 @@ +# WebDecoy Express playground + +[Open in StackBlitz](https://stackblitz.com/github/WebDecoy/node/tree/main/playgrounds/express?file=app.mjs) +· [Watch the 30-second demo](https://youtu.be/4jeuH3tKeos) + +Send a real Express request, inspect the SDK's tripwire decision, and compare +monitoring with enforcement. No WebDecoy account or API key required. Browser +runtime startup and dependency installation may take a moment. + +1. Open the preview and click **Send ordinary request**: HTTP200, `ALLOW`. +2. Click **Send decoy request**: HTTP404, `DENY`, `tripwire: true`. +3. Check **Enable enforcement for this demo**, then send the decoy again: HTTP403. +4. Send the ordinary request again: HTTP200. + +The monitor response comes from our demo route; the enforce response comes from +the real SDK before that route runs. Status alone is not a detection receipt. + +## Run locally + +Requires Node.js 20+ and npm. Download this folder (it is standalone) or, from a +repository checkout: + +```bash +cd playgrounds/express +npm ci --workspaces=false +npm run dev +``` + +Open `http://127.0.0.1:3000`. Run `npm test` for the real HTTP checks. The folder +pins published SDK packages and has its own lockfile, with no monorepo imports or +build step. If browser restrictions prevent WebContainers from starting, use +this local path; see [StackBlitz browser support](https://developer.stackblitz.com/platform/webcontainers/browser-support). + +## What to bring to your app + +See `app.mjs`: import `webdecoy` and `tripwire`, then mount middleware before your +routes. The two routers isolate the playground's monitor and enforce fixtures; +your real app should start with monitor mode. The preview renders actual JSON +responses with `textContent`; it does not generate synthetic SDK verdicts. + +This is a controlled path-matching example. A hit does not establish malicious +intent: legitimate scanners and prefetchers may fetch decoys. Exposed verdicts +are for this demo; keep operational details server-side in your own app. This +keyless example does not send detections to the hosted dashboard or verify AI +agent identities. + +[Full Express setup](https://docs.webdecoy.com/sdk-plugins/express/) +· [Separate AI-agent verification guide](https://github.com/WebDecoy/node/blob/main/docs/verify-ai-agents-web-bot-auth.md) diff --git a/playgrounds/express/app.mjs b/playgrounds/express/app.mjs new file mode 100644 index 0000000..b6af5e0 --- /dev/null +++ b/playgrounds/express/app.mjs @@ -0,0 +1,35 @@ +import express from 'express'; +import { fileURLToPath } from 'node:url'; +import { webdecoy } from '@webdecoy/express'; +import { tripwire } from '@webdecoy/node'; + +// This is a controlled, keyless fixture. Decision details are exposed only so +// visitors can inspect the demo; keep such details server-side in a real app. +function probeRouter(mode) { + const router = express.Router(); + router.use(webdecoy({ + mode, + rules: [tripwire({ paths: ['/demo-decoy'], includeDefaults: false })], + })); + const reply = (req, res, status) => res.status(status).json({ + mode, + path: req.path, + decision: { + conclusion: req.webdecoyDecision?.conclusion, + tripwire: req.webdecoyDecision?.deniedBy('tripwire') ?? false, + }, + }); + router.get('/', (req, res) => reply(req, res, 200)); + router.get('/demo-decoy', (req, res) => reply(req, res, 404)); + return router; +} + +export function createApp() { + const app = express(); + app.disable('x-powered-by'); + app.use('/monitor', probeRouter('monitor')); + // A separate fixture, selected explicitly by the playground visitor. + app.use('/enforce', probeRouter('enforce')); + app.use(express.static(fileURLToPath(new URL('./public/', import.meta.url)))); + return app; +} diff --git a/playgrounds/express/app.test.mjs b/playgrounds/express/app.test.mjs new file mode 100644 index 0000000..8120fbb --- /dev/null +++ b/playgrounds/express/app.test.mjs @@ -0,0 +1,29 @@ +import assert from 'node:assert/strict'; +import { once } from 'node:events'; +import { test } from 'node:test'; +import { createApp } from './app.mjs'; + +test('real middleware preserves monitoring responses and blocks only the enforced decoy', async () => { + const server = createApp().listen(0, '127.0.0.1'); + await once(server, 'listening'); + const base = `http://127.0.0.1:${server.address().port}`; + try { + for (const mode of ['monitor', 'enforce']) { + const normal = await fetch(`${base}/${mode}/`); + assert.equal(normal.status, 200); + assert.deepEqual((await normal.json()).decision, { conclusion: 'ALLOW', tripwire: false }); + } + const monitored = await fetch(`${base}/monitor/demo-decoy`); + assert.equal(monitored.status, 404); + assert.deepEqual((await monitored.json()).decision, { conclusion: 'DENY', tripwire: true }); + const blocked = await fetch(`${base}/enforce/demo-decoy`); + assert.equal(blocked.status, 403); + assert.equal((await blocked.json()).rule, 'tripwire'); + const home = await fetch(base); + assert.equal(home.status, 200); + assert.match(await home.text(), /Enable enforcement for this demo/); + assert.equal((await fetch(`${base}/playground.js`)).status, 200); + } finally { + await new Promise((resolve, reject) => server.close(e => e ? reject(e) : resolve())); + } +}); diff --git a/playgrounds/express/package-lock.json b/playgrounds/express/package-lock.json new file mode 100644 index 0000000..ce88745 --- /dev/null +++ b/playgrounds/express/package-lock.json @@ -0,0 +1,869 @@ +{ + "name": "webdecoy-express-playground", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "webdecoy-express-playground", + "version": "0.1.0", + "dependencies": { + "@webdecoy/express": "0.22.3", + "@webdecoy/node": "0.22.3", + "express": "4.22.3" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@webdecoy/express": { + "version": "0.22.3", + "resolved": "https://registry.npmjs.org/@webdecoy/express/-/express-0.22.3.tgz", + "integrity": "sha512-rtZlXSqB6J5rsYrJ+oaidcsDcPoecmYtpTlxHWhLoxTEA/+g95NApLGLfTgvD+bDY2/UX8Vqa0mdIqq+eDv/7g==", + "license": "MIT", + "dependencies": { + "@webdecoy/node": "^0.22.3" + }, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "express": "^4.18.0 || ^5.0.0" + } + }, + "node_modules/@webdecoy/node": { + "version": "0.22.3", + "resolved": "https://registry.npmjs.org/@webdecoy/node/-/node-0.22.3.tgz", + "integrity": "sha512-Sf2IYTH5da3AX+BasGQgEIUc4r6CHdKJw/nOO3j4AtNQjt5RMtuOum8JIi/424LnDxl/yZkGCScSkQSnp0Yosw==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/body-parser": { + "version": "1.20.9", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.9.tgz", + "integrity": "sha512-FISIQxV5u91Y9gvuFq3q/tA/qTqLJn3AhRcEvyozyhJTh5OBFFtv827AdHU7Rbyct4r+Ba1/99oFa1Y3yuFsdw==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.16.0", + "raw-body": "~2.5.3", + "type-is": "~1.6.18", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.2.tgz", + "integrity": "sha512-ddmxiyS6ETq/v5/+mdA4fykK7JgEmqcShrGmQFTaKf5o43tL8XLuMzNLLsspuIC3/qGupS7Ci2TF+feJRkYY0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.22.3", + "resolved": "https://registry.npmjs.org/express/-/express-4.22.3.tgz", + "integrity": "sha512-Bdcs4+3qlpVlx2NRn6fgX2Ue2/gGRaPeawebgclM0ERSCqDpA+owF1fdPwjJUTAJWMTuAaxjDf+hzb0/4eKvvw==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "~1.20.5", + "content-disposition": "~0.5.4", + "content-type": "~1.0.4", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "~0.1.13", + "proxy-addr": "~2.0.7", + "qs": "~6.16.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "~0.19.0", + "serve-static": "~1.16.2", + "setprototypeof": "1.2.0", + "statuses": "~2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "statuses": "~2.0.2", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz", + "integrity": "sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz", + "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==", + "license": "MIT" + }, + "node_modules/proxy-addr": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz", + "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/qs": { + "version": "6.16.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.2.tgz", + "integrity": "sha512-VYdnB5S7/0IeXzBacUtwNAaM6d7Y/PgYnNC7bJCI6meqA/OgnsQbZMtVW8Dt2D1PHgbHGtYmhSoEIgvt7xZ2ZA==", + "license": "BSD-3-Clause", + "dependencies": { + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", + "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.4.1", + "range-parser": "~1.2.1", + "statuses": "~2.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serve-static": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", + "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "~0.19.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + } + } +} diff --git a/playgrounds/express/package.json b/playgrounds/express/package.json new file mode 100644 index 0000000..6f07441 --- /dev/null +++ b/playgrounds/express/package.json @@ -0,0 +1,18 @@ +{ + "name": "webdecoy-express-playground", + "version": "0.1.0", + "private": true, + "type": "module", + "description": "Try real WebDecoy bot tripwire decisions in Express, without an API key", + "scripts": { + "dev": "node server.mjs", + "start": "node server.mjs", + "test": "node --test app.test.mjs" + }, + "dependencies": { + "@webdecoy/express": "0.22.3", + "@webdecoy/node": "0.22.3", + "express": "4.22.3" + }, + "engines": { "node": ">=20" } +} diff --git a/playgrounds/express/public/index.html b/playgrounds/express/public/index.html new file mode 100644 index 0000000..5b02539 --- /dev/null +++ b/playgrounds/express/public/index.html @@ -0,0 +1,42 @@ + + + + + + + Try bot detection in Express | WebDecoy + + + + +
+
WebDecoy / Node.jsLOCAL RULES · FREE TO TRY
+
+

EXPRESS BOT DETECTION PLAYGROUND

+

Send a request.
See the decision.

+

Run a bot tripwire without an account or API key. These buttons send real requests to Express and show the WebDecoy verdict.

+
+
+
+
01 / CHOOSE A MODEMONITOR
+ +

Monitor records rule decisions and preserves the route response.

+
+

Start with the ordinary request, then compare the decoy. Enable enforcement to see the decoy return HTTP 403.

+
+
+
02 / INSPECT THE RESPONSEREADY
+

Your request will appear here.

+
Run a request to see its HTTP response
+and the local rule decision.
+

A monitor-mode DENY verdict does not itself block the request.

+
+
+
+

ADD IT TO YOUR APP

Keep the rules.
Make them yours.

+
npm i @webdecoy/express @webdecoy/node

Mount the middleware before your routes and inspect req.webdecoyDecision. Review your traffic before enabling enforcement.

+
+ +
+ + diff --git a/playgrounds/express/public/logo.png b/playgrounds/express/public/logo.png new file mode 100644 index 0000000..da48dc2 Binary files /dev/null and b/playgrounds/express/public/logo.png differ diff --git a/playgrounds/express/public/playground.js b/playgrounds/express/public/playground.js new file mode 100644 index 0000000..67acb43 --- /dev/null +++ b/playgrounds/express/public/playground.js @@ -0,0 +1,48 @@ +const enforce = document.querySelector('#enforce'); +const badge = document.querySelector('#mode-badge'); +const help = document.querySelector('#mode-help'); +const buttons = [...document.querySelectorAll('[data-probe]')]; +const status = document.querySelector('#http-status'); +const requestPath = document.querySelector('#request-path'); +const output = document.querySelector('#response-body'); +const explanation = document.querySelector('#result-explanation'); + +enforce.addEventListener('change', () => { + badge.textContent = enforce.checked ? 'ENFORCE' : 'MONITOR'; + help.textContent = enforce.checked + ? 'Enforcement stops the decoy before its route runs. Ordinary traffic still passes.' + : 'Monitor records rule decisions and preserves the route response.'; +}); + +for (const button of buttons) button.addEventListener('click', async () => { + const mode = enforce.checked ? 'enforce' : 'monitor'; + const target = button.dataset.probe; + const path = target === 'decoy' ? '/demo-decoy' : '/'; + buttons.forEach(b => { b.disabled = true; }); + enforce.disabled = true; + requestPath.textContent = `GET ${path} · ${mode} mode`; + status.textContent = 'SENDING'; + output.textContent = 'Waiting for Express…'; + explanation.textContent = ''; + const controller = new AbortController(); + const timeout = setTimeout(() => controller.abort(), 8000); + try { + const response = await fetch(`/${mode}${path}`, { signal: controller.signal, cache: 'no-store' }); + const body = await response.json(); + status.textContent = `HTTP ${response.status}`; + output.textContent = JSON.stringify(body, null, 2); + explanation.textContent = response.status === 403 + ? 'The SDK blocked this controlled decoy request before its Express route ran.' + : body.decision?.tripwire + ? 'The tripwire matched. Monitor mode preserved the demo route’s HTTP 404 response.' + : 'This ordinary request did not match the configured tripwire.'; + } catch (error) { + status.textContent = 'REQUEST FAILED'; + output.textContent = error.name === 'AbortError' ? 'The request timed out.' : 'Could not reach the playground server.'; + explanation.textContent = 'Check that npm run dev is running, then retry.'; + } finally { + clearTimeout(timeout); + buttons.forEach(b => { b.disabled = false; }); + enforce.disabled = false; + } +}); diff --git a/playgrounds/express/public/style.css b/playgrounds/express/public/style.css new file mode 100644 index 0000000..dfc47f1 --- /dev/null +++ b/playgrounds/express/public/style.css @@ -0,0 +1 @@ +:root{color-scheme:dark;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:#0b0e14;color:#f7f7fa;font-synthesis:none;--pink:#ef479e;--muted:#aab3c3;--border:#303746}*{box-sizing:border-box}body{margin:0}main{max-width:1200px;padding:28px 34px 32px;margin:auto}header{display:flex;justify-content:space-between;align-items:center;gap:24px}.brand{display:flex;align-items:center;gap:10px;font-weight:750;font-size:20px;text-decoration:none;color:inherit}.brand span{font-weight:400;color:var(--muted)}.local,.eyebrow,.step{font:11px ui-monospace,SFMono-Regular,monospace;letter-spacing:1.7px}.local{color:var(--muted)}.intro{padding:64px 0 35px}.eyebrow{color:var(--pink);font-weight:700}h1{font-size:clamp(44px,7vw,76px);line-height:1.03;letter-spacing:-3px;margin:20px 0 22px}h1 span{color:var(--pink)}.lede{color:var(--muted);font-size:18px;line-height:1.6;max-width:660px;margin:0}.workspace{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--border);border-radius:18px;overflow:hidden}.controls,.result{padding:28px}.controls{background:#121721}.result{background:#0f131b;border-left:1px solid var(--border)}.mode-heading,.result-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.step{color:var(--muted);font-size:10px}#mode-badge,#http-status{font:11px ui-monospace,monospace;color:var(--pink);background:#261626;border:1px solid #57304b;border-radius:5px;padding:6px 9px;white-space:nowrap}.switch{display:flex;align-items:center;gap:10px;font-size:15px;font-weight:650;line-height:1.5;margin-top:28px;cursor:pointer}input{accent-color:var(--pink);width:18px;height:18px;flex:none}#mode-help,.hint,#result-explanation{font-size:13px;color:var(--muted);line-height:1.65}#mode-help{min-height:43px}.actions{display:grid;gap:12px;margin:25px 0}button{appearance:none;border:1px solid #414958;border-radius:9px;background:#1b2330;color:#fff;padding:15px 17px;text-align:left;font:inherit;font-size:15px;font-weight:650;cursor:pointer;display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}button span{font:12px ui-monospace,monospace;opacity:.8;align-self:center}button.primary{background:#b72870;border-color:#d7468e}button:hover{filter:brightness(1.15)}button:disabled{cursor:wait;opacity:.55}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #f7b8d8;outline-offset:4px}.hint{margin-bottom:0}#request-path{font:12px ui-monospace,monospace;color:var(--muted);margin:25px 0 18px}pre{margin:0;font:13px/1.65 ui-monospace,SFMono-Regular,monospace;white-space:pre-wrap;overflow-wrap:anywhere;min-height:185px}#result-explanation{border-top:1px solid var(--border);padding-top:15px;min-height:55px}.install{display:grid;grid-template-columns:.8fr 1.2fr;gap:32px;padding:42px 0;border-bottom:1px solid var(--border)}h2{font-size:31px;line-height:1.15;letter-spacing:-1px;margin:14px 0 0}.install-detail>code{display:block;border:1px solid var(--border);border-radius:9px;padding:17px;color:#f4c4dc;font:12px/1.6 ui-monospace,monospace;overflow-wrap:anywhere}.install-detail p{font-size:13px;line-height:1.7;color:var(--muted)}nav{display:flex;gap:20px;flex-wrap:wrap}a{color:#f3a6ce;text-underline-offset:4px}nav a{font-size:13px}footer{padding-top:20px;color:#8e98aa;font-size:11px;line-height:1.8;max-width:950px}@media(max-width:700px){main{padding:22px 20px}.local{display:none}.intro{padding-top:42px}h1{letter-spacing:-2px}.workspace,.install{grid-template-columns:1fr}.result{border-left:0;border-top:1px solid var(--border)}.controls,.result{padding:22px}.install{gap:22px}.brand{font-size:18px}pre{min-height:140px}} diff --git a/playgrounds/express/server.mjs b/playgrounds/express/server.mjs new file mode 100644 index 0000000..cdbc798 --- /dev/null +++ b/playgrounds/express/server.mjs @@ -0,0 +1,6 @@ +import { createApp } from './app.mjs'; +const port = Number(process.env.PORT || 3000); +createApp().listen(port, '127.0.0.1', () => { + console.log(`WebDecoy playground: http://127.0.0.1:${port}`); + console.log('Open the preview, then send an ordinary or decoy request. No API key required.'); +});