@roboteby/parry 2.0.0 → 2.0.1

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 (3) hide show
  1. package/CHANGELOG.md +6 -4
  2. package/README.md +67 -55
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -19,6 +19,8 @@ Versioning for public APIs and documented runtime behavior.
19
19
 
20
20
  ### Changed
21
21
 
22
+ - Raised the minimum supported Node.js version from `>=18` to `>=22`. The package
23
+ remains CommonJS and keeps Express `^5.2.1` as its peer dependency.
22
24
  - Made `createParry` and `ParryOptions` the recommended API names while retaining
23
25
  every existing public export and the deprecated `Parry_DDoS`/
24
26
  `Parry_DDoSOptions` aliases.
@@ -27,21 +29,21 @@ Versioning for public APIs and documented runtime behavior.
27
29
  removed, and aggregate severity uses the most severe finding.
28
30
  - Resolved trusted proxy chains from right to left and changed generated request
29
31
  IDs to `req_${crypto.randomUUID()}`.
30
- - Migrated tests to `node:test`/`node:assert`, ESLint 9 flat configuration, full
31
- Prettier checks, Node 18/20/22/24 CI, OIDC-only npm publishing, and an optional
32
+ - Migrated tests to `node:test`/`node:assert`, ESLint flat configuration, full
33
+ Prettier checks, GitHub Actions npm publishing with provenance, and an optional
32
34
  Terraform example under `infra/examples/aws`.
33
35
  - Updated repository metadata and links to `RobotEby/parry`.
34
36
 
35
37
  ### Security
36
38
 
37
- - **Intentional breaking behavior:** `createParryAdminRouter` no longer permits
39
+ - **Breaking change:** `createParryAdminRouter` no longer permits
38
40
  anonymous access by default. It fails during construction unless real auth is
39
41
  configured or insecure access is explicitly selected outside production.
40
42
  - In production, `allowInsecureAdminApi`, `auth.mode: "none"`, and legacy
41
43
  `requireAuth: false` are always rejected. Empty tokens and invalid IP/CIDR
42
44
  boundaries are rejected, and `verifyJwt: true` continues to fail explicitly.
43
45
  - Removed stale monitor-only fixtures for Command Injection and SSRF because
44
- Parry 1.x does not implement those detectors.
46
+ Parry does not implement those detectors.
45
47
 
46
48
  ## [1.1.1] - 2026-07-02
47
49
 
package/README.md CHANGED
@@ -4,23 +4,21 @@
4
4
  [![license](https://img.shields.io/npm/l/@roboteby/parry)](./LICENSE)
5
5
  [![node](https://img.shields.io/node/v/@roboteby/parry)](https://www.npmjs.com/package/@roboteby/parry)
6
6
 
7
- Application-layer security middleware for Express 5.
7
+ Application-layer security middleware for Express that combines abuse detection,
8
+ request guards, rate limiting, brute-force protection and security observability.
8
9
 
9
- Parry combines request-shape limits, heuristic SQL injection/XSS/NoSQL checks,
10
- HTTP parameter pollution and prototype/path traversal guards with rate limiting,
11
- route policies, brute-force protection, sanitized Threat Events, and an optional
12
- read-only Admin API. It is CommonJS and has no mandatory Redis dependency.
13
-
14
- The stable npm release is `1.1.1` on `latest`. The earlier `1.1.0-rc.1` remains
15
- available on the `rc` dist-tag; it is not the recommended installation.
10
+ The current stable release is `@roboteby/parry@2.0.0` on the npm `latest`
11
+ dist-tag.
16
12
 
17
13
  ## Install
18
14
 
19
15
  ```bash
20
- npm install @roboteby/parry
16
+ npm install @roboteby/parry express@^5.2.1
21
17
  ```
22
18
 
23
- Express `^5.2.1` is a peer dependency.
19
+ Parry 2 requires Node.js `>=22` and Express `^5.2.1`.
20
+
21
+ ## Minimal example
24
22
 
25
23
  ```js
26
24
  const express = require('express');
@@ -36,49 +34,59 @@ app.get('/health', (_req, res) => res.json({ ok: true }));
36
34
  app.listen(3000);
37
35
  ```
38
36
 
39
- Body parsers must run before Parry if request bodies should be inspected. Mount
40
- Parry before the routes it protects.
37
+ Body parsers must run before Parry when request bodies should be inspected.
38
+ Mount Parry before the routes it protects.
41
39
 
42
- ## Security boundaries
40
+ ## Main capabilities
43
41
 
44
- Parry is one application-layer control. It does not replace validation and
45
- parameterized queries in the application, output encoding and CSP in the browser,
46
- authentication/authorization, a reverse proxy, CDN/WAF, load balancer, or
47
- volumetric L3/L4 DDoS protection.
42
+ - Request Shape limits for depth, key count, array length and string length.
43
+ - Heuristic SQL injection and XSS detection, plus NoSQL operator guards.
44
+ - HTTP parameter pollution, prototype pollution and path traversal guards.
45
+ - Global and route-specific rate limiting.
46
+ - Brute-force counters and temporary blocks for authentication routes.
47
+ - Sanitized Threat Events, process-local metrics and an optional read-only Admin
48
+ API.
49
+ - In-memory state by default, with an optional `RedisStore` for shared protection
50
+ state.
51
+
52
+ ## Security boundaries
48
53
 
49
- SQLi and XSS detection is heuristic. The patterns are intentionally bounded and
50
- the Request Shape guard runs before heavier scans, but applications still need
51
- tests for their own traffic and false-positive profile. A clean Parry decision is
52
- not proof that input is safe for every downstream interpreter.
54
+ Parry is a defense-in-depth control for the Express application layer. It is not
55
+ a WAF and does not replace a CDN, reverse proxy, load balancer or volumetric
56
+ L3/L4 DDoS protection. It also does not replace authentication, authorization,
57
+ schema validation, parameterized queries, context-aware escaping/output
58
+ encoding or CSP.
53
59
 
54
- When `MemoryStore` is used, counters and bans exist only inside one Node.js
55
- process. `RedisStore` shares rate-limit and brute-force state across instances.
56
- Threat Events, the in-memory event buffer, and metrics remain local to each
57
- process unless the application exports them through `onEvent` or another
58
- observability integration.
60
+ SQLi and XSS detection is heuristic, so false positives and false negatives are
61
+ possible. Request Shape runs before heavier scans to bound their cost, but an
62
+ allowed request is not proof that its input is safe for downstream use.
59
63
 
60
- See [the security model](./docs/security-model.md) and [configuration](./docs/configuration.md).
64
+ Trusted proxy handling depends on narrow, correct `trustedProxies`
65
+ configuration. See the [security model](./docs/security-model.md) before enabling
66
+ forwarded-header trust.
61
67
 
62
68
  ## Public API
63
69
 
64
- The four recommended stable exports are:
70
+ The recommended root exports are:
65
71
 
66
- - `createParry(options)` — create a middleware instance and observability context;
67
- - `createParryAdminRouter(parry, options)` — create the optional read-only Admin router;
68
- - `MemoryStore` — single-process state store;
69
- - `RedisStore` — adapter for an application-owned Redis client.
72
+ - `createParry(options)` — creates the middleware and its observability context.
73
+ - `createParryAdminRouter(parry, options)` — creates the optional Admin router.
74
+ - `MemoryStore` — keeps protection state in one process.
75
+ - `RedisStore` — uses an application-owned Redis client for shared protection
76
+ state.
70
77
 
71
- All existing exports remain available. `Parry_DDoS(options)` is deprecated but
72
- kept as a compatibility wrapper around `createParry(options).middleware()`.
73
- `Parry_DDoSOptions` remains a deprecated TypeScript alias for `ParryOptions`.
78
+ Existing exports remain available. `Parry_DDoS(options)` is a deprecated
79
+ compatibility wrapper around `createParry(options).middleware()`, and
80
+ `Parry_DDoSOptions` is a deprecated TypeScript alias for `ParryOptions`.
74
81
 
75
- Advanced APIs have typed subpaths: `/core`, `/detectors`, `/stores`, `/policies`,
76
- `/brute-force`, `/events`, `/observability`, and `/admin`.
82
+ Advanced typed exports are available from `/core`, `/detectors`, `/stores`,
83
+ `/policies`, `/brute-force`, `/events`, `/observability` and `/admin`.
77
84
 
78
- ## Admin API is fail-closed
85
+ ## Admin API
79
86
 
80
- The Admin router now throws during construction when no authentication strategy
81
- is configured:
87
+ The Admin API exposes health, process metrics, recent sanitized events, active
88
+ bans and normalized policies. It is never mounted automatically and fails during
89
+ construction unless authentication is configured:
82
90
 
83
91
  ```js
84
92
  const { createParryAdminRouter } = require('@roboteby/parry');
@@ -94,19 +102,18 @@ app.use(
94
102
  );
95
103
  ```
96
104
 
97
- `allowInsecureAdminApi: true`, `auth.mode: 'none'`, and the legacy
98
- `requireAuth: false` alias are explicit local-development opt-ins. They warn and
99
- are rejected whenever `NODE_ENV=production`, even if an override is present.
100
- An empty token is invalid. External Cloudflare/ALB modes validate a trusted
101
- boundary but do not pretend that decoding a JWT is cryptographic verification;
102
- `verifyJwt: true` fails explicitly in this 1.x implementation.
105
+ Anonymous Admin access is an explicit local-development opt-in and is rejected
106
+ in production. External identity modes depend on a configured trusted boundary;
107
+ Parry does not perform cryptographic JWT/JWKS verification, and `verifyJwt: true`
108
+ fails explicitly.
103
109
 
104
- Full configuration and deployment patterns are in [Admin API](./docs/admin-api.md).
110
+ See [Admin API](./docs/admin-api.md) for authentication modes and deployment
111
+ guidance.
105
112
 
106
113
  ## Redis
107
114
 
108
- Create and connect the Redis client in the application; Parry never installs or
109
- owns a Redis package implicitly.
115
+ The application creates and connects the Redis client. Parry does not install or
116
+ own a Redis package implicitly.
110
117
 
111
118
  ```js
112
119
  const { createClient } = require('redis');
@@ -121,26 +128,31 @@ const parry = createParry({
121
128
  });
122
129
  ```
123
130
 
131
+ `RedisStore` shares rate-limit state, brute-force state, counters and related
132
+ bans/blocks across instances. Threat Events, the default event buffer and
133
+ metrics remain local to each process unless the application exports them.
134
+
124
135
  ## Runtime support
125
136
 
126
- The 1.x package keeps `engines.node >=18` and CI covers Node 18, 20, 22, and 24.
127
- Node 18 and 20 are legacy/EOL compatibility targets. Use Node 22 or 24 for new
128
- production deployments. Raising the minimum to Node 22 is reserved for v2. See
129
- the [official Node.js release schedule](https://nodejs.org/en/about/previous-releases).
137
+ - Node.js `>=22`
138
+ - Express `^5.2.1`
139
+ - CommonJS
140
+
141
+ CI covers Node.js 22 and 24. Parry 2 does not imply or announce an ESM migration.
130
142
 
131
143
  ## Documentation
132
144
 
133
145
  - [Configuration](./docs/configuration.md)
134
146
  - [Security model](./docs/security-model.md)
135
147
  - [Admin API](./docs/admin-api.md)
136
- - [Testing](./docs/testing.md)
137
148
  - [Deployment](./docs/deployment.md)
149
+ - [Testing](./docs/testing.md)
138
150
  - [Architecture](./docs/architecture.md)
139
151
  - [Releasing](./docs/releasing.md)
140
152
  - [OpenAPI contract](./docs/openapi/parry-admin-api.yaml)
141
153
  - [Generated payload regression report](./docs/payload-regression-report.md)
142
154
 
143
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for development workflow and
155
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for the development workflow and
144
156
  [SECURITY.md](./SECURITY.md) for vulnerability reporting.
145
157
 
146
158
  ## License
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@roboteby/parry",
3
- "version": "2.0.0",
4
- "description": "Application-layer security middleware for Express.js with injection detection, abuse mitigation, brute-force protection and distributed rate limiting.",
3
+ "version": "2.0.1",
4
+ "description": "Application-layer security middleware for Express that combines abuse detection, request guards, rate limiting, brute-force protection and security observability.",
5
5
  "main": "./src/index.js",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {