@webdecoy/node 0.21.2 → 0.22.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 +203 -155
- package/dist/{chunk-HSG6RWOQ.mjs → chunk-FL7FXNYV.mjs} +483 -483
- package/dist/{chunk-NM4QG3XD.mjs → chunk-P7Z7XFK6.mjs} +221 -1
- package/dist/{index-GXXXr_mb.d.ts → detect-and-gate-BES1jZ8P.d.mts} +146 -1
- package/dist/{index-GXXXr_mb.d.mts → detect-and-gate-C7Uw14OR.d.ts} +146 -1
- package/dist/index.d.mts +4 -91
- package/dist/index.d.ts +4 -91
- package/dist/index.js +684 -613
- package/dist/index.mjs +16 -146
- package/dist/{sdk-FCU-Ce-1.d.mts → sdk-B8M-WYTc.d.mts} +2 -2
- package/dist/{sdk-FCU-Ce-1.d.ts → sdk-B8M-WYTc.d.ts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +246 -246
- package/dist/testing.mjs +1 -1
- package/dist/vercel.d.mts +42 -9
- package/dist/vercel.d.ts +42 -9
- package/dist/vercel.js +2784 -1
- package/dist/vercel.mjs +16 -3
- package/package.json +11 -1
package/dist/vercel.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as ClearanceGateOptions, C as ClearanceContext,
|
|
1
|
+
import { a as ClearanceGateOptions, C as ClearanceContext, D as DetectAndGateOptions, d as GateOutcome } from './detect-and-gate-BES1jZ8P.mjs';
|
|
2
|
+
import './sdk-B8M-WYTc.mjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
* WebDecoy
|
|
5
|
+
* WebDecoy for Vercel Routing Middleware, any framework.
|
|
5
6
|
*
|
|
6
7
|
* Astro, SvelteKit, Nuxt, Remix or a static site on Vercel: put this in
|
|
7
|
-
* `middleware.ts` at the project root
|
|
8
|
-
* WEBDECOY_SCANNER_ID and WEBDECOY_SENSOR_KEY in the project's environment.
|
|
8
|
+
* `middleware.ts` at the project root.
|
|
9
9
|
*
|
|
10
10
|
* ```ts
|
|
11
11
|
* // middleware.ts
|
|
@@ -17,10 +17,21 @@ import { a as ClearanceGateOptions, C as ClearanceContext, b as GateOutcome } fr
|
|
|
17
17
|
* };
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* It reads the project's environment:
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* - `WEBDECOY_API_KEY` turns on detection: the request is classified and bots
|
|
23
|
+
* are reported to WebDecoy, including the reserved test trigger
|
|
24
|
+
* (`curl -A "WebDecoy-Test/1.0" https://your-site/`).
|
|
25
|
+
* - `WEBDECOY_SITE_KEY`, `WEBDECOY_SCANNER_ID` and `WEBDECOY_SENSOR_KEY` turn on
|
|
26
|
+
* the clearance gate for the paths the site protects in WebDecoy.
|
|
27
|
+
*
|
|
28
|
+
* Either half works without the other, and with neither every request passes.
|
|
29
|
+
* Detection starts in monitor mode and the gate in whatever mode the site has
|
|
30
|
+
* in WebDecoy (monitor by default), so installing this changes no response
|
|
31
|
+
* until you choose to enforce. Every failure lets the request through.
|
|
32
|
+
*
|
|
33
|
+
* Next.js sites use `@webdecoy/nextjs/vercel`, the same middleware in Next's
|
|
34
|
+
* types.
|
|
24
35
|
*/
|
|
25
36
|
|
|
26
37
|
/**
|
|
@@ -34,9 +45,31 @@ import { a as ClearanceGateOptions, C as ClearanceContext, b as GateOutcome } fr
|
|
|
34
45
|
* nothing continues the request untouched.
|
|
35
46
|
*/
|
|
36
47
|
declare function toMiddlewareResponse(outcome: GateOutcome): Response | undefined;
|
|
37
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* The clearance gate alone, as Routing Middleware. Options default to the
|
|
50
|
+
* environment. Reports no detections; {@link createVercelMiddleware} does both.
|
|
51
|
+
*/
|
|
38
52
|
declare function clearanceMiddleware(options?: ClearanceGateOptions): (request: Request, context?: ClearanceContext) => Promise<Response | undefined>;
|
|
53
|
+
/**
|
|
54
|
+
* Detection and the clearance gate as Routing Middleware, for customizing
|
|
55
|
+
* what the default export does. Options default to the environment.
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* // middleware.ts
|
|
59
|
+
* import { createVercelMiddleware } from '@webdecoy/node/vercel';
|
|
60
|
+
* import { tripwire } from '@webdecoy/node';
|
|
61
|
+
*
|
|
62
|
+
* export default createVercelMiddleware({
|
|
63
|
+
* rules: [tripwire({ paths: ['/admin-backup.zip'] })],
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* export const config = { matcher: ['/((?!_astro/|favicon.ico).*)'] };
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* Without an API key it is exactly {@link clearanceMiddleware}.
|
|
70
|
+
*/
|
|
71
|
+
declare function createVercelMiddleware(options?: DetectAndGateOptions): (request: Request, context?: ClearanceContext) => Promise<Response | undefined>;
|
|
39
72
|
/** The middleware configured from WEBDECOY_* environment variables. */
|
|
40
73
|
declare const middleware: (request: Request, context?: ClearanceContext) => Promise<Response | undefined>;
|
|
41
74
|
|
|
42
|
-
export { ClearanceContext, ClearanceGateOptions, clearanceMiddleware, middleware as default, toMiddlewareResponse };
|
|
75
|
+
export { ClearanceContext, ClearanceGateOptions, DetectAndGateOptions, clearanceMiddleware, createVercelMiddleware, middleware as default, toMiddlewareResponse };
|
package/dist/vercel.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as ClearanceGateOptions, C as ClearanceContext,
|
|
1
|
+
import { a as ClearanceGateOptions, C as ClearanceContext, D as DetectAndGateOptions, d as GateOutcome } from './detect-and-gate-C7Uw14OR.js';
|
|
2
|
+
import './sdk-B8M-WYTc.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
* WebDecoy
|
|
5
|
+
* WebDecoy for Vercel Routing Middleware, any framework.
|
|
5
6
|
*
|
|
6
7
|
* Astro, SvelteKit, Nuxt, Remix or a static site on Vercel: put this in
|
|
7
|
-
* `middleware.ts` at the project root
|
|
8
|
-
* WEBDECOY_SCANNER_ID and WEBDECOY_SENSOR_KEY in the project's environment.
|
|
8
|
+
* `middleware.ts` at the project root.
|
|
9
9
|
*
|
|
10
10
|
* ```ts
|
|
11
11
|
* // middleware.ts
|
|
@@ -17,10 +17,21 @@ import { a as ClearanceGateOptions, C as ClearanceContext, b as GateOutcome } fr
|
|
|
17
17
|
* };
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* It reads the project's environment:
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* - `WEBDECOY_API_KEY` turns on detection: the request is classified and bots
|
|
23
|
+
* are reported to WebDecoy, including the reserved test trigger
|
|
24
|
+
* (`curl -A "WebDecoy-Test/1.0" https://your-site/`).
|
|
25
|
+
* - `WEBDECOY_SITE_KEY`, `WEBDECOY_SCANNER_ID` and `WEBDECOY_SENSOR_KEY` turn on
|
|
26
|
+
* the clearance gate for the paths the site protects in WebDecoy.
|
|
27
|
+
*
|
|
28
|
+
* Either half works without the other, and with neither every request passes.
|
|
29
|
+
* Detection starts in monitor mode and the gate in whatever mode the site has
|
|
30
|
+
* in WebDecoy (monitor by default), so installing this changes no response
|
|
31
|
+
* until you choose to enforce. Every failure lets the request through.
|
|
32
|
+
*
|
|
33
|
+
* Next.js sites use `@webdecoy/nextjs/vercel`, the same middleware in Next's
|
|
34
|
+
* types.
|
|
24
35
|
*/
|
|
25
36
|
|
|
26
37
|
/**
|
|
@@ -34,9 +45,31 @@ import { a as ClearanceGateOptions, C as ClearanceContext, b as GateOutcome } fr
|
|
|
34
45
|
* nothing continues the request untouched.
|
|
35
46
|
*/
|
|
36
47
|
declare function toMiddlewareResponse(outcome: GateOutcome): Response | undefined;
|
|
37
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* The clearance gate alone, as Routing Middleware. Options default to the
|
|
50
|
+
* environment. Reports no detections; {@link createVercelMiddleware} does both.
|
|
51
|
+
*/
|
|
38
52
|
declare function clearanceMiddleware(options?: ClearanceGateOptions): (request: Request, context?: ClearanceContext) => Promise<Response | undefined>;
|
|
53
|
+
/**
|
|
54
|
+
* Detection and the clearance gate as Routing Middleware, for customizing
|
|
55
|
+
* what the default export does. Options default to the environment.
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* // middleware.ts
|
|
59
|
+
* import { createVercelMiddleware } from '@webdecoy/node/vercel';
|
|
60
|
+
* import { tripwire } from '@webdecoy/node';
|
|
61
|
+
*
|
|
62
|
+
* export default createVercelMiddleware({
|
|
63
|
+
* rules: [tripwire({ paths: ['/admin-backup.zip'] })],
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* export const config = { matcher: ['/((?!_astro/|favicon.ico).*)'] };
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* Without an API key it is exactly {@link clearanceMiddleware}.
|
|
70
|
+
*/
|
|
71
|
+
declare function createVercelMiddleware(options?: DetectAndGateOptions): (request: Request, context?: ClearanceContext) => Promise<Response | undefined>;
|
|
39
72
|
/** The middleware configured from WEBDECOY_* environment variables. */
|
|
40
73
|
declare const middleware: (request: Request, context?: ClearanceContext) => Promise<Response | undefined>;
|
|
41
74
|
|
|
42
|
-
export { ClearanceContext, ClearanceGateOptions, clearanceMiddleware, middleware as default, toMiddlewareResponse };
|
|
75
|
+
export { ClearanceContext, ClearanceGateOptions, DetectAndGateOptions, clearanceMiddleware, createVercelMiddleware, middleware as default, toMiddlewareResponse };
|