@checkstack/healthcheck-ping-backend 0.2.0 → 0.2.2

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,48 @@
1
1
  # @checkstack/healthcheck-ping-backend
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 0ebbe56: Security Vulnerability Remediation completed:
8
+ - Refactored core authorization to Fail-Closed architecture with secure defaults.
9
+ - Implemented `assertTeamManagementAccess` to resolve BOLA in Teams Management.
10
+ - Protected internal S2S capabilities via explicit wildcard `serviceScope` definitions.
11
+ - Disarmed OS Command Injection in DiskCollector via strict regex validation and bash escaping.
12
+ - Re-architected inline script processing executing scripts in sandboxed Web Worker contexts.
13
+ - Isolated subprocess environment scopes in PingStrategy limiting variable leakage.
14
+ - Enforced strict token/API Key parsing with URLSearchParams checking.
15
+ - Explicitly fail-fast on missing DATABASE_URL configuration across independent backend clusters.
16
+ - Activated strict HTTP Security Headers (HSTS, CSP, X-Frame-Options) across the API automatically.
17
+ - Updated dependencies [0ebbe56]
18
+ - @checkstack/backend-api@0.8.1
19
+ - @checkstack/common@0.6.3
20
+ - @checkstack/healthcheck-common@0.8.3
21
+
22
+ ## 0.2.1
23
+
24
+ ### Patch Changes
25
+
26
+ - 869b4ab: ## Health Check Execution Improvements
27
+
28
+ ### Breaking Changes (backend-api)
29
+
30
+ - `HealthCheckStrategy.createClient()` now accepts `unknown` instead of `TConfig` due to TypeScript contravariance constraints. Implementations should use `this.config.validate(config)` to narrow the type.
31
+
32
+ ### Features
33
+
34
+ - **Platform-level hard timeout**: The executor now wraps the entire health check execution (connection + all collectors) in a single timeout, ensuring checks never hang indefinitely.
35
+ - **Parallel collector execution**: Collectors now run in parallel using `Promise.allSettled()`, improving performance while ensuring all collectors complete regardless of individual failures.
36
+ - **Base strategy config schema**: All strategy configs now extend `baseStrategyConfigSchema` which provides a standardized `timeout` field with sensible defaults (30s, min 100ms).
37
+
38
+ ### Fixes
39
+
40
+ - Fixed HTTP and Jenkins strategies clearing timeouts before reading the full response body.
41
+ - Simplified registry type signatures by using default type parameters.
42
+
43
+ - Updated dependencies [869b4ab]
44
+ - @checkstack/backend-api@0.8.0
45
+
3
46
  ## 0.2.0
4
47
 
5
48
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/healthcheck-ping-backend",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
@@ -9,9 +9,9 @@
9
9
  "lint:code": "eslint . --max-warnings 0"
10
10
  },
11
11
  "dependencies": {
12
- "@checkstack/backend-api": "0.5.2",
13
- "@checkstack/common": "0.6.1",
14
- "@checkstack/healthcheck-common": "0.8.1"
12
+ "@checkstack/backend-api": "0.8.0",
13
+ "@checkstack/common": "0.6.2",
14
+ "@checkstack/healthcheck-common": "0.8.2"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@types/bun": "^1.0.0",
@@ -202,4 +202,51 @@ describe("PingHealthCheckStrategy", () => {
202
202
  expect(aggregated.errorCount.count).toBe(1);
203
203
  });
204
204
  });
205
+ describe("Environment Isolation", () => {
206
+ it("should pass explicit env to Bun.spawn with only PATH, HOME, and LANG", async () => {
207
+ let spawnOptions: any = null;
208
+ Bun.spawn = mock((options) => {
209
+ spawnOptions = options;
210
+ throw new Error("Command not found");
211
+ });
212
+
213
+ const connectedClient = await strategy.createClient({ timeout: 5000 });
214
+ await connectedClient.client.exec({
215
+ host: "8.8.8.8",
216
+ count: 3,
217
+ timeout: 5000,
218
+ });
219
+
220
+ expect(spawnOptions).toBeDefined();
221
+ expect(spawnOptions.env).toBeDefined();
222
+ expect(spawnOptions.env.PATH).toBeDefined();
223
+ expect(spawnOptions.env.HOME).toBeDefined();
224
+ expect(spawnOptions.env.LANG).toBeDefined();
225
+ expect(spawnOptions.env.DATABASE_URL).toBeUndefined();
226
+
227
+ connectedClient.close();
228
+ });
229
+
230
+ it("should not leak parent process environment variables", async () => {
231
+ let spawnOptions: any = null;
232
+ Bun.spawn = mock((options) => {
233
+ spawnOptions = options;
234
+ throw new Error("Command not found");
235
+ });
236
+
237
+ process.env.SUPER_SECRET = "leaked";
238
+
239
+ const connectedClient = await strategy.createClient({ timeout: 5000 });
240
+ await connectedClient.client.exec({
241
+ host: "8.8.8.8",
242
+ count: 3,
243
+ timeout: 5000,
244
+ });
245
+
246
+ expect(spawnOptions.env.SUPER_SECRET).toBeUndefined();
247
+ delete process.env.SUPER_SECRET;
248
+
249
+ connectedClient.close();
250
+ });
251
+ });
205
252
  });
package/src/strategy.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  z,
13
13
  type ConnectedClient,
14
14
  type InferAggregatedResult,
15
+ baseStrategyConfigSchema,
15
16
  } from "@checkstack/backend-api";
16
17
  import {
17
18
  healthResultNumber,
@@ -32,13 +33,7 @@ import type {
32
33
  * Configuration schema for Ping health checks.
33
34
  * Global defaults only - action params moved to PingCollector.
34
35
  */
35
- export const pingConfigSchema = z.object({
36
- timeout: z
37
- .number()
38
- .min(100)
39
- .default(5000)
40
- .describe("Default timeout in milliseconds"),
41
- });
36
+ export const pingConfigSchema = baseStrategyConfigSchema.extend({});
42
37
 
43
38
  export type PingConfig = z.infer<typeof pingConfigSchema>;
44
39
 
@@ -220,6 +215,12 @@ export class PingHealthCheckStrategy implements HealthCheckStrategy<
220
215
  cmd: ["ping", ...args],
221
216
  stdout: "pipe",
222
217
  stderr: "pipe",
218
+ env: {
219
+ // SECURITY: Only pass necessary env vars to subprocess
220
+ PATH: process.env.PATH ?? "/usr/bin:/bin:/usr/sbin:/sbin",
221
+ HOME: process.env.HOME ?? "/tmp",
222
+ LANG: process.env.LANG ?? "en_US.UTF-8",
223
+ },
223
224
  });
224
225
 
225
226
  const output = await new Response(proc.stdout).text();