@heroku/js-blanket 1.0.0 → 1.0.1

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.
@@ -57,7 +57,7 @@ export interface ScrubConfig {
57
57
  * ]
58
58
  * ```
59
59
  */
60
- fields?: (string | RegExp)[];
60
+ fields?: readonly (string | RegExp)[];
61
61
  /**
62
62
  * Path-based scrubbing: matches specific dot-notation paths
63
63
  *
@@ -74,7 +74,7 @@ export interface ScrubConfig {
74
74
  * ]
75
75
  * ```
76
76
  */
77
- paths?: string[];
77
+ paths?: readonly string[];
78
78
  /**
79
79
  * Pattern-based scrubbing: regex patterns for content scrubbing
80
80
  *
@@ -92,7 +92,7 @@ export interface ScrubConfig {
92
92
  * ]
93
93
  * ```
94
94
  */
95
- patterns?: RegExp[];
95
+ patterns?: readonly RegExp[];
96
96
  /**
97
97
  * Replacement string for scrubbed values
98
98
  *
@@ -120,6 +120,30 @@ export interface ScrubConfig {
120
120
  * ```
121
121
  */
122
122
  recursive?: boolean;
123
+ /**
124
+ * Maximum depth for object traversal (F5: DoS prevention)
125
+ *
126
+ * Limits how deep the scrubber will traverse nested objects to prevent
127
+ * stack overflow from maliciously crafted deeply nested payloads.
128
+ *
129
+ * @default 100
130
+ *
131
+ * @example
132
+ * ```typescript
133
+ * maxDepth: 50 // Limit to 50 levels of nesting
134
+ * maxDepth: Infinity // No limit (backward compatible)
135
+ * ```
136
+ */
137
+ maxDepth?: number;
138
+ /**
139
+ * Behavior when max depth is exceeded
140
+ *
141
+ * - 'truncate': Replace the value with '[MAX_DEPTH_EXCEEDED]' (default)
142
+ * - 'throw': Throw an error with the path where depth was exceeded
143
+ *
144
+ * @default 'truncate'
145
+ */
146
+ maxDepthBehavior?: 'truncate' | 'throw';
123
147
  }
124
148
  /**
125
149
  * Result of a scrub operation
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@heroku/js-blanket",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Framework-agnostic sensitive data scrubbing library for error monitoring and logging",
5
5
  "type": "module",
6
+ "packageManager": "pnpm@10.26.0",
6
7
  "engines": {
7
8
  "node": ">=20.0.0"
8
9
  },
@@ -16,27 +17,43 @@
16
17
  "types": "./dist/esm/index.d.ts"
17
18
  }
18
19
  },
20
+ "scripts": {
21
+ "build:cjs": "rm -rf dist/cjs && tsc -p tsconfig.cjs.json && mkdir -p dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
22
+ "build:esm": "rm -rf dist/esm && tsc -p tsconfig.esm.json",
23
+ "build": "pnpm run build:cjs && pnpm run build:esm",
24
+ "test": "c8 mocha --require ./scripts/test-setup.mjs --forbid-only \"dist/esm/**/*.test.js\"",
25
+ "prepare": "husky && pnpm run build",
26
+ "lint": "eslint \"src/**/*.{js,ts}\"",
27
+ "lint:fix": "eslint \"src/**/*.{js,ts}\" --fix",
28
+ "prettier": "prettier . --write",
29
+ "format": "pnpm run prettier && pnpm run lint:fix",
30
+ "pretest": "pnpm run build:cjs && pnpm run build:esm && pnpm run type-check",
31
+ "type-check": "tsc --noEmit -p tsconfig.json",
32
+ "lint-staged": "npx lint-staged",
33
+ "check": "pnpm run format && pnpm run type-check && pnpm test",
34
+ "ci": "pnpm run lint && pnpm run type-check && pnpm test"
35
+ },
19
36
  "dependencies": {
20
37
  "tslib": "^2.8.1"
21
38
  },
22
39
  "devDependencies": {
23
- "@eslint/js": "^9.39.1",
40
+ "@eslint/js": "^9.39.4",
24
41
  "@types/chai": "^5.2.3",
25
42
  "@types/mocha": "^10.0.10",
26
- "@types/node": "^24.10.0",
27
- "@typescript-eslint/eslint-plugin": "^8.46.3",
28
- "@typescript-eslint/parser": "^8.46.3",
43
+ "@types/node": "^25.9.3",
44
+ "@typescript-eslint/eslint-plugin": "^8.61.1",
45
+ "@typescript-eslint/parser": "^8.61.1",
29
46
  "c8": "^10.1.3",
30
- "chai": "^6.2.0",
31
- "eslint": "^9.39.1",
47
+ "chai": "^6.2.2",
48
+ "eslint": "^9.39.4",
49
+ "glob": "^10.5.0",
32
50
  "husky": "^9.1.7",
33
- "lint-staged": "^16.2.6",
34
- "mocha": "^11.7.5",
35
- "prettier": "^3.6.2",
51
+ "lint-staged": "^16.4.0",
52
+ "mocha": "^11.7.6",
53
+ "prettier": "^3.8.4",
36
54
  "typescript": "^5.9.3"
37
55
  },
38
56
  "publishConfig": {
39
- "access": "restricted",
40
57
  "registry": "https://registry.npmjs.org/"
41
58
  },
42
59
  "files": [
@@ -59,20 +76,5 @@
59
76
  "data-sanitization",
60
77
  "error-monitoring",
61
78
  "logging"
62
- ],
63
- "scripts": {
64
- "build:cjs": "rm -rf dist/cjs && tsc -p tsconfig.cjs.json && mkdir -p dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
65
- "build:esm": "rm -rf dist/esm && tsc -p tsconfig.esm.json",
66
- "build": "pnpm run build:cjs && pnpm run build:esm",
67
- "test": "c8 mocha --require ./scripts/test-setup.mjs --forbid-only \"dist/esm/**/*.test.js\"",
68
- "lint": "eslint \"src/**/*.{js,ts}\"",
69
- "lint:fix": "eslint \"src/**/*.{js,ts}\" --fix",
70
- "prettier": "prettier . --write",
71
- "format": "pnpm run prettier && pnpm run lint:fix",
72
- "pretest": "pnpm run build:cjs && pnpm run build:esm && pnpm run type-check",
73
- "type-check": "tsc --noEmit -p tsconfig.json",
74
- "lint-staged": "npx lint-staged",
75
- "check": "pnpm run format && pnpm run type-check && pnpm test",
76
- "ci": "pnpm run lint && pnpm run type-check && pnpm test"
77
- }
78
- }
79
+ ]
80
+ }