@arcis/node 1.5.2 → 1.6.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.
- package/README.md +48 -7
- package/dist/astro/index.js.map +1 -1
- package/dist/astro/index.mjs.map +1 -1
- package/dist/bun/index.js.map +1 -1
- package/dist/bun/index.mjs.map +1 -1
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/index.js +19 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +19 -1
- package/dist/core/index.mjs.map +1 -1
- package/dist/fastify/index.js.map +1 -1
- package/dist/fastify/index.mjs.map +1 -1
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/index.mjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +407 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +407 -9
- package/dist/index.mjs.map +1 -1
- package/dist/koa/index.js.map +1 -1
- package/dist/koa/index.mjs.map +1 -1
- package/dist/logging/index.js.map +1 -1
- package/dist/logging/index.mjs.map +1 -1
- package/dist/middleware/astro.d.ts +6 -1
- package/dist/middleware/astro.d.ts.map +1 -1
- package/dist/middleware/bun.d.ts +8 -1
- package/dist/middleware/bun.d.ts.map +1 -1
- package/dist/middleware/correlation.d.ts +87 -0
- package/dist/middleware/correlation.d.ts.map +1 -0
- package/dist/middleware/graphql.d.ts.map +1 -1
- package/dist/middleware/hono.d.ts +6 -0
- package/dist/middleware/hono.d.ts.map +1 -1
- package/dist/middleware/index.d.ts +3 -1
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +366 -8
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +366 -9
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/middleware/koa.d.ts +5 -0
- package/dist/middleware/koa.d.ts.map +1 -1
- package/dist/middleware/nextjs.d.ts +9 -1
- package/dist/middleware/nextjs.d.ts.map +1 -1
- package/dist/middleware/nuxt.d.ts +6 -1
- package/dist/middleware/nuxt.d.ts.map +1 -1
- package/dist/middleware/protect.d.ts +32 -0
- package/dist/middleware/protect.d.ts.map +1 -1
- package/dist/middleware/sveltekit.d.ts +6 -1
- package/dist/middleware/sveltekit.d.ts.map +1 -1
- package/dist/nestjs/index.js +55 -2
- package/dist/nestjs/index.js.map +1 -1
- package/dist/nestjs/index.mjs +55 -2
- package/dist/nestjs/index.mjs.map +1 -1
- package/dist/nextjs/index.js.map +1 -1
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/nuxt/index.js.map +1 -1
- package/dist/nuxt/index.mjs.map +1 -1
- package/dist/sanitizers/deserialization.d.ts +30 -0
- package/dist/sanitizers/deserialization.d.ts.map +1 -0
- package/dist/sanitizers/graphql.d.ts +20 -3
- package/dist/sanitizers/graphql.d.ts.map +1 -1
- package/dist/sanitizers/index.d.ts +2 -0
- package/dist/sanitizers/index.d.ts.map +1 -1
- package/dist/sanitizers/index.js +150 -7
- package/dist/sanitizers/index.js.map +1 -1
- package/dist/sanitizers/index.mjs +149 -8
- package/dist/sanitizers/index.mjs.map +1 -1
- package/dist/sanitizers/prompt-injection.d.ts.map +1 -1
- package/dist/sanitizers/sanitize.d.ts +0 -20
- package/dist/sanitizers/sanitize.d.ts.map +1 -1
- package/dist/stores/index.js.map +1 -1
- package/dist/stores/index.mjs.map +1 -1
- package/dist/sveltekit/index.js.map +1 -1
- package/dist/sveltekit/index.mjs.map +1 -1
- package/dist/validation/index.js +55 -2
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/index.mjs +55 -2
- package/dist/validation/index.mjs.map +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -4,17 +4,55 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@arcis/node)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Inside-the-app security middleware for Node.js. One line of code, 30+ attack vectors handled, zero runtime dependencies.**
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install @arcis/node
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { arcis } from '@arcis/node';
|
|
15
|
+
app.use(arcis({ block: true }));
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
That's it. XSS, SQL injection, NoSQL injection, command injection, path traversal, prototype pollution, SSTI, XXE, SSRF, CSRF, HPP, prompt injection (V32), modern deserialization markers (V33), GraphQL alias bomb (V34), bot detection (635 patterns), rate limiting, security headers, error scrubbing, and a stateful per-IP correlation window are all wired up before your handler runs.
|
|
19
|
+
|
|
20
|
+
**Docs**: [Quickstart](https://gagancm.github.io/arcis/documentation/getting-started.html) · [Detector reference](https://gagancm.github.io/arcis/documentation/detectors/) · [Framework adapters](https://gagancm.github.io/arcis/documentation/frameworks.html) · [Why Arcis](https://gagancm.github.io/arcis/documentation/why-arcis.html) · [Release notes](https://gagancm.github.io/arcis/documentation/release-notes.html)
|
|
21
|
+
|
|
22
|
+
**Part of the [Arcis](https://github.com/Gagancm/arcis) ecosystem.** Node + Python + Go SDKs at full parity from one shared specification. **2,116+ Node tests · 1,688+ Python · 483+ Go.** All passing in CI on every PR.
|
|
23
|
+
|
|
24
|
+
## Framework support
|
|
25
|
+
|
|
26
|
+
10 first-party framework adapters as subpath imports. The core sanitizers work standalone with any framework.
|
|
27
|
+
|
|
28
|
+
| Framework | Import | Status |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| Express | `import { arcis } from '@arcis/node'` | Built-in |
|
|
31
|
+
| Fastify | `@arcis/node/fastify` | Adapter |
|
|
32
|
+
| Koa | `@arcis/node/koa` | Adapter |
|
|
33
|
+
| Hono | `@arcis/node/hono` | Adapter |
|
|
34
|
+
| Next.js | `@arcis/node/nextjs` | Adapter |
|
|
35
|
+
| NestJS | `@arcis/node/nestjs` | Adapter |
|
|
36
|
+
| SvelteKit | `@arcis/node/sveltekit` | Adapter |
|
|
37
|
+
| Astro | `@arcis/node/astro` | Adapter |
|
|
38
|
+
| Nuxt | `@arcis/node/nuxt` | Adapter |
|
|
39
|
+
| Bun | `@arcis/node/bun` | Adapter |
|
|
40
|
+
|
|
41
|
+
## What's new in v1.6.0
|
|
10
42
|
|
|
11
|
-
**
|
|
43
|
+
- **NFKC normalization + multi-decode chain** at the top of `sanitizeString`. Fullwidth glyphs, encoded `<script>`, and triple-encoded payloads now match the same patterns as their plain forms.
|
|
44
|
+
- **Modern deserialization detection (V33)**: new `detectDeserialization(payload)` returns `'python_pickle'`, `'java_fastjson'`, `'php_unserialize'`, `'ruby_marshal'`, `'dotnet_binary_formatter'`, or `null`. Detection-only because the right response is to refuse the request, not strip the bytes.
|
|
45
|
+
- **GraphQL alias bomb + fragment cycle (V34)**: `graphqlGuard` accepts `maxAliases` (default 50) and `blockFragmentCycles` (default `true`). Brace-matched fragment dependency-graph walker catches self-reference and longer cycles.
|
|
46
|
+
- **Toolcall-injection patterns (V32)**: 5 new patterns in `detectPromptInjection` covering `"tool_call"` / `"function_call"` markers, ANSI escapes, Claude `<tool_use>` tags, tool-name spoofing.
|
|
47
|
+
- **`CorrelationWindow` middleware**: stateful per-IP rolling window (60s default) with scanner / credential-stuffing / race-window detection. Memory-capped at 10,000 IPs, 200 events per IP, LRU eviction.
|
|
48
|
+
- **`protectLogin / protectSignup / protectApi` correlation wireup**: pass `correlation: { window }` to the existing helper and the stack records each request and refuses on a detection hit.
|
|
49
|
+
- **Mutation tester**: 142 case-flip / URL-encode / HTML-entity / fullwidth variants ran against the XSS / SQLi / path corpora. Catches future pattern or normalization regressions that would re-open a bypass class.
|
|
12
50
|
|
|
13
|
-
## What
|
|
51
|
+
## What was new in v1.5.0
|
|
14
52
|
|
|
15
53
|
- **10 first-party framework adapters** — Express + Fastify (`@arcis/node/fastify`) + Koa (`@arcis/node/koa`) + Hono (`@arcis/node/hono`) + Next.js (`@arcis/node/nextjs`) + NestJS + SvelteKit + Astro + Nuxt + Bun. Each subpath import keeps the framework SDK as a type-only dependency.
|
|
16
|
-
- **
|
|
17
|
-
- **AI-era protections**: 28-signature prompt-injection library (`detectPromptInjection`), per-key `tokenBudget` middleware,
|
|
54
|
+
- **9 new attack vectors**: GraphQL depth-bombs (`graphqlGuard`), LDAP / XPath / email-header injection wired into block-mode, mass assignment (`massAssign`), HTTP method tampering (`methodAllowlist`), response splitting (`responseSplittingGuard`), event-loop overload (`eventLoopProtection`), SSRF DNS TOCTOU (`validateUrlAsync` + `pinnedDnsLookup` + `safeFollowRedirect`).
|
|
55
|
+
- **AI-era protections**: 28-signature prompt-injection library (`detectPromptInjection`), per-key `tokenBudget` middleware, 635-pattern bot corpus.
|
|
18
56
|
- **Composite helpers**: `protectLogin`, `protectSignup`, `protectApi`.
|
|
19
57
|
- **Dry-run / `onSanitize` mode**: observe attack surface without enforcing.
|
|
20
58
|
- **Guards API**: `arcis.guard({ input, context })` for queue consumers + agent tool handlers.
|
|
@@ -146,7 +184,10 @@ app.use('*', async (c, next) => {
|
|
|
146
184
|
| CORS Misconfiguration | Whitelist-based origins, `null` origin blocked, `Vary: Origin` enforced |
|
|
147
185
|
| Cookie Security | HttpOnly, Secure, SameSite enforced on all cookies |
|
|
148
186
|
| Rate Limiting | Per-IP, sliding window, token bucket, in-memory or Redis, `X-RateLimit-*` headers |
|
|
149
|
-
| Bot Detection |
|
|
187
|
+
| Bot Detection | 635 patterns, 7 categories (crawlers, scrapers, AI bots, etc.), behavioral signals |
|
|
188
|
+
| Deserialization (v1.6) | `detectDeserialization()` flags Python pickle, Java FastJSON `@type`, PHP `unserialize`, Ruby Marshal, .NET BinaryFormatter payloads |
|
|
189
|
+
| GraphQL Abuse | `graphqlGuard` with `maxDepth`, `maxAliases`, `blockIntrospection`, `blockFragmentCycles` (v1.6) |
|
|
190
|
+
| Stateful Correlation (v1.6) | `CorrelationWindow` detects scanners, credential stuffing, race-window probes per IP |
|
|
150
191
|
| CSRF | Double-submit cookie, token generation and validation |
|
|
151
192
|
| Security Headers | CSP, HSTS, X-Frame-Options, 10 headers out of the box |
|
|
152
193
|
| Input Validation | Type checking, ranges, enums, email (disposable blocklist, typo suggestions, MX verify), mass assignment prevention |
|