@arcis/node 1.2.0 → 1.3.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.
Files changed (35) hide show
  1. package/dist/core/index.d.mts +1 -1
  2. package/dist/core/index.d.ts +1 -1
  3. package/dist/{pii-DhNpl7M3.d.ts → encode-CrQCGlBq.d.mts} +48 -2
  4. package/dist/{pii-CXcHMlnX.d.mts → encode-jl9sOwmA.d.ts} +48 -2
  5. package/dist/{index-D_bdJcF0.d.ts → index-BAhgn9V2.d.ts} +1 -1
  6. package/dist/{index-Co5kPRZz.d.ts → index-BGNKspqH.d.ts} +1 -1
  7. package/dist/{index-A-m-pPeW.d.mts → index-Cd02z-0j.d.mts} +1 -1
  8. package/dist/{index-CgK94hY_.d.mts → index-DgJtWMSj.d.mts} +1 -1
  9. package/dist/index.d.mts +4 -4
  10. package/dist/index.d.ts +4 -4
  11. package/dist/index.js +94 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +90 -3
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/logging/index.d.mts +1 -1
  16. package/dist/logging/index.d.ts +1 -1
  17. package/dist/middleware/index.d.mts +2 -2
  18. package/dist/middleware/index.d.ts +2 -2
  19. package/dist/middleware/index.js +22 -2
  20. package/dist/middleware/index.js.map +1 -1
  21. package/dist/middleware/index.mjs +22 -2
  22. package/dist/middleware/index.mjs.map +1 -1
  23. package/dist/sanitizers/index.d.mts +2 -2
  24. package/dist/sanitizers/index.d.ts +2 -2
  25. package/dist/sanitizers/index.js +72 -0
  26. package/dist/sanitizers/index.js.map +1 -1
  27. package/dist/sanitizers/index.mjs +68 -1
  28. package/dist/sanitizers/index.mjs.map +1 -1
  29. package/dist/stores/index.d.mts +1 -1
  30. package/dist/stores/index.d.ts +1 -1
  31. package/dist/{types-CsOFHoD9.d.mts → types-BOkx5YJc.d.mts} +11 -1
  32. package/dist/{types-CsOFHoD9.d.ts → types-BOkx5YJc.d.ts} +11 -1
  33. package/dist/validation/index.d.mts +2 -2
  34. package/dist/validation/index.d.ts +2 -2
  35. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- export { A as ArcisFunction, a as ArcisMiddleware, b as ArcisOptions, E as ErrorHandlerOptions, F as FieldValidator, H as HeaderOptions, c as HstsOptions, d as HttpError, L as LogOptions, R as RateLimitEntry, e as RateLimitOptions, f as RateLimitResult, g as RateLimitStore, h as RateLimiterMiddleware, S as SafeLogger, i as SanitizeOptions, j as SanitizeResult, T as ThreatInfo, k as ThreatType, V as ValidationConfig, l as ValidationError, m as ValidationResult, n as ValidationSchema } from '../types-CsOFHoD9.mjs';
1
+ export { A as ArcisFunction, a as ArcisMiddleware, b as ArcisOptions, E as ErrorHandlerOptions, F as FieldValidator, H as HeaderOptions, c as HstsOptions, d as HttpError, L as LogOptions, R as RateLimitEntry, e as RateLimitOptions, f as RateLimitResult, g as RateLimitStore, h as RateLimiterMiddleware, S as SafeLogger, i as SanitizeOptions, j as SanitizeResult, T as ThreatInfo, k as ThreatType, V as ValidationConfig, l as ValidationError, m as ValidationResult, n as ValidationSchema } from '../types-BOkx5YJc.mjs';
2
2
  import 'express';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- export { A as ArcisFunction, a as ArcisMiddleware, b as ArcisOptions, E as ErrorHandlerOptions, F as FieldValidator, H as HeaderOptions, c as HstsOptions, d as HttpError, L as LogOptions, R as RateLimitEntry, e as RateLimitOptions, f as RateLimitResult, g as RateLimitStore, h as RateLimiterMiddleware, S as SafeLogger, i as SanitizeOptions, j as SanitizeResult, T as ThreatInfo, k as ThreatType, V as ValidationConfig, l as ValidationError, m as ValidationResult, n as ValidationSchema } from '../types-CsOFHoD9.js';
1
+ export { A as ArcisFunction, a as ArcisMiddleware, b as ArcisOptions, E as ErrorHandlerOptions, F as FieldValidator, H as HeaderOptions, c as HstsOptions, d as HttpError, L as LogOptions, R as RateLimitEntry, e as RateLimitOptions, f as RateLimitResult, g as RateLimitStore, h as RateLimiterMiddleware, S as SafeLogger, i as SanitizeOptions, j as SanitizeResult, T as ThreatInfo, k as ThreatType, V as ValidationConfig, l as ValidationError, m as ValidationResult, n as ValidationSchema } from '../types-BOkx5YJc.js';
2
2
  import 'express';
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler } from 'express';
2
- import { i as SanitizeOptions, j as SanitizeResult } from './types-CsOFHoD9.js';
2
+ import { i as SanitizeOptions, j as SanitizeResult } from './types-BOkx5YJc.mjs';
3
3
 
4
4
  /**
5
5
  * @module @arcis/node/sanitizers/sanitize
@@ -435,4 +435,50 @@ declare function scanObjectPii(obj: Record<string, unknown>, options?: PiiScanOp
435
435
  */
436
436
  declare function redactObjectPii<T extends Record<string, unknown>>(obj: T, options?: PiiRedactOptions): T;
437
437
 
438
- export { sanitizeString as A, sanitizeXss as B, sanitizeXxe as C, scanObjectPii as D, scanPii as E, type PiiRedactOptions as F, type PiiScanOptions as G, type PiiType as H, type PiiMatch as P, detectHeaderInjection as a, detectJsonpInjection as b, createSanitizer as c, detectCommandInjection as d, detectNoSqlInjection as e, detectPathTraversal as f, detectPii as g, detectPrototypePollution as h, detectSql as i, detectSsti as j, detectXss as k, detectXxe as l, getDangerousOperators as m, getDangerousProtoKeys as n, isDangerousNoSqlKey as o, isDangerousProtoKey as p, redactPii as q, redactObjectPii as r, sanitizeCommand as s, sanitizeHeaderValue as t, sanitizeHeaders as u, sanitizeJsonpCallback as v, sanitizeObject as w, sanitizePath as x, sanitizeSql as y, sanitizeSsti as z };
438
+ /**
439
+ * @module @arcis/node/sanitizers/encode
440
+ * Context-aware output encoding for XSS prevention.
441
+ *
442
+ * Wrong-context encoding is the #1 cause of XSS bypasses in "protected" apps.
443
+ * A single sanitize() is not enough when output goes to JS, CSS, or attribute contexts.
444
+ */
445
+ /**
446
+ * Encodes for HTML body context. Entity-encodes & < > " '
447
+ *
448
+ * Use when outputting to HTML element content:
449
+ * `<p>${encodeForHtml(userInput)}</p>`
450
+ */
451
+ declare function encodeForHtml(value: string): string;
452
+ /**
453
+ * Encodes for HTML attribute context.
454
+ * All non-alphanumeric characters are encoded as `&#xHH;` hex entities.
455
+ *
456
+ * Use when outputting to HTML attributes:
457
+ * `<div title="${encodeForAttribute(userInput)}">`
458
+ */
459
+ declare function encodeForAttribute(value: string): string;
460
+ /**
461
+ * Encodes for JavaScript string context.
462
+ * Non-alphanumeric characters are escaped as `\xHH` (ASCII) or `\uHHHH` (Unicode).
463
+ *
464
+ * Use when embedding in JS string literals:
465
+ * `var x = '${encodeForJs(userInput)}';`
466
+ */
467
+ declare function encodeForJs(value: string): string;
468
+ /**
469
+ * Encodes for URL parameter context. Percent-encodes all non-unreserved chars.
470
+ *
471
+ * Use when building query strings:
472
+ * `?q=${encodeForUrl(userInput)}`
473
+ */
474
+ declare function encodeForUrl(value: string): string;
475
+ /**
476
+ * Encodes for CSS value context.
477
+ * Non-alphanumeric characters are hex-escaped as `\HH ` (trailing space per CSS spec).
478
+ *
479
+ * Use when embedding in CSS values:
480
+ * `content: '${encodeForCss(userInput)}';`
481
+ */
482
+ declare function encodeForCss(value: string): string;
483
+
484
+ export { sanitizeJsonpCallback as A, sanitizeObject as B, sanitizePath as C, sanitizeSql as D, sanitizeSsti as E, sanitizeString as F, sanitizeXss as G, sanitizeXxe as H, scanObjectPii as I, scanPii as J, type PiiRedactOptions as K, type PiiScanOptions as L, type PiiType as M, type PiiMatch as P, detectHeaderInjection as a, detectJsonpInjection as b, createSanitizer as c, detectCommandInjection as d, detectNoSqlInjection as e, detectPathTraversal as f, detectPii as g, detectPrototypePollution as h, detectSql as i, detectSsti as j, detectXss as k, detectXxe as l, encodeForAttribute as m, encodeForCss as n, encodeForHtml as o, encodeForJs as p, encodeForUrl as q, getDangerousOperators as r, getDangerousProtoKeys as s, isDangerousNoSqlKey as t, isDangerousProtoKey as u, redactObjectPii as v, redactPii as w, sanitizeCommand as x, sanitizeHeaderValue as y, sanitizeHeaders as z };
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler } from 'express';
2
- import { i as SanitizeOptions, j as SanitizeResult } from './types-CsOFHoD9.mjs';
2
+ import { i as SanitizeOptions, j as SanitizeResult } from './types-BOkx5YJc.js';
3
3
 
4
4
  /**
5
5
  * @module @arcis/node/sanitizers/sanitize
@@ -435,4 +435,50 @@ declare function scanObjectPii(obj: Record<string, unknown>, options?: PiiScanOp
435
435
  */
436
436
  declare function redactObjectPii<T extends Record<string, unknown>>(obj: T, options?: PiiRedactOptions): T;
437
437
 
438
- export { sanitizeString as A, sanitizeXss as B, sanitizeXxe as C, scanObjectPii as D, scanPii as E, type PiiRedactOptions as F, type PiiScanOptions as G, type PiiType as H, type PiiMatch as P, detectHeaderInjection as a, detectJsonpInjection as b, createSanitizer as c, detectCommandInjection as d, detectNoSqlInjection as e, detectPathTraversal as f, detectPii as g, detectPrototypePollution as h, detectSql as i, detectSsti as j, detectXss as k, detectXxe as l, getDangerousOperators as m, getDangerousProtoKeys as n, isDangerousNoSqlKey as o, isDangerousProtoKey as p, redactPii as q, redactObjectPii as r, sanitizeCommand as s, sanitizeHeaderValue as t, sanitizeHeaders as u, sanitizeJsonpCallback as v, sanitizeObject as w, sanitizePath as x, sanitizeSql as y, sanitizeSsti as z };
438
+ /**
439
+ * @module @arcis/node/sanitizers/encode
440
+ * Context-aware output encoding for XSS prevention.
441
+ *
442
+ * Wrong-context encoding is the #1 cause of XSS bypasses in "protected" apps.
443
+ * A single sanitize() is not enough when output goes to JS, CSS, or attribute contexts.
444
+ */
445
+ /**
446
+ * Encodes for HTML body context. Entity-encodes & < > " '
447
+ *
448
+ * Use when outputting to HTML element content:
449
+ * `<p>${encodeForHtml(userInput)}</p>`
450
+ */
451
+ declare function encodeForHtml(value: string): string;
452
+ /**
453
+ * Encodes for HTML attribute context.
454
+ * All non-alphanumeric characters are encoded as `&#xHH;` hex entities.
455
+ *
456
+ * Use when outputting to HTML attributes:
457
+ * `<div title="${encodeForAttribute(userInput)}">`
458
+ */
459
+ declare function encodeForAttribute(value: string): string;
460
+ /**
461
+ * Encodes for JavaScript string context.
462
+ * Non-alphanumeric characters are escaped as `\xHH` (ASCII) or `\uHHHH` (Unicode).
463
+ *
464
+ * Use when embedding in JS string literals:
465
+ * `var x = '${encodeForJs(userInput)}';`
466
+ */
467
+ declare function encodeForJs(value: string): string;
468
+ /**
469
+ * Encodes for URL parameter context. Percent-encodes all non-unreserved chars.
470
+ *
471
+ * Use when building query strings:
472
+ * `?q=${encodeForUrl(userInput)}`
473
+ */
474
+ declare function encodeForUrl(value: string): string;
475
+ /**
476
+ * Encodes for CSS value context.
477
+ * Non-alphanumeric characters are hex-escaped as `\HH ` (trailing space per CSS spec).
478
+ *
479
+ * Use when embedding in CSS values:
480
+ * `content: '${encodeForCss(userInput)}';`
481
+ */
482
+ declare function encodeForCss(value: string): string;
483
+
484
+ export { sanitizeJsonpCallback as A, sanitizeObject as B, sanitizePath as C, sanitizeSql as D, sanitizeSsti as E, sanitizeString as F, sanitizeXss as G, sanitizeXxe as H, scanObjectPii as I, scanPii as J, type PiiRedactOptions as K, type PiiScanOptions as L, type PiiType as M, type PiiMatch as P, detectHeaderInjection as a, detectJsonpInjection as b, createSanitizer as c, detectCommandInjection as d, detectNoSqlInjection as e, detectPathTraversal as f, detectPii as g, detectPrototypePollution as h, detectSql as i, detectSsti as j, detectXss as k, detectXxe as l, encodeForAttribute as m, encodeForCss as n, encodeForHtml as o, encodeForJs as p, encodeForUrl as q, getDangerousOperators as r, getDangerousProtoKeys as s, isDangerousNoSqlKey as t, isDangerousProtoKey as u, redactObjectPii as v, redactPii as w, sanitizeCommand as x, sanitizeHeaderValue as y, sanitizeHeaders as z };
@@ -1,4 +1,4 @@
1
- import { b as ArcisOptions, o as ArcisMiddlewareStack, A as ArcisFunction, e as RateLimitOptions, h as RateLimiterMiddleware, H as HeaderOptions, E as ErrorHandlerOptions } from './types-CsOFHoD9.js';
1
+ import { b as ArcisOptions, o as ArcisMiddlewareStack, A as ArcisFunction, e as RateLimitOptions, h as RateLimiterMiddleware, H as HeaderOptions, E as ErrorHandlerOptions } from './types-BOkx5YJc.js';
2
2
  import { RequestHandler, Request, Response, NextFunction } from 'express';
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler } from 'express';
2
- import { n as ValidationSchema } from './types-CsOFHoD9.js';
2
+ import { n as ValidationSchema } from './types-BOkx5YJc.js';
3
3
 
4
4
  /**
5
5
  * @module @arcis/node/validation/schema
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler } from 'express';
2
- import { n as ValidationSchema } from './types-CsOFHoD9.mjs';
2
+ import { n as ValidationSchema } from './types-BOkx5YJc.mjs';
3
3
 
4
4
  /**
5
5
  * @module @arcis/node/validation/schema
@@ -1,4 +1,4 @@
1
- import { b as ArcisOptions, o as ArcisMiddlewareStack, A as ArcisFunction, e as RateLimitOptions, h as RateLimiterMiddleware, H as HeaderOptions, E as ErrorHandlerOptions } from './types-CsOFHoD9.mjs';
1
+ import { b as ArcisOptions, o as ArcisMiddlewareStack, A as ArcisFunction, e as RateLimitOptions, h as RateLimiterMiddleware, H as HeaderOptions, E as ErrorHandlerOptions } from './types-BOkx5YJc.mjs';
2
2
  import { RequestHandler, Request, Response, NextFunction } from 'express';
3
3
 
4
4
  /**
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- export { B as BotCategory, a as BotDetectionResult, b as BotProtectionOptions, C as CorsOptions, c as CsrfOptions, S as SecureCookieOptions, d as SlidingWindowMiddleware, e as SlidingWindowOptions, T as TokenBucketMiddleware, f as TokenBucketOptions, 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-CgK94hY_.mjs';
2
- export { P as PiiMatch, F as PiiRedactOptions, G as PiiScanOptions, H as PiiType, 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, o as isDangerousNoSqlKey, p as isDangerousProtoKey, r as redactObjectPii, q as redactPii, s as sanitizeCommand, t as sanitizeHeaderValue, u as sanitizeHeaders, v as sanitizeJsonpCallback, w as sanitizeObject, x as sanitizePath, y as sanitizeSql, z as sanitizeSsti, A as sanitizeString, B as sanitizeXss, C as sanitizeXxe, D as scanObjectPii, E as scanPii } from './pii-CXcHMlnX.mjs';
3
- export { E as EmailValidationOptions, a as EmailValidationResult, F as FileInput, V as ValidateFileOptions, b as ValidateFileResult, c as ValidateRedirectOptions, d as ValidateRedirectResult, e as ValidateUrlOptions, f as ValidateUrlResult, 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-A-m-pPeW.mjs';
1
+ export { B as BotCategory, a as BotDetectionResult, b as BotProtectionOptions, C as CorsOptions, c as CsrfOptions, S as SecureCookieOptions, d as SlidingWindowMiddleware, e as SlidingWindowOptions, T as TokenBucketMiddleware, f as TokenBucketOptions, 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
+ export { P as PiiMatch, K as PiiRedactOptions, L as PiiScanOptions, M as PiiType, 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, 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';
3
+ export { E as EmailValidationOptions, a as EmailValidationResult, F as FileInput, V as ValidateFileOptions, b as ValidateFileResult, c as ValidateRedirectOptions, d as ValidateRedirectResult, e as ValidateUrlOptions, f as ValidateUrlResult, 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';
4
4
  import { IncomingMessage } from 'http';
5
5
  export { createRedactor, createSafeLogger, safeLog } from './logging/index.mjs';
6
6
  export { MemoryStore, RedisClientLike, RedisStore, RedisStoreOptions, createRedisStore } from './stores/index.mjs';
7
- export { A as ArcisFunction, a as ArcisMiddleware, b as ArcisOptions, E as ErrorHandlerOptions, F as FieldValidator, H as HeaderOptions, c as HstsOptions, d as HttpError, L as LogOptions, R as RateLimitEntry, e as RateLimitOptions, f as RateLimitResult, g as RateLimitStore, h as RateLimiterMiddleware, S as SafeLogger, i as SanitizeOptions, j as SanitizeResult, T as ThreatInfo, k as ThreatType, V as ValidationConfig, l as ValidationError, m as ValidationResult, n as ValidationSchema } from './types-CsOFHoD9.mjs';
7
+ export { A as ArcisFunction, a as ArcisMiddleware, b as ArcisOptions, E as ErrorHandlerOptions, F as FieldValidator, H as HeaderOptions, c as HstsOptions, d as HttpError, L as LogOptions, R as RateLimitEntry, e as RateLimitOptions, f as RateLimitResult, g as RateLimitStore, h as RateLimiterMiddleware, S as SafeLogger, i as SanitizeOptions, j as SanitizeResult, T as ThreatInfo, k as ThreatType, V as ValidationConfig, l as ValidationError, m as ValidationResult, n as ValidationSchema } from './types-BOkx5YJc.mjs';
8
8
  export { ArcisError, ArcisValidationError, BLOCKED, ERRORS, HEADERS, INPUT, InputTooLargeError, RATE_LIMIT, REDACTION, RateLimitError, SanitizationError, SecurityThreatError, VALIDATION } from './core/index.mjs';
9
9
  import 'express';
10
10
 
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { B as BotCategory, a as BotDetectionResult, b as BotProtectionOptions, C as CorsOptions, c as CsrfOptions, S as SecureCookieOptions, d as SlidingWindowMiddleware, e as SlidingWindowOptions, T as TokenBucketMiddleware, f as TokenBucketOptions, 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-D_bdJcF0.js';
2
- export { P as PiiMatch, F as PiiRedactOptions, G as PiiScanOptions, H as PiiType, 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, o as isDangerousNoSqlKey, p as isDangerousProtoKey, r as redactObjectPii, q as redactPii, s as sanitizeCommand, t as sanitizeHeaderValue, u as sanitizeHeaders, v as sanitizeJsonpCallback, w as sanitizeObject, x as sanitizePath, y as sanitizeSql, z as sanitizeSsti, A as sanitizeString, B as sanitizeXss, C as sanitizeXxe, D as scanObjectPii, E as scanPii } from './pii-DhNpl7M3.js';
3
- export { E as EmailValidationOptions, a as EmailValidationResult, F as FileInput, V as ValidateFileOptions, b as ValidateFileResult, c as ValidateRedirectOptions, d as ValidateRedirectResult, e as ValidateUrlOptions, f as ValidateUrlResult, 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-Co5kPRZz.js';
1
+ export { B as BotCategory, a as BotDetectionResult, b as BotProtectionOptions, C as CorsOptions, c as CsrfOptions, S as SecureCookieOptions, d as SlidingWindowMiddleware, e as SlidingWindowOptions, T as TokenBucketMiddleware, f as TokenBucketOptions, 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-BAhgn9V2.js';
2
+ export { P as PiiMatch, K as PiiRedactOptions, L as PiiScanOptions, M as PiiType, 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, 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-jl9sOwmA.js';
3
+ export { E as EmailValidationOptions, a as EmailValidationResult, F as FileInput, V as ValidateFileOptions, b as ValidateFileResult, c as ValidateRedirectOptions, d as ValidateRedirectResult, e as ValidateUrlOptions, f as ValidateUrlResult, 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-BGNKspqH.js';
4
4
  import { IncomingMessage } from 'http';
5
5
  export { createRedactor, createSafeLogger, safeLog } from './logging/index.js';
6
6
  export { MemoryStore, RedisClientLike, RedisStore, RedisStoreOptions, createRedisStore } from './stores/index.js';
7
- export { A as ArcisFunction, a as ArcisMiddleware, b as ArcisOptions, E as ErrorHandlerOptions, F as FieldValidator, H as HeaderOptions, c as HstsOptions, d as HttpError, L as LogOptions, R as RateLimitEntry, e as RateLimitOptions, f as RateLimitResult, g as RateLimitStore, h as RateLimiterMiddleware, S as SafeLogger, i as SanitizeOptions, j as SanitizeResult, T as ThreatInfo, k as ThreatType, V as ValidationConfig, l as ValidationError, m as ValidationResult, n as ValidationSchema } from './types-CsOFHoD9.js';
7
+ export { A as ArcisFunction, a as ArcisMiddleware, b as ArcisOptions, E as ErrorHandlerOptions, F as FieldValidator, H as HeaderOptions, c as HstsOptions, d as HttpError, L as LogOptions, R as RateLimitEntry, e as RateLimitOptions, f as RateLimitResult, g as RateLimitStore, h as RateLimiterMiddleware, S as SafeLogger, i as SanitizeOptions, j as SanitizeResult, T as ThreatInfo, k as ThreatType, V as ValidationConfig, l as ValidationError, m as ValidationResult, n as ValidationSchema } from './types-BOkx5YJc.js';
8
8
  export { ArcisError, ArcisValidationError, BLOCKED, ERRORS, HEADERS, INPUT, InputTooLargeError, RATE_LIMIT, REDACTION, RateLimitError, SanitizationError, SecurityThreatError, VALIDATION } from './core/index.js';
9
9
  import 'express';
10
10
 
package/dist/index.js CHANGED
@@ -307,7 +307,12 @@ function createHeaders(options = {}) {
307
307
  hsts = true,
308
308
  referrerPolicy = HEADERS.REFERRER_POLICY,
309
309
  permissionsPolicy = HEADERS.PERMISSIONS_POLICY,
310
- cacheControl = true
310
+ cacheControl = true,
311
+ crossOriginOpenerPolicy = "same-origin",
312
+ crossOriginResourcePolicy = "same-origin",
313
+ crossOriginEmbedderPolicy = "require-corp",
314
+ originAgentCluster = true,
315
+ dnsPrefetchControl = true
311
316
  } = options;
312
317
  return (req, res, next) => {
313
318
  if (contentSecurityPolicy) {
@@ -315,7 +320,7 @@ function createHeaders(options = {}) {
315
320
  res.setHeader("Content-Security-Policy", csp);
316
321
  }
317
322
  if (xssFilter) {
318
- res.setHeader("X-XSS-Protection", "1; mode=block");
323
+ res.setHeader("X-XSS-Protection", "0");
319
324
  }
320
325
  if (noSniff) {
321
326
  res.setHeader("X-Content-Type-Options", HEADERS.CONTENT_TYPE_OPTIONS);
@@ -342,6 +347,21 @@ function createHeaders(options = {}) {
342
347
  if (permissionsPolicy) {
343
348
  res.setHeader("Permissions-Policy", permissionsPolicy);
344
349
  }
350
+ if (crossOriginOpenerPolicy) {
351
+ res.setHeader("Cross-Origin-Opener-Policy", crossOriginOpenerPolicy);
352
+ }
353
+ if (crossOriginResourcePolicy) {
354
+ res.setHeader("Cross-Origin-Resource-Policy", crossOriginResourcePolicy);
355
+ }
356
+ if (crossOriginEmbedderPolicy) {
357
+ res.setHeader("Cross-Origin-Embedder-Policy", crossOriginEmbedderPolicy);
358
+ }
359
+ if (originAgentCluster) {
360
+ res.setHeader("Origin-Agent-Cluster", "?1");
361
+ }
362
+ if (dnsPrefetchControl) {
363
+ res.setHeader("X-DNS-Prefetch-Control", "off");
364
+ }
345
365
  res.setHeader("X-Permitted-Cross-Domain-Policies", "none");
346
366
  if (cacheControl) {
347
367
  const cacheControlValue = typeof cacheControl === "string" ? cacheControl : HEADERS.CACHE_CONTROL;
@@ -1249,6 +1269,73 @@ function redactObjectPii(obj, options = {}) {
1249
1269
  return result;
1250
1270
  }
1251
1271
 
1272
+ // src/sanitizers/encode.ts
1273
+ var HTML_ENTITIES = {
1274
+ "&": "&amp;",
1275
+ "<": "&lt;",
1276
+ ">": "&gt;",
1277
+ '"': "&quot;",
1278
+ "'": "&#x27;"
1279
+ };
1280
+ var HTML_ENCODE_RE = /[&<>"']/g;
1281
+ function encodeForHtml(value) {
1282
+ if (!value) return "";
1283
+ return value.replace(HTML_ENCODE_RE, (ch) => HTML_ENTITIES[ch]);
1284
+ }
1285
+ function encodeForAttribute(value) {
1286
+ if (!value) return "";
1287
+ let result = "";
1288
+ for (let i = 0; i < value.length; i++) {
1289
+ const ch = value.charCodeAt(i);
1290
+ if (ch >= 48 && ch <= 57 || // 0-9
1291
+ ch >= 65 && ch <= 90 || // A-Z
1292
+ ch >= 97 && ch <= 122) {
1293
+ result += value[i];
1294
+ } else {
1295
+ result += `&#x${ch.toString(16).toUpperCase()};`;
1296
+ }
1297
+ }
1298
+ return result;
1299
+ }
1300
+ function encodeForJs(value) {
1301
+ if (!value) return "";
1302
+ let result = "";
1303
+ for (let i = 0; i < value.length; i++) {
1304
+ const ch = value.charCodeAt(i);
1305
+ if (ch >= 48 && ch <= 57 || // 0-9
1306
+ ch >= 65 && ch <= 90 || // A-Z
1307
+ ch >= 97 && ch <= 122) {
1308
+ result += value[i];
1309
+ } else if (ch < 256) {
1310
+ result += `\\x${ch.toString(16).toUpperCase().padStart(2, "0")}`;
1311
+ } else {
1312
+ result += `\\u${ch.toString(16).toUpperCase().padStart(4, "0")}`;
1313
+ }
1314
+ }
1315
+ return result;
1316
+ }
1317
+ function encodeForUrl(value) {
1318
+ if (!value) return "";
1319
+ return encodeURIComponent(value).replace(/[!'()*]/g, (ch) => {
1320
+ return `%${ch.charCodeAt(0).toString(16).toUpperCase()}`;
1321
+ });
1322
+ }
1323
+ function encodeForCss(value) {
1324
+ if (!value) return "";
1325
+ let result = "";
1326
+ for (let i = 0; i < value.length; i++) {
1327
+ const ch = value.charCodeAt(i);
1328
+ if (ch >= 48 && ch <= 57 || // 0-9
1329
+ ch >= 65 && ch <= 90 || // A-Z
1330
+ ch >= 97 && ch <= 122) {
1331
+ result += value[i];
1332
+ } else {
1333
+ result += `\\${ch.toString(16).toUpperCase()} `;
1334
+ }
1335
+ }
1336
+ return result;
1337
+ }
1338
+
1252
1339
  // src/validation/schema.ts
1253
1340
  function validate(schema, source = "body") {
1254
1341
  return (req, res, next) => {
@@ -3145,6 +3232,11 @@ exports.detectSql = detectSql;
3145
3232
  exports.detectSsti = detectSsti;
3146
3233
  exports.detectXss = detectXss;
3147
3234
  exports.detectXxe = detectXxe;
3235
+ exports.encodeForAttribute = encodeForAttribute;
3236
+ exports.encodeForCss = encodeForCss;
3237
+ exports.encodeForHtml = encodeForHtml;
3238
+ exports.encodeForJs = encodeForJs;
3239
+ exports.encodeForUrl = encodeForUrl;
3148
3240
  exports.enforceSecureCookie = enforceSecureCookie;
3149
3241
  exports.errorHandler = errorHandler;
3150
3242
  exports.fingerprint = fingerprint;