@scalar/helpers 0.1.2 → 0.1.3
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @scalar/helpers
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#7387](https://github.com/scalar/scalar/pull/7387) [`bfd814a`](https://github.com/scalar/scalar/commit/bfd814a4219660face190041cc4845182b56ab03) Thanks [@geoffgscott](https://github.com/geoffgscott)! - hotfix: patch exports from build tooling bug
|
|
8
|
+
|
|
9
|
+
- [#7416](https://github.com/scalar/scalar/pull/7416) [`86f028d`](https://github.com/scalar/scalar/commit/86f028deb0b456f923edd261f5f4b0fa9b616b7d) Thanks [@amritk](https://github.com/amritk)! - feat: add update method to client v2
|
|
10
|
+
|
|
3
11
|
## 0.1.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates that a key is safe to use and does not pose a prototype pollution risk.
|
|
3
|
+
* Throws an error if a dangerous key is detected.
|
|
4
|
+
*
|
|
5
|
+
* @param key - The key to validate
|
|
6
|
+
* @param context - Optional context string to help identify where the validation failed
|
|
7
|
+
* @throws {Error} If the key matches a known prototype pollution vector
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* preventPollution('__proto__') // throws Error
|
|
12
|
+
* preventPollution('safeName') // passes
|
|
13
|
+
* preventPollution('constructor', 'operation update') // throws Error with context
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const preventPollution: (key: string, context?: string) => void;
|
|
17
|
+
//# sourceMappingURL=prevent-pollution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prevent-pollution.d.ts","sourceRoot":"","sources":["../../src/object/prevent-pollution.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,EAAE,UAAU,MAAM,KAAG,IAQhE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const PROTOTYPE_POLLUTION_KEYS = ["__proto__", "prototype", "constructor"];
|
|
2
|
+
const preventPollution = (key, context) => {
|
|
3
|
+
if (PROTOTYPE_POLLUTION_KEYS.includes(key)) {
|
|
4
|
+
const errorMessage = context ? `Prototype pollution key detected: "${key}" in ${context}` : `Prototype pollution key detected: "${key}"`;
|
|
5
|
+
throw new Error(errorMessage);
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
preventPollution
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=prevent-pollution.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/object/prevent-pollution.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * List of dangerous keys that can be used for prototype pollution attacks.\n * These keys should never be used as property names in dynamic object operations.\n */\nconst PROTOTYPE_POLLUTION_KEYS = ['__proto__', 'prototype', 'constructor'] as const\n\n/**\n * Validates that a key is safe to use and does not pose a prototype pollution risk.\n * Throws an error if a dangerous key is detected.\n *\n * @param key - The key to validate\n * @param context - Optional context string to help identify where the validation failed\n * @throws {Error} If the key matches a known prototype pollution vector\n *\n * @example\n * ```ts\n * preventPollution('__proto__') // throws Error\n * preventPollution('safeName') // passes\n * preventPollution('constructor', 'operation update') // throws Error with context\n * ```\n */\nexport const preventPollution = (key: string, context?: string): void => {\n if (PROTOTYPE_POLLUTION_KEYS.includes(key as never)) {\n const errorMessage = context\n ? `Prototype pollution key detected: \"${key}\" in ${context}`\n : `Prototype pollution key detected: \"${key}\"`\n\n throw new Error(errorMessage)\n }\n}\n"],
|
|
5
|
+
"mappings": "AAIA,MAAM,2BAA2B,CAAC,aAAa,aAAa,aAAa;AAiBlE,MAAM,mBAAmB,CAAC,KAAa,YAA2B;AACvE,MAAI,yBAAyB,SAAS,GAAY,GAAG;AACnD,UAAM,eAAe,UACjB,sCAAsC,GAAG,QAAQ,OAAO,KACxD,sCAAsC,GAAG;AAE7C,UAAM,IAAI,MAAM,YAAY;AAAA,EAC9B;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"helpers",
|
|
15
15
|
"js"
|
|
16
16
|
],
|
|
17
|
-
"version": "0.1.
|
|
17
|
+
"version": "0.1.3",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=20"
|
|
20
20
|
},
|
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"types": "./dist/array/*.d.ts",
|
|
28
28
|
"default": "./dist/array/*.js"
|
|
29
29
|
},
|
|
30
|
+
"./crypto/*": {
|
|
31
|
+
"import": "./dist/crypto/*.js",
|
|
32
|
+
"types": "./dist/crypto/*.d.ts",
|
|
33
|
+
"default": "./dist/crypto/*.js"
|
|
34
|
+
},
|
|
30
35
|
"./dom/*": {
|
|
31
36
|
"import": "./dist/dom/*.js",
|
|
32
37
|
"types": "./dist/dom/*.d.ts",
|
|
@@ -76,11 +81,6 @@
|
|
|
76
81
|
"import": "./dist/url/*.js",
|
|
77
82
|
"types": "./dist/url/*.d.ts",
|
|
78
83
|
"default": "./dist/url/*.js"
|
|
79
|
-
},
|
|
80
|
-
"./crypto/*": {
|
|
81
|
-
"import": "./dist/crypto/*.js",
|
|
82
|
-
"types": "./dist/crypto/*.d.ts",
|
|
83
|
-
"default": "./dist/crypto/*.js"
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
"files": [
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"jsdom": "26.1.0",
|
|
92
92
|
"vite": "7.1.11",
|
|
93
93
|
"vitest": "3.2.4",
|
|
94
|
-
"@scalar/build-tooling": "0.3.
|
|
94
|
+
"@scalar/build-tooling": "0.3.1"
|
|
95
95
|
},
|
|
96
96
|
"scripts": {
|
|
97
97
|
"build": "scalar-build-esbuild",
|