@arcis/node 1.0.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 (52) hide show
  1. package/README.md +222 -0
  2. package/dist/core/index.d.mts +170 -0
  3. package/dist/core/index.d.ts +170 -0
  4. package/dist/core/index.js +327 -0
  5. package/dist/core/index.js.map +1 -0
  6. package/dist/core/index.mjs +307 -0
  7. package/dist/core/index.mjs.map +1 -0
  8. package/dist/headers-BJq2OA0i.d.ts +284 -0
  9. package/dist/headers-DBQedhrb.d.mts +284 -0
  10. package/dist/index-BgHPM7LC.d.ts +129 -0
  11. package/dist/index-BpT7flAQ.d.ts +255 -0
  12. package/dist/index-JaFOUKyK.d.mts +255 -0
  13. package/dist/index-nAgXexwD.d.mts +129 -0
  14. package/dist/index.d.mts +139 -0
  15. package/dist/index.d.ts +139 -0
  16. package/dist/index.js +1860 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/index.mjs +1797 -0
  19. package/dist/index.mjs.map +1 -0
  20. package/dist/logging/index.d.mts +38 -0
  21. package/dist/logging/index.d.ts +38 -0
  22. package/dist/logging/index.js +140 -0
  23. package/dist/logging/index.js.map +1 -0
  24. package/dist/logging/index.mjs +136 -0
  25. package/dist/logging/index.mjs.map +1 -0
  26. package/dist/middleware/index.d.mts +3 -0
  27. package/dist/middleware/index.d.ts +3 -0
  28. package/dist/middleware/index.js +1173 -0
  29. package/dist/middleware/index.js.map +1 -0
  30. package/dist/middleware/index.mjs +1156 -0
  31. package/dist/middleware/index.mjs.map +1 -0
  32. package/dist/sanitizers/index.d.mts +24 -0
  33. package/dist/sanitizers/index.d.ts +24 -0
  34. package/dist/sanitizers/index.js +610 -0
  35. package/dist/sanitizers/index.js.map +1 -0
  36. package/dist/sanitizers/index.mjs +587 -0
  37. package/dist/sanitizers/index.mjs.map +1 -0
  38. package/dist/stores/index.d.mts +106 -0
  39. package/dist/stores/index.d.ts +106 -0
  40. package/dist/stores/index.js +149 -0
  41. package/dist/stores/index.js.map +1 -0
  42. package/dist/stores/index.mjs +145 -0
  43. package/dist/stores/index.mjs.map +1 -0
  44. package/dist/types-BOdL3ZWo.d.mts +264 -0
  45. package/dist/types-BOdL3ZWo.d.ts +264 -0
  46. package/dist/validation/index.d.mts +3 -0
  47. package/dist/validation/index.d.ts +3 -0
  48. package/dist/validation/index.js +705 -0
  49. package/dist/validation/index.js.map +1 -0
  50. package/dist/validation/index.mjs +699 -0
  51. package/dist/validation/index.mjs.map +1 -0
  52. package/package.json +109 -0
@@ -0,0 +1,129 @@
1
+ import { RequestHandler } from 'express';
2
+ import { n as ValidationSchema } from './types-BOdL3ZWo.mjs';
3
+
4
+ /**
5
+ * @module @arcis/node/validation/schema
6
+ * Request validation middleware
7
+ */
8
+
9
+ /**
10
+ * Create Express middleware for request validation.
11
+ * Prevents mass assignment by only allowing fields defined in the schema.
12
+ *
13
+ * @param schema - Validation schema defining expected fields
14
+ * @param source - Request property to validate ('body', 'query', or 'params')
15
+ * @returns Express middleware
16
+ *
17
+ * @example
18
+ * app.post('/users', validate({
19
+ * email: { type: 'email', required: true },
20
+ * name: { type: 'string', min: 2, max: 50 },
21
+ * age: { type: 'number', min: 0, max: 150 },
22
+ * role: { type: 'string', enum: ['user', 'admin'] }
23
+ * }), handler);
24
+ *
25
+ * @example
26
+ * // Validate query params
27
+ * app.get('/search', validate({
28
+ * q: { type: 'string', required: true, min: 1 },
29
+ * page: { type: 'number', min: 1 }
30
+ * }, 'query'), handler);
31
+ */
32
+ declare function validate(schema: ValidationSchema, source?: 'body' | 'query' | 'params'): RequestHandler;
33
+ /**
34
+ * Alias for validate
35
+ * @see validate
36
+ */
37
+ declare const createValidator: typeof validate;
38
+
39
+ /**
40
+ * @module @arcis/node/validation/file
41
+ * File upload validation and filename sanitization
42
+ */
43
+ /** File upload validation options */
44
+ interface ValidateFileOptions {
45
+ /** Maximum file size in bytes. Default: 5MB */
46
+ maxSize?: number;
47
+ /** Allowed MIME types (e.g., ['image/jpeg', 'image/png']) */
48
+ allowedTypes?: string[];
49
+ /** Allowed file extensions (e.g., ['.jpg', '.png']). Includes dot. */
50
+ allowedExtensions?: string[];
51
+ /** Block dangerous/executable extensions. Default: true */
52
+ blockExecutables?: boolean;
53
+ /** Validate magic bytes match the claimed MIME type. Default: true */
54
+ validateMagicBytes?: boolean;
55
+ /** Block files with no extension. Default: true */
56
+ blockNoExtension?: boolean;
57
+ /** Block double extensions (e.g., file.php.jpg). Default: true */
58
+ blockDoubleExtensions?: boolean;
59
+ }
60
+ /** File metadata for validation */
61
+ interface FileInput {
62
+ /** Original filename */
63
+ filename: string;
64
+ /** MIME type (as claimed by client) */
65
+ mimetype: string;
66
+ /** File size in bytes */
67
+ size: number;
68
+ /** File content buffer (for magic byte validation) */
69
+ buffer?: Buffer;
70
+ }
71
+ /** File validation result */
72
+ interface ValidateFileResult {
73
+ /** Whether the file passed validation */
74
+ valid: boolean;
75
+ /** Validation errors (empty if valid) */
76
+ errors: string[];
77
+ /** Sanitized filename (safe for storage) */
78
+ sanitizedFilename: string;
79
+ }
80
+ /**
81
+ * Sanitize a filename for safe storage.
82
+ *
83
+ * Strips path traversal, null bytes, control characters, and special characters.
84
+ * Preserves the extension and converts to a filesystem-safe name.
85
+ *
86
+ * @param filename - The original filename
87
+ * @returns A sanitized filename safe for storage
88
+ *
89
+ * @example
90
+ * sanitizeFilename('../../etc/passwd') // 'etc_passwd'
91
+ * sanitizeFilename('file<name>.jpg') // 'filename.jpg'
92
+ * sanitizeFilename('photo (1).jpg') // 'photo_1.jpg'
93
+ * sanitizeFilename('.htaccess') // 'htaccess'
94
+ */
95
+ declare function sanitizeFilename(filename: string): string;
96
+ /**
97
+ * Validate a file upload for security.
98
+ *
99
+ * Checks file size, MIME type, extension, magic bytes, and dangerous patterns.
100
+ * Returns a result with validation errors and a sanitized filename.
101
+ *
102
+ * @param file - File metadata and optional content
103
+ * @param options - Validation options
104
+ * @returns Validation result
105
+ *
106
+ * @example
107
+ * const result = validateFile(
108
+ * { filename: 'photo.jpg', mimetype: 'image/jpeg', size: 1024, buffer },
109
+ * { allowedTypes: ['image/jpeg', 'image/png'], maxSize: 2 * 1024 * 1024 }
110
+ * );
111
+ * if (!result.valid) {
112
+ * return res.status(400).json({ errors: result.errors });
113
+ * }
114
+ * // Use result.sanitizedFilename for storage
115
+ *
116
+ * @example
117
+ * // Block executables only (no whitelist)
118
+ * const result = validateFile(file, { blockExecutables: true });
119
+ */
120
+ declare function validateFile(file: FileInput, options?: ValidateFileOptions): ValidateFileResult;
121
+ /**
122
+ * Check if a file extension is considered dangerous/executable.
123
+ *
124
+ * @param filename - Filename or extension to check
125
+ * @returns true if the extension is dangerous
126
+ */
127
+ declare function isDangerousExtension(filename: string): boolean;
128
+
129
+ export { type FileInput as F, type ValidateFileOptions as V, type ValidateFileResult as a, validateFile as b, createValidator as c, isDangerousExtension as i, sanitizeFilename as s, validate as v };
@@ -0,0 +1,139 @@
1
+ export { C as CorsOptions, S as SecureCookieOptions, a as arcis, b as arcisFunction, c as createCors, d as createErrorHandler, e as createHeaders, f as createRateLimiter, g as createSecureCookies, b as default, h as enforceSecureCookie, i as errorHandler, r as rateLimit, s as safeCors, j as secureCookieDefaults, k as securityHeaders } from './index-JaFOUKyK.mjs';
2
+ export { c as createSanitizer, d as detectCommandInjection, a as detectHeaderInjection, b as detectNoSqlInjection, e as detectPathTraversal, f as detectPrototypePollution, g as detectSql, h as detectXss, k as isDangerousNoSqlKey, l as isDangerousProtoKey, s as sanitizeCommand, m as sanitizeHeaderValue, n as sanitizeHeaders, o as sanitizeObject, p as sanitizePath, q as sanitizeSql, r as sanitizeString, t as sanitizeXss } from './headers-DBQedhrb.mjs';
3
+ export { F as FileInput, V as ValidateFileOptions, a as ValidateFileResult, c as createValidator, i as isDangerousExtension, s as sanitizeFilename, v as validate, b as validateFile } from './index-nAgXexwD.mjs';
4
+ export { createRedactor, createSafeLogger, safeLog } from './logging/index.mjs';
5
+ export { MemoryStore, RedisClientLike, RedisStore, RedisStoreOptions, createRedisStore } from './stores/index.mjs';
6
+ 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-BOdL3ZWo.mjs';
7
+ export { ArcisError, ArcisValidationError, BLOCKED, ERRORS, HEADERS, INPUT, InputTooLargeError, RATE_LIMIT, REDACTION, RateLimitError, SanitizationError, SecurityThreatError, VALIDATION } from './core/index.mjs';
8
+ import 'express';
9
+
10
+ /**
11
+ * @module @arcis/node/validation/url
12
+ * SSRF (Server-Side Request Forgery) prevention
13
+ *
14
+ * Validates URLs to ensure they don't target private/internal networks,
15
+ * localhost, cloud metadata endpoints, or use dangerous protocols.
16
+ *
17
+ * @example
18
+ * import { validateUrl } from '@arcis/node';
19
+ *
20
+ * // Block SSRF attempts
21
+ * validateUrl('http://169.254.169.254/latest/meta-data/') // { safe: false, reason: 'link-local address' }
22
+ * validateUrl('http://10.0.0.1/admin') // { safe: false, reason: 'private address (10.0.0.0/8)' }
23
+ * validateUrl('http://localhost/secret') // { safe: false, reason: 'loopback address' }
24
+ * validateUrl('file:///etc/passwd') // { safe: false, reason: 'disallowed protocol: file:' }
25
+ *
26
+ * // Allow safe URLs
27
+ * validateUrl('https://api.example.com/data') // { safe: true }
28
+ */
29
+ /** Options for URL validation */
30
+ interface ValidateUrlOptions {
31
+ /** Allowed protocols. Default: ['http:', 'https:'] */
32
+ allowedProtocols?: string[];
33
+ /** Additional hostnames to block (e.g., internal service names) */
34
+ blockedHosts?: string[];
35
+ /** Additional hostnames to always allow (bypass IP checks) */
36
+ allowedHosts?: string[];
37
+ /** Allow localhost/loopback. Default: false */
38
+ allowLocalhost?: boolean;
39
+ /** Allow private/internal IPs. Default: false */
40
+ allowPrivate?: boolean;
41
+ }
42
+ /** Result of URL validation */
43
+ interface ValidateUrlResult {
44
+ /** Whether the URL is safe to fetch */
45
+ safe: boolean;
46
+ /** Reason the URL was blocked (only set when safe=false) */
47
+ reason?: string;
48
+ }
49
+ /**
50
+ * Validate a URL for SSRF safety.
51
+ *
52
+ * Checks:
53
+ * 1. Valid URL format
54
+ * 2. Allowed protocol (default: http, https only)
55
+ * 3. Not localhost/loopback (127.x.x.x, ::1, localhost)
56
+ * 4. Not private IP (10.x, 172.16-31.x, 192.168.x)
57
+ * 5. Not link-local (169.254.x.x — includes AWS/GCP/Azure metadata)
58
+ * 6. Not blocked hostname
59
+ * 7. No credentials in URL (user:pass@host)
60
+ *
61
+ * @param url - The URL string to validate
62
+ * @param options - Validation options
63
+ * @returns Validation result with safe flag and optional reason
64
+ */
65
+ declare function validateUrl(url: string, options?: ValidateUrlOptions): ValidateUrlResult;
66
+ /**
67
+ * Convenience wrapper that returns true/false.
68
+ *
69
+ * @param url - The URL to check
70
+ * @param options - Validation options
71
+ * @returns true if the URL is safe to fetch
72
+ */
73
+ declare function isUrlSafe(url: string, options?: ValidateUrlOptions): boolean;
74
+
75
+ /**
76
+ * @module @arcis/node/validation/redirect
77
+ * Open Redirect prevention
78
+ *
79
+ * Prevents attackers from using your app to redirect users to malicious sites
80
+ * via manipulated query parameters like ?returnUrl=http://evil.com
81
+ *
82
+ * @example
83
+ * import { validateRedirect, isRedirectSafe } from '@arcis/node';
84
+ *
85
+ * // Block open redirects
86
+ * validateRedirect('http://evil.com') // { safe: false, reason: 'absolute URL not in allowed hosts' }
87
+ * validateRedirect('//evil.com') // { safe: false, reason: 'protocol-relative URL not in allowed hosts' }
88
+ * validateRedirect('javascript:alert(1)') // { safe: false, reason: 'dangerous protocol: javascript:' }
89
+ *
90
+ * // Allow safe redirects
91
+ * validateRedirect('/dashboard') // { safe: true }
92
+ * validateRedirect('/users?page=2') // { safe: true }
93
+ * validateRedirect('https://myapp.com/home', { allowedHosts: ['myapp.com'] }) // { safe: true }
94
+ */
95
+ /** Options for redirect validation */
96
+ interface ValidateRedirectOptions {
97
+ /** Hostnames that are allowed for absolute URL redirects */
98
+ allowedHosts?: string[];
99
+ /** Allow protocol-relative URLs (//example.com). Default: false */
100
+ allowProtocolRelative?: boolean;
101
+ /** Allowed protocols for absolute URLs. Default: ['http:', 'https:'] */
102
+ allowedProtocols?: string[];
103
+ }
104
+ /** Result of redirect validation */
105
+ interface ValidateRedirectResult {
106
+ /** Whether the redirect URL is safe */
107
+ safe: boolean;
108
+ /** Reason the redirect was blocked (only set when safe=false) */
109
+ reason?: string;
110
+ }
111
+ /**
112
+ * Validate a redirect URL to prevent open redirect attacks.
113
+ *
114
+ * Safe redirects:
115
+ * - Relative paths: /dashboard, /users?page=2, ../settings
116
+ * - Absolute URLs to allowed hosts (when configured)
117
+ *
118
+ * Blocked redirects:
119
+ * - Absolute URLs to unknown hosts
120
+ * - Protocol-relative URLs (//evil.com)
121
+ * - javascript:, data:, vbscript:, blob: protocols
122
+ * - Backslash-prefixed paths (\\evil.com — browser treats as //)
123
+ * - URLs with control characters that could disguise the target
124
+ *
125
+ * @param url - The redirect target URL to validate
126
+ * @param options - Validation options
127
+ * @returns Validation result with safe flag and optional reason
128
+ */
129
+ declare function validateRedirect(url: string, options?: ValidateRedirectOptions): ValidateRedirectResult;
130
+ /**
131
+ * Convenience wrapper that returns true/false.
132
+ *
133
+ * @param url - The redirect URL to check
134
+ * @param options - Validation options
135
+ * @returns true if the redirect is safe
136
+ */
137
+ declare function isRedirectSafe(url: string, options?: ValidateRedirectOptions): boolean;
138
+
139
+ export { type ValidateRedirectOptions, type ValidateRedirectResult, type ValidateUrlOptions, type ValidateUrlResult, isRedirectSafe, isUrlSafe, validateRedirect, validateUrl };
@@ -0,0 +1,139 @@
1
+ export { C as CorsOptions, S as SecureCookieOptions, a as arcis, b as arcisFunction, c as createCors, d as createErrorHandler, e as createHeaders, f as createRateLimiter, g as createSecureCookies, b as default, h as enforceSecureCookie, i as errorHandler, r as rateLimit, s as safeCors, j as secureCookieDefaults, k as securityHeaders } from './index-BpT7flAQ.js';
2
+ export { c as createSanitizer, d as detectCommandInjection, a as detectHeaderInjection, b as detectNoSqlInjection, e as detectPathTraversal, f as detectPrototypePollution, g as detectSql, h as detectXss, k as isDangerousNoSqlKey, l as isDangerousProtoKey, s as sanitizeCommand, m as sanitizeHeaderValue, n as sanitizeHeaders, o as sanitizeObject, p as sanitizePath, q as sanitizeSql, r as sanitizeString, t as sanitizeXss } from './headers-BJq2OA0i.js';
3
+ export { F as FileInput, V as ValidateFileOptions, a as ValidateFileResult, c as createValidator, i as isDangerousExtension, s as sanitizeFilename, v as validate, b as validateFile } from './index-BgHPM7LC.js';
4
+ export { createRedactor, createSafeLogger, safeLog } from './logging/index.js';
5
+ export { MemoryStore, RedisClientLike, RedisStore, RedisStoreOptions, createRedisStore } from './stores/index.js';
6
+ 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-BOdL3ZWo.js';
7
+ export { ArcisError, ArcisValidationError, BLOCKED, ERRORS, HEADERS, INPUT, InputTooLargeError, RATE_LIMIT, REDACTION, RateLimitError, SanitizationError, SecurityThreatError, VALIDATION } from './core/index.js';
8
+ import 'express';
9
+
10
+ /**
11
+ * @module @arcis/node/validation/url
12
+ * SSRF (Server-Side Request Forgery) prevention
13
+ *
14
+ * Validates URLs to ensure they don't target private/internal networks,
15
+ * localhost, cloud metadata endpoints, or use dangerous protocols.
16
+ *
17
+ * @example
18
+ * import { validateUrl } from '@arcis/node';
19
+ *
20
+ * // Block SSRF attempts
21
+ * validateUrl('http://169.254.169.254/latest/meta-data/') // { safe: false, reason: 'link-local address' }
22
+ * validateUrl('http://10.0.0.1/admin') // { safe: false, reason: 'private address (10.0.0.0/8)' }
23
+ * validateUrl('http://localhost/secret') // { safe: false, reason: 'loopback address' }
24
+ * validateUrl('file:///etc/passwd') // { safe: false, reason: 'disallowed protocol: file:' }
25
+ *
26
+ * // Allow safe URLs
27
+ * validateUrl('https://api.example.com/data') // { safe: true }
28
+ */
29
+ /** Options for URL validation */
30
+ interface ValidateUrlOptions {
31
+ /** Allowed protocols. Default: ['http:', 'https:'] */
32
+ allowedProtocols?: string[];
33
+ /** Additional hostnames to block (e.g., internal service names) */
34
+ blockedHosts?: string[];
35
+ /** Additional hostnames to always allow (bypass IP checks) */
36
+ allowedHosts?: string[];
37
+ /** Allow localhost/loopback. Default: false */
38
+ allowLocalhost?: boolean;
39
+ /** Allow private/internal IPs. Default: false */
40
+ allowPrivate?: boolean;
41
+ }
42
+ /** Result of URL validation */
43
+ interface ValidateUrlResult {
44
+ /** Whether the URL is safe to fetch */
45
+ safe: boolean;
46
+ /** Reason the URL was blocked (only set when safe=false) */
47
+ reason?: string;
48
+ }
49
+ /**
50
+ * Validate a URL for SSRF safety.
51
+ *
52
+ * Checks:
53
+ * 1. Valid URL format
54
+ * 2. Allowed protocol (default: http, https only)
55
+ * 3. Not localhost/loopback (127.x.x.x, ::1, localhost)
56
+ * 4. Not private IP (10.x, 172.16-31.x, 192.168.x)
57
+ * 5. Not link-local (169.254.x.x — includes AWS/GCP/Azure metadata)
58
+ * 6. Not blocked hostname
59
+ * 7. No credentials in URL (user:pass@host)
60
+ *
61
+ * @param url - The URL string to validate
62
+ * @param options - Validation options
63
+ * @returns Validation result with safe flag and optional reason
64
+ */
65
+ declare function validateUrl(url: string, options?: ValidateUrlOptions): ValidateUrlResult;
66
+ /**
67
+ * Convenience wrapper that returns true/false.
68
+ *
69
+ * @param url - The URL to check
70
+ * @param options - Validation options
71
+ * @returns true if the URL is safe to fetch
72
+ */
73
+ declare function isUrlSafe(url: string, options?: ValidateUrlOptions): boolean;
74
+
75
+ /**
76
+ * @module @arcis/node/validation/redirect
77
+ * Open Redirect prevention
78
+ *
79
+ * Prevents attackers from using your app to redirect users to malicious sites
80
+ * via manipulated query parameters like ?returnUrl=http://evil.com
81
+ *
82
+ * @example
83
+ * import { validateRedirect, isRedirectSafe } from '@arcis/node';
84
+ *
85
+ * // Block open redirects
86
+ * validateRedirect('http://evil.com') // { safe: false, reason: 'absolute URL not in allowed hosts' }
87
+ * validateRedirect('//evil.com') // { safe: false, reason: 'protocol-relative URL not in allowed hosts' }
88
+ * validateRedirect('javascript:alert(1)') // { safe: false, reason: 'dangerous protocol: javascript:' }
89
+ *
90
+ * // Allow safe redirects
91
+ * validateRedirect('/dashboard') // { safe: true }
92
+ * validateRedirect('/users?page=2') // { safe: true }
93
+ * validateRedirect('https://myapp.com/home', { allowedHosts: ['myapp.com'] }) // { safe: true }
94
+ */
95
+ /** Options for redirect validation */
96
+ interface ValidateRedirectOptions {
97
+ /** Hostnames that are allowed for absolute URL redirects */
98
+ allowedHosts?: string[];
99
+ /** Allow protocol-relative URLs (//example.com). Default: false */
100
+ allowProtocolRelative?: boolean;
101
+ /** Allowed protocols for absolute URLs. Default: ['http:', 'https:'] */
102
+ allowedProtocols?: string[];
103
+ }
104
+ /** Result of redirect validation */
105
+ interface ValidateRedirectResult {
106
+ /** Whether the redirect URL is safe */
107
+ safe: boolean;
108
+ /** Reason the redirect was blocked (only set when safe=false) */
109
+ reason?: string;
110
+ }
111
+ /**
112
+ * Validate a redirect URL to prevent open redirect attacks.
113
+ *
114
+ * Safe redirects:
115
+ * - Relative paths: /dashboard, /users?page=2, ../settings
116
+ * - Absolute URLs to allowed hosts (when configured)
117
+ *
118
+ * Blocked redirects:
119
+ * - Absolute URLs to unknown hosts
120
+ * - Protocol-relative URLs (//evil.com)
121
+ * - javascript:, data:, vbscript:, blob: protocols
122
+ * - Backslash-prefixed paths (\\evil.com — browser treats as //)
123
+ * - URLs with control characters that could disguise the target
124
+ *
125
+ * @param url - The redirect target URL to validate
126
+ * @param options - Validation options
127
+ * @returns Validation result with safe flag and optional reason
128
+ */
129
+ declare function validateRedirect(url: string, options?: ValidateRedirectOptions): ValidateRedirectResult;
130
+ /**
131
+ * Convenience wrapper that returns true/false.
132
+ *
133
+ * @param url - The redirect URL to check
134
+ * @param options - Validation options
135
+ * @returns true if the redirect is safe
136
+ */
137
+ declare function isRedirectSafe(url: string, options?: ValidateRedirectOptions): boolean;
138
+
139
+ export { type ValidateRedirectOptions, type ValidateRedirectResult, type ValidateUrlOptions, type ValidateUrlResult, isRedirectSafe, isUrlSafe, validateRedirect, validateUrl };