@arcis/node 1.3.0 → 1.4.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/dist/core/{index.d.mts → constants.d.ts} +21 -70
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/errors.d.ts +53 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/index.d.ts +6 -168
- package/dist/core/index.d.ts.map +1 -0
- package/dist/{types-BOkx5YJc.d.mts → core/types.d.ts} +27 -30
- package/dist/core/types.d.ts.map +1 -0
- package/dist/index.d.ts +71 -166
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -3
- package/dist/index.mjs.map +1 -1
- package/dist/logging/index.d.ts +4 -36
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/{index.d.mts → redactor.d.ts} +5 -9
- package/dist/logging/redactor.d.ts.map +1 -0
- package/dist/middleware/bot-detection.d.ts +86 -0
- package/dist/middleware/bot-detection.d.ts.map +1 -0
- package/dist/middleware/cookies.d.ts +48 -0
- package/dist/middleware/cookies.d.ts.map +1 -0
- package/dist/middleware/cors.d.ts +65 -0
- package/dist/middleware/cors.d.ts.map +1 -0
- package/dist/middleware/csrf.d.ts +109 -0
- package/dist/middleware/csrf.d.ts.map +1 -0
- package/dist/middleware/error-handler.d.ts +43 -0
- package/dist/middleware/error-handler.d.ts.map +1 -0
- package/dist/middleware/headers.d.ts +29 -0
- package/dist/middleware/headers.d.ts.map +1 -0
- package/dist/middleware/hpp.d.ts +56 -0
- package/dist/middleware/hpp.d.ts.map +1 -0
- package/dist/middleware/index.d.ts +16 -3
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +6 -1
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +6 -1
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/middleware/main.d.ts +40 -0
- package/dist/middleware/main.d.ts.map +1 -0
- package/dist/middleware/rate-limit-sliding.d.ts +46 -0
- package/dist/middleware/rate-limit-sliding.d.ts.map +1 -0
- package/dist/middleware/rate-limit-token.d.ts +51 -0
- package/dist/middleware/rate-limit-token.d.ts.map +1 -0
- package/dist/middleware/rate-limit.d.ts +34 -0
- package/dist/middleware/rate-limit.d.ts.map +1 -0
- package/dist/sanitizers/command.d.ts +28 -0
- package/dist/sanitizers/command.d.ts.map +1 -0
- package/dist/sanitizers/encode.d.ts +46 -0
- package/dist/sanitizers/encode.d.ts.map +1 -0
- package/dist/sanitizers/headers.d.ts +46 -0
- package/dist/sanitizers/headers.d.ts.map +1 -0
- package/dist/sanitizers/index.d.ts +17 -22
- package/dist/sanitizers/index.d.ts.map +1 -0
- package/dist/sanitizers/jsonp.d.ts +34 -0
- package/dist/sanitizers/jsonp.d.ts.map +1 -0
- package/dist/sanitizers/nosql.d.ts +31 -0
- package/dist/sanitizers/nosql.d.ts.map +1 -0
- package/dist/sanitizers/path.d.ts +28 -0
- package/dist/sanitizers/path.d.ts.map +1 -0
- package/dist/sanitizers/pii.d.ts +80 -0
- package/dist/sanitizers/pii.d.ts.map +1 -0
- package/dist/sanitizers/prototype.d.ts +34 -0
- package/dist/sanitizers/prototype.d.ts.map +1 -0
- package/dist/sanitizers/sanitize.d.ts +51 -0
- package/dist/sanitizers/sanitize.d.ts.map +1 -0
- package/dist/sanitizers/sql.d.ts +28 -0
- package/dist/sanitizers/sql.d.ts.map +1 -0
- package/dist/sanitizers/ssti.d.ts +20 -0
- package/dist/sanitizers/ssti.d.ts.map +1 -0
- package/dist/sanitizers/utils.d.ts +19 -0
- package/dist/sanitizers/utils.d.ts.map +1 -0
- package/dist/sanitizers/xss.d.ts +35 -0
- package/dist/sanitizers/xss.d.ts.map +1 -0
- package/dist/sanitizers/xxe.d.ts +20 -0
- package/dist/sanitizers/xxe.d.ts.map +1 -0
- package/dist/stores/index.d.ts +6 -104
- package/dist/stores/index.d.ts.map +1 -0
- package/dist/stores/memory.d.ts +35 -0
- package/dist/stores/memory.d.ts.map +1 -0
- package/dist/stores/{index.d.mts → redis.d.ts} +6 -45
- package/dist/stores/redis.d.ts.map +1 -0
- package/dist/utils/duration.d.ts +34 -0
- package/dist/utils/duration.d.ts.map +1 -0
- package/dist/utils/fingerprint.d.ts +64 -0
- package/dist/utils/fingerprint.d.ts.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +188 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +182 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/ip.d.ts +70 -0
- package/dist/utils/ip.d.ts.map +1 -0
- package/dist/validation/email.d.ts +82 -0
- package/dist/validation/email.d.ts.map +1 -0
- package/dist/validation/file.d.ts +90 -0
- package/dist/validation/file.d.ts.map +1 -0
- package/dist/validation/index.d.ts +10 -3
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/redirect.d.ts +64 -0
- package/dist/validation/redirect.d.ts.map +1 -0
- package/dist/validation/schema.d.ts +36 -0
- package/dist/validation/schema.d.ts.map +1 -0
- package/dist/validation/url.d.ts +65 -0
- package/dist/validation/url.d.ts.map +1 -0
- package/package.json +8 -6
- package/dist/encode-CrQCGlBq.d.mts +0 -484
- package/dist/encode-jl9sOwmA.d.ts +0 -484
- package/dist/index-BAhgn9V2.d.ts +0 -532
- package/dist/index-BGNKspqH.d.ts +0 -340
- package/dist/index-Cd02z-0j.d.mts +0 -340
- package/dist/index-DgJtWMSj.d.mts +0 -532
- package/dist/index.d.mts +0 -175
- package/dist/middleware/index.d.mts +0 -3
- package/dist/sanitizers/index.d.mts +0 -24
- package/dist/types-BOkx5YJc.d.ts +0 -279
- package/dist/validation/index.d.mts +0 -3
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { g as arcis, h as arcisFunction, i as botProtection, j as createCors, k as createCsrf, l as createErrorHandler, m as createHeaders, n as createRateLimiter, o as createSecureCookies, p as createSlidingWindowLimiter, q as createTokenBucketLimiter, r as csrfProtection, h as default, s as detectBot, t as enforceSecureCookie, u as errorHandler, v as generateCsrfToken, w as rateLimit, x as safeCors, y as secureCookieDefaults, z as securityHeaders, A as validateCsrfToken } from '../index-DgJtWMSj.mjs';
|
|
2
|
-
import '../types-BOkx5YJc.mjs';
|
|
3
|
-
import 'express';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export { c as createSanitizer, d as detectCommandInjection, a as detectHeaderInjection, b as detectJsonpInjection, e as detectNoSqlInjection, f as detectPathTraversal, g as detectPii, h as detectPrototypePollution, i as detectSql, j as detectSsti, k as detectXss, l as detectXxe, m as encodeForAttribute, n as encodeForCss, o as encodeForHtml, p as encodeForJs, q as encodeForUrl, r as getDangerousOperators, s as getDangerousProtoKeys, t as isDangerousNoSqlKey, u as isDangerousProtoKey, v as redactObjectPii, w as redactPii, x as sanitizeCommand, y as sanitizeHeaderValue, z as sanitizeHeaders, A as sanitizeJsonpCallback, B as sanitizeObject, C as sanitizePath, D as sanitizeSql, E as sanitizeSsti, F as sanitizeString, G as sanitizeXss, H as sanitizeXxe, I as scanObjectPii, J as scanPii } from '../encode-CrQCGlBq.mjs';
|
|
2
|
-
import 'express';
|
|
3
|
-
import '../types-BOkx5YJc.mjs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @module @arcis/node/sanitizers/utils
|
|
7
|
-
* Shared utilities for sanitizers
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Encodes HTML entities to prevent interpretation as markup.
|
|
11
|
-
*
|
|
12
|
-
* @param str - The string to encode
|
|
13
|
-
* @returns The encoded string
|
|
14
|
-
*/
|
|
15
|
-
declare function encodeHtmlEntities(str: string): string;
|
|
16
|
-
/**
|
|
17
|
-
* Checks if a value is a plain object (not null, array, Date, etc.)
|
|
18
|
-
*
|
|
19
|
-
* @param value - Value to check
|
|
20
|
-
* @returns True if plain object
|
|
21
|
-
*/
|
|
22
|
-
declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
23
|
-
|
|
24
|
-
export { encodeHtmlEntities, isPlainObject };
|
package/dist/types-BOkx5YJc.d.ts
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import { Request, RequestHandler, Response, NextFunction } from 'express';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @module @arcis/node/core/types
|
|
5
|
-
* All TypeScript interfaces and types for Arcis
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/** Main Arcis configuration options */
|
|
9
|
-
interface ArcisOptions {
|
|
10
|
-
/** Enable/configure input sanitization. Default: true */
|
|
11
|
-
sanitize?: boolean | SanitizeOptions;
|
|
12
|
-
/** Enable/configure rate limiting. Default: true */
|
|
13
|
-
rateLimit?: boolean | RateLimitOptions;
|
|
14
|
-
/** Enable/configure security headers. Default: true */
|
|
15
|
-
headers?: boolean | HeaderOptions;
|
|
16
|
-
/** Enable/configure safe logging. Default: true */
|
|
17
|
-
logging?: boolean | LogOptions;
|
|
18
|
-
}
|
|
19
|
-
/** Sanitization configuration */
|
|
20
|
-
interface SanitizeOptions {
|
|
21
|
-
/** Sanitize XSS attempts. Default: true */
|
|
22
|
-
xss?: boolean;
|
|
23
|
-
/** Sanitize SQL injection attempts. Default: true */
|
|
24
|
-
sql?: boolean;
|
|
25
|
-
/** Sanitize NoSQL injection attempts. Default: true */
|
|
26
|
-
nosql?: boolean;
|
|
27
|
-
/** Sanitize path traversal attempts. Default: true */
|
|
28
|
-
path?: boolean;
|
|
29
|
-
/** Protect against prototype pollution. Default: true */
|
|
30
|
-
proto?: boolean;
|
|
31
|
-
/** Sanitize command injection attempts. Default: true */
|
|
32
|
-
command?: boolean;
|
|
33
|
-
/** Maximum input size in bytes. Default: 1000000 (1MB) */
|
|
34
|
-
maxSize?: number;
|
|
35
|
-
/**
|
|
36
|
-
* How to handle detected SQL and command injection threats.
|
|
37
|
-
* - 'reject': Throw SecurityThreatError (returns 400). Recommended for APIs. Default.
|
|
38
|
-
* - 'sanitize': Strip/replace threats in-place. Use only when rejection is not feasible.
|
|
39
|
-
*/
|
|
40
|
-
mode?: 'sanitize' | 'reject';
|
|
41
|
-
/**
|
|
42
|
-
* HTML-encode output after XSS stripping.
|
|
43
|
-
* Enable for SSR/template rendering. Do NOT enable for JSON REST APIs
|
|
44
|
-
* — it corrupts stored data with HTML entities. Default: false.
|
|
45
|
-
*/
|
|
46
|
-
htmlEncode?: boolean;
|
|
47
|
-
/** Freeze sanitized objects with Object.freeze() to prevent mutation. Default: false */
|
|
48
|
-
freeze?: boolean;
|
|
49
|
-
}
|
|
50
|
-
/** Result of sanitizing a string */
|
|
51
|
-
interface SanitizeResult {
|
|
52
|
-
/** The sanitized value */
|
|
53
|
-
value: string;
|
|
54
|
-
/** Whether any sanitization was applied */
|
|
55
|
-
wasSanitized: boolean;
|
|
56
|
-
/** Details about detected threats */
|
|
57
|
-
threats: ThreatInfo[];
|
|
58
|
-
}
|
|
59
|
-
/** Information about a detected threat */
|
|
60
|
-
interface ThreatInfo {
|
|
61
|
-
/** Type of threat detected */
|
|
62
|
-
type: ThreatType;
|
|
63
|
-
/** Pattern that matched */
|
|
64
|
-
pattern: string;
|
|
65
|
-
/** Original matched content */
|
|
66
|
-
original: string;
|
|
67
|
-
/** Location in the input (if applicable) */
|
|
68
|
-
location?: string;
|
|
69
|
-
}
|
|
70
|
-
/** Types of security threats */
|
|
71
|
-
type ThreatType = 'xss' | 'sql_injection' | 'nosql_injection' | 'path_traversal' | 'command_injection' | 'prototype_pollution' | 'header_injection' | 'ssti' | 'xxe';
|
|
72
|
-
/** Rate limiting configuration */
|
|
73
|
-
interface RateLimitOptions {
|
|
74
|
-
/** Maximum requests per window. Default: 100 */
|
|
75
|
-
max?: number;
|
|
76
|
-
/** Window size in milliseconds. Default: 60000 (1 minute) */
|
|
77
|
-
windowMs?: number;
|
|
78
|
-
/** Error message when limit exceeded */
|
|
79
|
-
message?: string;
|
|
80
|
-
/** HTTP status code for rate limited responses. Default: 429 */
|
|
81
|
-
statusCode?: number;
|
|
82
|
-
/** Function to generate rate limit key from request */
|
|
83
|
-
keyGenerator?: (req: Request) => string;
|
|
84
|
-
/** Function to skip rate limiting for certain requests */
|
|
85
|
-
skip?: (req: Request) => boolean;
|
|
86
|
-
/** Optional external store for distributed rate limiting */
|
|
87
|
-
store?: RateLimitStore;
|
|
88
|
-
}
|
|
89
|
-
/** External store interface for distributed rate limiting */
|
|
90
|
-
interface RateLimitStore {
|
|
91
|
-
/** Get current count for a key */
|
|
92
|
-
get(key: string): Promise<RateLimitEntry | null>;
|
|
93
|
-
/** Set entry for a key */
|
|
94
|
-
set(key: string, entry: RateLimitEntry): Promise<void>;
|
|
95
|
-
/** Increment count for a key */
|
|
96
|
-
increment(key: string): Promise<number>;
|
|
97
|
-
/** Decrement count for a key (for sliding window) */
|
|
98
|
-
decrement?(key: string): Promise<void>;
|
|
99
|
-
/** Reset count for a key */
|
|
100
|
-
reset?(key: string): Promise<void>;
|
|
101
|
-
/** Close the store (cleanup connections) */
|
|
102
|
-
close?(): Promise<void>;
|
|
103
|
-
}
|
|
104
|
-
/** Rate limit entry stored in a store */
|
|
105
|
-
interface RateLimitEntry {
|
|
106
|
-
/** Number of requests in the current window */
|
|
107
|
-
count: number;
|
|
108
|
-
/** Timestamp when the window resets */
|
|
109
|
-
resetTime: number;
|
|
110
|
-
}
|
|
111
|
-
/** Result from incrementing a rate limit counter */
|
|
112
|
-
interface RateLimitResult {
|
|
113
|
-
/** Current request count */
|
|
114
|
-
count: number;
|
|
115
|
-
/** When the window resets */
|
|
116
|
-
resetTime: Date;
|
|
117
|
-
}
|
|
118
|
-
/** Rate limiter middleware with cleanup support */
|
|
119
|
-
interface RateLimiterMiddleware extends RequestHandler {
|
|
120
|
-
/** Clean up the rate limiter (clear intervals, close stores) */
|
|
121
|
-
close: () => void;
|
|
122
|
-
}
|
|
123
|
-
/** Security headers configuration */
|
|
124
|
-
interface HeaderOptions {
|
|
125
|
-
/** Content Security Policy. true = default, string = custom, false = disabled */
|
|
126
|
-
contentSecurityPolicy?: boolean | string;
|
|
127
|
-
/** Enable X-XSS-Protection header. Default: true (sends '0' to disable legacy XSS auditor) */
|
|
128
|
-
xssFilter?: boolean;
|
|
129
|
-
/** Enable X-Content-Type-Options: nosniff. Default: true */
|
|
130
|
-
noSniff?: boolean;
|
|
131
|
-
/** X-Frame-Options value. Default: 'DENY' */
|
|
132
|
-
frameOptions?: 'DENY' | 'SAMEORIGIN' | false;
|
|
133
|
-
/** HSTS configuration. Default: true */
|
|
134
|
-
hsts?: boolean | HstsOptions;
|
|
135
|
-
/** Referrer-Policy value. Default: 'strict-origin-when-cross-origin' */
|
|
136
|
-
referrerPolicy?: string | false;
|
|
137
|
-
/** Permissions-Policy value */
|
|
138
|
-
permissionsPolicy?: string | false;
|
|
139
|
-
/** Cache-Control configuration. Default: true (no-cache) */
|
|
140
|
-
cacheControl?: boolean | string;
|
|
141
|
-
/** Cross-Origin-Opener-Policy value. Default: 'same-origin'. false to disable. */
|
|
142
|
-
crossOriginOpenerPolicy?: string | false;
|
|
143
|
-
/** Cross-Origin-Resource-Policy value. Default: 'same-origin'. false to disable. */
|
|
144
|
-
crossOriginResourcePolicy?: string | false;
|
|
145
|
-
/** Cross-Origin-Embedder-Policy value. Default: 'require-corp'. false to disable. */
|
|
146
|
-
crossOriginEmbedderPolicy?: string | false;
|
|
147
|
-
/** Origin-Agent-Cluster header. Default: true (sends '?1'). false to disable. */
|
|
148
|
-
originAgentCluster?: boolean;
|
|
149
|
-
/** X-DNS-Prefetch-Control value. Default: true (sends 'off'). false to disable. */
|
|
150
|
-
dnsPrefetchControl?: boolean;
|
|
151
|
-
}
|
|
152
|
-
/** HSTS (HTTP Strict Transport Security) options */
|
|
153
|
-
interface HstsOptions {
|
|
154
|
-
/** Max age in seconds. Default: 31536000 (1 year) */
|
|
155
|
-
maxAge?: number;
|
|
156
|
-
/** Include subdomains. Default: true */
|
|
157
|
-
includeSubDomains?: boolean;
|
|
158
|
-
/** Enable HSTS preload. Default: false */
|
|
159
|
-
preload?: boolean;
|
|
160
|
-
}
|
|
161
|
-
/** Validation configuration */
|
|
162
|
-
interface ValidationConfig {
|
|
163
|
-
/** Strip fields not in schema. Default: true (prevents mass assignment) */
|
|
164
|
-
stripUnknown?: boolean;
|
|
165
|
-
/** Stop on first error. Default: false */
|
|
166
|
-
abortEarly?: boolean;
|
|
167
|
-
}
|
|
168
|
-
/** Validation schema for request data */
|
|
169
|
-
interface ValidationSchema {
|
|
170
|
-
[key: string]: FieldValidator;
|
|
171
|
-
}
|
|
172
|
-
/** Field validation rules */
|
|
173
|
-
interface FieldValidator {
|
|
174
|
-
/** Expected data type */
|
|
175
|
-
type: 'string' | 'number' | 'boolean' | 'email' | 'url' | 'uuid' | 'array' | 'object';
|
|
176
|
-
/** Whether field is required. Default: false */
|
|
177
|
-
required?: boolean;
|
|
178
|
-
/** Minimum value (number) or length (string/array) */
|
|
179
|
-
min?: number;
|
|
180
|
-
/** Maximum value (number) or length (string/array) */
|
|
181
|
-
max?: number;
|
|
182
|
-
/** Regex pattern for string validation */
|
|
183
|
-
pattern?: RegExp;
|
|
184
|
-
/** Allowed values */
|
|
185
|
-
enum?: unknown[];
|
|
186
|
-
/** Whether to sanitize the value. Default: true */
|
|
187
|
-
sanitize?: boolean;
|
|
188
|
-
/**
|
|
189
|
-
* Custom validation function.
|
|
190
|
-
* Return `true` to pass, `false` to fail with a default message,
|
|
191
|
-
* or a non-empty string to fail with that message.
|
|
192
|
-
* Returning `undefined` (i.e. forgetting to return) throws at runtime.
|
|
193
|
-
*/
|
|
194
|
-
custom?: (value: unknown) => true | false | string;
|
|
195
|
-
}
|
|
196
|
-
/** Validation result */
|
|
197
|
-
interface ValidationResult {
|
|
198
|
-
/** Whether validation passed */
|
|
199
|
-
valid: boolean;
|
|
200
|
-
/** Validation errors */
|
|
201
|
-
errors: ValidationError[];
|
|
202
|
-
/** Validated and sanitized data */
|
|
203
|
-
data: Record<string, unknown>;
|
|
204
|
-
}
|
|
205
|
-
/** Single validation error */
|
|
206
|
-
interface ValidationError {
|
|
207
|
-
/** Field that failed validation */
|
|
208
|
-
field: string;
|
|
209
|
-
/** Human-readable error message */
|
|
210
|
-
message: string;
|
|
211
|
-
/** Error code for programmatic handling */
|
|
212
|
-
code: string;
|
|
213
|
-
}
|
|
214
|
-
/** Safe logging configuration */
|
|
215
|
-
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
216
|
-
interface LogOptions {
|
|
217
|
-
/** Additional keys to redact beyond defaults */
|
|
218
|
-
redactKeys?: string[];
|
|
219
|
-
/** Maximum message length before truncation. Default: 10000 */
|
|
220
|
-
maxLength?: number;
|
|
221
|
-
/** Additional patterns to redact (e.g., custom tokens) */
|
|
222
|
-
redactPatterns?: RegExp[];
|
|
223
|
-
/** Minimum log level. Messages below this level are skipped (no redaction work). Default: 'debug' */
|
|
224
|
-
level?: LogLevel;
|
|
225
|
-
}
|
|
226
|
-
/** Safe logger interface */
|
|
227
|
-
interface SafeLogger {
|
|
228
|
-
/** Log at specified level */
|
|
229
|
-
log: (level: string, message: string, data?: unknown) => void;
|
|
230
|
-
/** Log info message */
|
|
231
|
-
info: (message: string, data?: unknown) => void;
|
|
232
|
-
/** Log warning message */
|
|
233
|
-
warn: (message: string, data?: unknown) => void;
|
|
234
|
-
/** Log error message */
|
|
235
|
-
error: (message: string, data?: unknown) => void;
|
|
236
|
-
/** Log debug message */
|
|
237
|
-
debug: (message: string, data?: unknown) => void;
|
|
238
|
-
}
|
|
239
|
-
/** Error handler configuration */
|
|
240
|
-
interface ErrorHandlerOptions {
|
|
241
|
-
/** Show stack traces and detailed errors. Default: false */
|
|
242
|
-
isDev?: boolean;
|
|
243
|
-
/** Log errors. Default: true */
|
|
244
|
-
logErrors?: boolean;
|
|
245
|
-
/** Custom error logger */
|
|
246
|
-
logger?: SafeLogger;
|
|
247
|
-
/** Custom error handler */
|
|
248
|
-
customHandler?: (err: Error, req: Request, res: Response) => void;
|
|
249
|
-
}
|
|
250
|
-
/** Extended Error with optional status code */
|
|
251
|
-
interface HttpError extends Error {
|
|
252
|
-
statusCode?: number;
|
|
253
|
-
status?: number;
|
|
254
|
-
/**
|
|
255
|
-
* Whether the error message is safe to expose to API clients.
|
|
256
|
-
* Set to true for known client-facing errors (4xx with controlled messages).
|
|
257
|
-
* Defaults to false — message is hidden in production unless explicitly exposed.
|
|
258
|
-
*/
|
|
259
|
-
expose?: boolean;
|
|
260
|
-
}
|
|
261
|
-
/** Generic Arcis middleware type */
|
|
262
|
-
type ArcisMiddleware = (req: Request, res: Response, next: NextFunction) => void | Promise<void>;
|
|
263
|
-
/** Array of middlewares returned by arcis() with an attached cleanup method */
|
|
264
|
-
type ArcisMiddlewareStack = RequestHandler[] & {
|
|
265
|
-
/** Clean up resources created by arcis() (rate limiter intervals, etc.) */
|
|
266
|
-
close: () => void;
|
|
267
|
-
};
|
|
268
|
-
/** Arcis function with attached utilities */
|
|
269
|
-
interface ArcisFunction {
|
|
270
|
-
(options?: ArcisOptions): ArcisMiddlewareStack;
|
|
271
|
-
sanitize: (options?: SanitizeOptions) => RequestHandler;
|
|
272
|
-
rateLimit: (options?: RateLimitOptions) => RateLimiterMiddleware;
|
|
273
|
-
headers: (options?: HeaderOptions) => RequestHandler;
|
|
274
|
-
validate: (schema: ValidationSchema, source?: 'body' | 'query' | 'params') => RequestHandler;
|
|
275
|
-
logger: (options?: LogOptions) => SafeLogger;
|
|
276
|
-
errorHandler: (options?: ErrorHandlerOptions | boolean) => (err: Error, req: Request, res: Response, next: NextFunction) => void;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export type { ArcisFunction as A, ErrorHandlerOptions as E, FieldValidator as F, HeaderOptions as H, LogOptions as L, RateLimitEntry as R, SafeLogger as S, ThreatInfo as T, ValidationConfig as V, ArcisMiddleware as a, ArcisOptions as b, HstsOptions as c, HttpError as d, RateLimitOptions as e, RateLimitResult as f, RateLimitStore as g, RateLimiterMiddleware as h, SanitizeOptions as i, SanitizeResult as j, ThreatType as k, ValidationError as l, ValidationResult as m, ValidationSchema as n, ArcisMiddlewareStack as o };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { g as createValidator, i as isDangerousExtension, h as isRedirectSafe, j as isUrlSafe, k as isValidEmailSyntax, s as sanitizeFilename, v as validate, l as validateEmail, m as validateFile, n as validateRedirect, o as validateUrl, p as verifyEmailMx } from '../index-Cd02z-0j.mjs';
|
|
2
|
-
import 'express';
|
|
3
|
-
import '../types-BOkx5YJc.mjs';
|