@stacksjs/router 0.72.86 → 0.72.89
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/path-sanitize.js +1 -1
- package/package.json +11 -11
package/dist/path-sanitize.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export class PathParamError extends Error{reason;constructor(reason,value,context){const ctx=context?` in ${context}`:"";super(`[router] Refusing to use ${JSON.stringify(value)} as a path parameter${ctx} - ${reason}`);this.name="PathParamError";this.reason=reason}}const CONTROL_CHARS=/[\
|
|
1
|
+
export class PathParamError extends Error{reason;constructor(reason,value,context){const ctx=context?` in ${context}`:"";super(`[router] Refusing to use ${JSON.stringify(value)} as a path parameter${ctx} - ${reason}`);this.name="PathParamError";this.reason=reason}}const CONTROL_CHARS=/[\x00-\x1F\x7F]/;export function sanitizePathParam(value,options={}){if(typeof value!=="string")throw new PathParamError("not-string",value,options.context);if(value.length===0)throw new PathParamError("empty",value,options.context);const maxLength=options.maxLength??255;if(value.length>maxLength)throw new PathParamError("too-long",value,options.context);if(value.includes("\x00"))throw new PathParamError("null-byte",value,options.context);if(CONTROL_CHARS.test(value))throw new PathParamError("control-char",value,options.context);if(value.startsWith("/")||/^[A-Z]:[\\/]/i.test(value))throw new PathParamError("absolute-path",value,options.context);if(/(^|[\\/])\.\.([\\/]|$)/.test(value))throw new PathParamError("traversal",value,options.context);if(!options.allowSlashes&&/[\\/]/.test(value))throw new PathParamError("traversal",value,options.context);return value}export function safePathParam(value,options={}){try{return sanitizePathParam(value,options)}catch{return null}}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/router",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.72.
|
|
5
|
+
"version": "0.72.89",
|
|
6
6
|
"description": "The Stacks framework router.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@stacksjs/bun-router": "^0.1.8",
|
|
64
|
-
"@stacksjs/collections": "0.72.
|
|
64
|
+
"@stacksjs/collections": "0.72.89",
|
|
65
65
|
"ts-rate-limiter": "^0.4.2"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@stacksjs/actions": "0.72.
|
|
69
|
-
"@stacksjs/config": "0.72.
|
|
68
|
+
"@stacksjs/actions": "0.72.89",
|
|
69
|
+
"@stacksjs/config": "0.72.89",
|
|
70
70
|
"better-dx": "^0.2.24",
|
|
71
|
-
"@stacksjs/error-handling": "0.72.
|
|
72
|
-
"@stacksjs/logging": "0.72.
|
|
73
|
-
"@stacksjs/orm": "0.72.
|
|
74
|
-
"@stacksjs/path": "0.72.
|
|
75
|
-
"@stacksjs/storage": "0.72.
|
|
76
|
-
"@stacksjs/types": "0.72.
|
|
77
|
-
"@stacksjs/validation": "0.72.
|
|
71
|
+
"@stacksjs/error-handling": "0.72.89",
|
|
72
|
+
"@stacksjs/logging": "0.72.89",
|
|
73
|
+
"@stacksjs/orm": "0.72.89",
|
|
74
|
+
"@stacksjs/path": "0.72.89",
|
|
75
|
+
"@stacksjs/storage": "0.72.89",
|
|
76
|
+
"@stacksjs/types": "0.72.89",
|
|
77
|
+
"@stacksjs/validation": "0.72.89"
|
|
78
78
|
}
|
|
79
79
|
}
|