Skip to content

Commit 1b62452

Browse files
committed
build: update bundled dist files
1 parent 187c339 commit 1b62452

File tree

9 files changed

+165
-44
lines changed

9 files changed

+165
-44
lines changed

dist/index.js

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env node
22
process.env.VISOR_VERSION = '0.1.42';
33
process.env.PROBE_VERSION = '0.6.0-rc196';
4-
process.env.VISOR_COMMIT_SHA = '8a20306e9bc48e85fc025cf8da037d8728958df9';
5-
process.env.VISOR_COMMIT_SHORT = '8a20306e';
4+
process.env.VISOR_COMMIT_SHA = '187c3397892ea711fe760101774035e24dd3639a';
5+
process.env.VISOR_COMMIT_SHORT = '187c3397';
66
/******/ (() => { // webpackBootstrap
77
/******/ var __webpack_modules__ = ({
88

@@ -138833,7 +138833,8 @@ class AICheckProvider extends check_provider_interface_1.CheckProvider {
138833138833
// Fallback NDJSON for input context (non-OTEL environments)
138834138834
try {
138835138835
const checkId = config.checkName || config.id || 'unknown';
138836-
const ctxJson = JSON.stringify(templateContext);
138836+
// Sanitize context to avoid leaking API keys in traces
138837+
const ctxJson = JSON.stringify((0, state_capture_1.sanitizeContextForTelemetry)(templateContext));
138837138838
const { emitNdjsonSpanWithEvents } = __nccwpck_require__(35938);
138838138839
emitNdjsonSpanWithEvents('visor.check', { 'visor.check.id': checkId, 'visor.check.input.context': ctxJson }, []);
138839138840
}
@@ -140125,7 +140126,8 @@ class CommandCheckProvider extends check_provider_interface_1.CheckProvider {
140125140126
// Fallback NDJSON for input context (non-OTEL environments)
140126140127
try {
140127140128
const checkId = config.checkName || config.id || 'unknown';
140128-
const ctxJson = JSON.stringify(templateContext);
140129+
// Sanitize context to avoid leaking API keys in traces
140130+
const ctxJson = JSON.stringify((0, state_capture_1.sanitizeContextForTelemetry)(templateContext));
140129140131
const { emitNdjsonSpanWithEvents } = __nccwpck_require__(35938);
140130140132
// Emit both start and completion markers together for deterministic E2E assertions
140131140133
emitNdjsonSpanWithEvents('visor.check', { 'visor.check.id': checkId, 'visor.check.input.context': ctxJson }, [{ name: 'check.started' }, { name: 'check.completed' }]);
@@ -158754,6 +158756,7 @@ function patchConsole() {
158754158756
* attributes, enabling time-travel debugging and full state inspection.
158755158757
*/
158756158758
Object.defineProperty(exports, "__esModule", ({ value: true }));
158759+
exports.sanitizeContextForTelemetry = sanitizeContextForTelemetry;
158757158760
exports.captureCheckInputContext = captureCheckInputContext;
158758158761
exports.captureCheckOutput = captureCheckOutput;
158759158762
exports.captureForEachState = captureForEachState;
@@ -158765,6 +158768,47 @@ exports.captureRoutingDecision = captureRoutingDecision;
158765158768
exports.captureStateSnapshot = captureStateSnapshot;
158766158769
const MAX_ATTRIBUTE_LENGTH = 10000; // Truncate large values
158767158770
const MAX_ARRAY_ITEMS = 100; // Limit array size in attributes
158771+
// Patterns that indicate sensitive environment variables (case-insensitive)
158772+
const SENSITIVE_ENV_PATTERNS = [
158773+
/api[_-]?key/i,
158774+
/secret/i,
158775+
/token/i,
158776+
/password/i,
158777+
/auth/i,
158778+
/credential/i,
158779+
/private[_-]?key/i,
158780+
/^sk-/i, // OpenAI-style keys
158781+
/^AIza/i, // Google API keys
158782+
];
158783+
/**
158784+
* Check if an environment variable name is sensitive
158785+
*/
158786+
function isSensitiveEnvVar(name) {
158787+
return SENSITIVE_ENV_PATTERNS.some(pattern => pattern.test(name));
158788+
}
158789+
/**
158790+
* Sanitize context for telemetry by redacting sensitive environment variables.
158791+
* Returns a new object with env values redacted (keys preserved).
158792+
*/
158793+
function sanitizeContextForTelemetry(context) {
158794+
if (!context || typeof context !== 'object')
158795+
return context;
158796+
const sanitized = { ...context };
158797+
// Sanitize env object if present
158798+
if (sanitized.env && typeof sanitized.env === 'object') {
158799+
const sanitizedEnv = {};
158800+
for (const [key, value] of Object.entries(sanitized.env)) {
158801+
if (isSensitiveEnvVar(key)) {
158802+
sanitizedEnv[key] = '[REDACTED]';
158803+
}
158804+
else {
158805+
sanitizedEnv[key] = String(value);
158806+
}
158807+
}
158808+
sanitized.env = sanitizedEnv;
158809+
}
158810+
return sanitized;
158811+
}
158768158812
/**
158769158813
* Safely serialize a value for OTEL span attributes.
158770158814
* Handles truncation, circular refs, and type conversions.
@@ -158801,21 +158845,24 @@ function safeSerialize(value, maxLength = MAX_ATTRIBUTE_LENGTH) {
158801158845
*/
158802158846
function captureCheckInputContext(span, context) {
158803158847
try {
158848+
// Sanitize context to redact sensitive env vars before capturing
158849+
const sanitizedContext = sanitizeContextForTelemetry(context);
158804158850
// Capture key context variables
158805-
const keys = Object.keys(context);
158851+
const keys = Object.keys(sanitizedContext);
158806158852
span.setAttribute('visor.check.input.keys', keys.join(','));
158807158853
span.setAttribute('visor.check.input.count', keys.length);
158808-
// Capture full context as JSON (with size limit)
158809-
span.setAttribute('visor.check.input.context', safeSerialize(context));
158854+
// Capture full context as JSON (with size limit) - now sanitized
158855+
span.setAttribute('visor.check.input.context', safeSerialize(sanitizedContext));
158810158856
// Capture specific important variables separately for easy querying
158811-
if (context.pr) {
158812-
span.setAttribute('visor.check.input.pr', safeSerialize(context.pr, 1000));
158857+
// Use sanitizedContext consistently to avoid leaking sensitive data
158858+
if (sanitizedContext.pr) {
158859+
span.setAttribute('visor.check.input.pr', safeSerialize(sanitizedContext.pr, 1000));
158813158860
}
158814-
if (context.outputs) {
158815-
span.setAttribute('visor.check.input.outputs', safeSerialize(context.outputs, 5000));
158861+
if (sanitizedContext.outputs) {
158862+
span.setAttribute('visor.check.input.outputs', safeSerialize(sanitizedContext.outputs, 5000));
158816158863
}
158817-
if (context.env) {
158818-
span.setAttribute('visor.check.input.env_keys', Object.keys(context.env).join(','));
158864+
if (sanitizedContext.env) {
158865+
span.setAttribute('visor.check.input.env_keys', Object.keys(sanitizedContext.env).join(','));
158819158866
}
158820158867
}
158821158868
catch (err) {

dist/sdk/check-provider-registry-U7K54IC3.mjs renamed to dist/sdk/check-provider-registry-534KL5HT.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
CheckProviderRegistry,
33
init_check_provider_registry
4-
} from "./chunk-VW46O2SP.mjs";
4+
} from "./chunk-23L3QRYX.mjs";
55
import "./chunk-NAW3DB3I.mjs";
66
import "./chunk-AUT26LHW.mjs";
77
import "./chunk-HTOKWMPO.mjs";
@@ -24,4 +24,4 @@ init_check_provider_registry();
2424
export {
2525
CheckProviderRegistry
2626
};
27-
//# sourceMappingURL=check-provider-registry-U7K54IC3.mjs.map
27+
//# sourceMappingURL=check-provider-registry-534KL5HT.mjs.map
File renamed without changes.
Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,8 +2483,28 @@ __export(state_capture_exports, {
24832483
captureProviderCall: () => captureProviderCall,
24842484
captureRoutingDecision: () => captureRoutingDecision,
24852485
captureStateSnapshot: () => captureStateSnapshot,
2486-
captureTransformJS: () => captureTransformJS
2486+
captureTransformJS: () => captureTransformJS,
2487+
sanitizeContextForTelemetry: () => sanitizeContextForTelemetry
24872488
});
2489+
function isSensitiveEnvVar(name) {
2490+
return SENSITIVE_ENV_PATTERNS.some((pattern) => pattern.test(name));
2491+
}
2492+
function sanitizeContextForTelemetry(context2) {
2493+
if (!context2 || typeof context2 !== "object") return context2;
2494+
const sanitized = { ...context2 };
2495+
if (sanitized.env && typeof sanitized.env === "object") {
2496+
const sanitizedEnv = {};
2497+
for (const [key, value] of Object.entries(sanitized.env)) {
2498+
if (isSensitiveEnvVar(key)) {
2499+
sanitizedEnv[key] = "[REDACTED]";
2500+
} else {
2501+
sanitizedEnv[key] = String(value);
2502+
}
2503+
}
2504+
sanitized.env = sanitizedEnv;
2505+
}
2506+
return sanitized;
2507+
}
24882508
function safeSerialize(value, maxLength = MAX_ATTRIBUTE_LENGTH) {
24892509
try {
24902510
if (value === void 0 || value === null) return String(value);
@@ -2509,18 +2529,22 @@ function safeSerialize(value, maxLength = MAX_ATTRIBUTE_LENGTH) {
25092529
}
25102530
function captureCheckInputContext(span, context2) {
25112531
try {
2512-
const keys = Object.keys(context2);
2532+
const sanitizedContext = sanitizeContextForTelemetry(context2);
2533+
const keys = Object.keys(sanitizedContext);
25132534
span.setAttribute("visor.check.input.keys", keys.join(","));
25142535
span.setAttribute("visor.check.input.count", keys.length);
2515-
span.setAttribute("visor.check.input.context", safeSerialize(context2));
2516-
if (context2.pr) {
2517-
span.setAttribute("visor.check.input.pr", safeSerialize(context2.pr, 1e3));
2536+
span.setAttribute("visor.check.input.context", safeSerialize(sanitizedContext));
2537+
if (sanitizedContext.pr) {
2538+
span.setAttribute("visor.check.input.pr", safeSerialize(sanitizedContext.pr, 1e3));
25182539
}
2519-
if (context2.outputs) {
2520-
span.setAttribute("visor.check.input.outputs", safeSerialize(context2.outputs, 5e3));
2540+
if (sanitizedContext.outputs) {
2541+
span.setAttribute("visor.check.input.outputs", safeSerialize(sanitizedContext.outputs, 5e3));
25212542
}
2522-
if (context2.env) {
2523-
span.setAttribute("visor.check.input.env_keys", Object.keys(context2.env).join(","));
2543+
if (sanitizedContext.env) {
2544+
span.setAttribute(
2545+
"visor.check.input.env_keys",
2546+
Object.keys(sanitizedContext.env).join(",")
2547+
);
25242548
}
25252549
} catch (err) {
25262550
try {
@@ -2643,12 +2667,25 @@ function captureStateSnapshot(span, checkId, outputs, memory) {
26432667
span.setAttribute("visor.snapshot.error", String(err));
26442668
}
26452669
}
2646-
var MAX_ATTRIBUTE_LENGTH, MAX_ARRAY_ITEMS;
2670+
var MAX_ATTRIBUTE_LENGTH, MAX_ARRAY_ITEMS, SENSITIVE_ENV_PATTERNS;
26472671
var init_state_capture = __esm({
26482672
"src/telemetry/state-capture.ts"() {
26492673
"use strict";
26502674
MAX_ATTRIBUTE_LENGTH = 1e4;
26512675
MAX_ARRAY_ITEMS = 100;
2676+
SENSITIVE_ENV_PATTERNS = [
2677+
/api[_-]?key/i,
2678+
/secret/i,
2679+
/token/i,
2680+
/password/i,
2681+
/auth/i,
2682+
/credential/i,
2683+
/private[_-]?key/i,
2684+
/^sk-/i,
2685+
// OpenAI-style keys
2686+
/^AIza/i
2687+
// Google API keys
2688+
];
26522689
}
26532690
});
26542691

@@ -3869,7 +3906,7 @@ var init_ai_check_provider = __esm({
38693906
}
38703907
try {
38713908
const checkId = config.checkName || config.id || "unknown";
3872-
const ctxJson = JSON.stringify(templateContext);
3909+
const ctxJson = JSON.stringify(sanitizeContextForTelemetry(templateContext));
38733910
const { emitNdjsonSpanWithEvents: emitNdjsonSpanWithEvents2 } = (init_fallback_ndjson(), __toCommonJS(fallback_ndjson_exports));
38743911
emitNdjsonSpanWithEvents2(
38753912
"visor.check",
@@ -6380,7 +6417,7 @@ var init_command_check_provider = __esm({
63806417
}
63816418
try {
63826419
const checkId = config.checkName || config.id || "unknown";
6383-
const ctxJson = JSON.stringify(templateContext);
6420+
const ctxJson = JSON.stringify(sanitizeContextForTelemetry(templateContext));
63846421
const { emitNdjsonSpanWithEvents: emitNdjsonSpanWithEvents2 } = (init_fallback_ndjson(), __toCommonJS(fallback_ndjson_exports));
63856422
emitNdjsonSpanWithEvents2(
63866423
"visor.check",
@@ -16832,4 +16869,4 @@ export {
1683216869
StateMachineRunner,
1683316870
init_runner
1683416871
};
16835-
//# sourceMappingURL=chunk-VW46O2SP.mjs.map
16872+
//# sourceMappingURL=chunk-23L3QRYX.mjs.map

dist/sdk/chunk-23L3QRYX.mjs.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sdk/chunk-VW46O2SP.mjs.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/sdk/sdk.js

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7888,8 +7888,28 @@ __export(state_capture_exports, {
78887888
captureProviderCall: () => captureProviderCall,
78897889
captureRoutingDecision: () => captureRoutingDecision,
78907890
captureStateSnapshot: () => captureStateSnapshot,
7891-
captureTransformJS: () => captureTransformJS
7891+
captureTransformJS: () => captureTransformJS,
7892+
sanitizeContextForTelemetry: () => sanitizeContextForTelemetry
78927893
});
7894+
function isSensitiveEnvVar(name) {
7895+
return SENSITIVE_ENV_PATTERNS.some((pattern) => pattern.test(name));
7896+
}
7897+
function sanitizeContextForTelemetry(context2) {
7898+
if (!context2 || typeof context2 !== "object") return context2;
7899+
const sanitized = { ...context2 };
7900+
if (sanitized.env && typeof sanitized.env === "object") {
7901+
const sanitizedEnv = {};
7902+
for (const [key, value] of Object.entries(sanitized.env)) {
7903+
if (isSensitiveEnvVar(key)) {
7904+
sanitizedEnv[key] = "[REDACTED]";
7905+
} else {
7906+
sanitizedEnv[key] = String(value);
7907+
}
7908+
}
7909+
sanitized.env = sanitizedEnv;
7910+
}
7911+
return sanitized;
7912+
}
78937913
function safeSerialize(value, maxLength = MAX_ATTRIBUTE_LENGTH) {
78947914
try {
78957915
if (value === void 0 || value === null) return String(value);
@@ -7914,18 +7934,22 @@ function safeSerialize(value, maxLength = MAX_ATTRIBUTE_LENGTH) {
79147934
}
79157935
function captureCheckInputContext(span, context2) {
79167936
try {
7917-
const keys = Object.keys(context2);
7937+
const sanitizedContext = sanitizeContextForTelemetry(context2);
7938+
const keys = Object.keys(sanitizedContext);
79187939
span.setAttribute("visor.check.input.keys", keys.join(","));
79197940
span.setAttribute("visor.check.input.count", keys.length);
7920-
span.setAttribute("visor.check.input.context", safeSerialize(context2));
7921-
if (context2.pr) {
7922-
span.setAttribute("visor.check.input.pr", safeSerialize(context2.pr, 1e3));
7941+
span.setAttribute("visor.check.input.context", safeSerialize(sanitizedContext));
7942+
if (sanitizedContext.pr) {
7943+
span.setAttribute("visor.check.input.pr", safeSerialize(sanitizedContext.pr, 1e3));
79237944
}
7924-
if (context2.outputs) {
7925-
span.setAttribute("visor.check.input.outputs", safeSerialize(context2.outputs, 5e3));
7945+
if (sanitizedContext.outputs) {
7946+
span.setAttribute("visor.check.input.outputs", safeSerialize(sanitizedContext.outputs, 5e3));
79267947
}
7927-
if (context2.env) {
7928-
span.setAttribute("visor.check.input.env_keys", Object.keys(context2.env).join(","));
7948+
if (sanitizedContext.env) {
7949+
span.setAttribute(
7950+
"visor.check.input.env_keys",
7951+
Object.keys(sanitizedContext.env).join(",")
7952+
);
79297953
}
79307954
} catch (err) {
79317955
try {
@@ -8048,12 +8072,25 @@ function captureStateSnapshot(span, checkId, outputs, memory) {
80488072
span.setAttribute("visor.snapshot.error", String(err));
80498073
}
80508074
}
8051-
var MAX_ATTRIBUTE_LENGTH, MAX_ARRAY_ITEMS;
8075+
var MAX_ATTRIBUTE_LENGTH, MAX_ARRAY_ITEMS, SENSITIVE_ENV_PATTERNS;
80528076
var init_state_capture = __esm({
80538077
"src/telemetry/state-capture.ts"() {
80548078
"use strict";
80558079
MAX_ATTRIBUTE_LENGTH = 1e4;
80568080
MAX_ARRAY_ITEMS = 100;
8081+
SENSITIVE_ENV_PATTERNS = [
8082+
/api[_-]?key/i,
8083+
/secret/i,
8084+
/token/i,
8085+
/password/i,
8086+
/auth/i,
8087+
/credential/i,
8088+
/private[_-]?key/i,
8089+
/^sk-/i,
8090+
// OpenAI-style keys
8091+
/^AIza/i
8092+
// Google API keys
8093+
];
80578094
}
80588095
});
80598096

@@ -9405,7 +9442,7 @@ var init_ai_check_provider = __esm({
94059442
}
94069443
try {
94079444
const checkId = config.checkName || config.id || "unknown";
9408-
const ctxJson = JSON.stringify(templateContext);
9445+
const ctxJson = JSON.stringify(sanitizeContextForTelemetry(templateContext));
94099446
const { emitNdjsonSpanWithEvents: emitNdjsonSpanWithEvents2 } = (init_fallback_ndjson(), __toCommonJS(fallback_ndjson_exports));
94109447
emitNdjsonSpanWithEvents2(
94119448
"visor.check",
@@ -11916,7 +11953,7 @@ var init_command_check_provider = __esm({
1191611953
}
1191711954
try {
1191811955
const checkId = config.checkName || config.id || "unknown";
11919-
const ctxJson = JSON.stringify(templateContext);
11956+
const ctxJson = JSON.stringify(sanitizeContextForTelemetry(templateContext));
1192011957
const { emitNdjsonSpanWithEvents: emitNdjsonSpanWithEvents2 } = (init_fallback_ndjson(), __toCommonJS(fallback_ndjson_exports));
1192111958
emitNdjsonSpanWithEvents2(
1192211959
"visor.check",

dist/sdk/sdk.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sdk/sdk.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
check_provider_registry_exports,
44
init_check_provider_registry,
55
init_runner
6-
} from "./chunk-VW46O2SP.mjs";
6+
} from "./chunk-23L3QRYX.mjs";
77
import "./chunk-NAW3DB3I.mjs";
88
import {
99
commandExecutor,
@@ -549,7 +549,7 @@ var StateMachineExecutionEngine = class _StateMachineExecutionEngine {
549549
try {
550550
const map = options?.webhookContext?.webhookData;
551551
if (map) {
552-
const { CheckProviderRegistry } = await import("./check-provider-registry-U7K54IC3.mjs");
552+
const { CheckProviderRegistry } = await import("./check-provider-registry-534KL5HT.mjs");
553553
const reg = CheckProviderRegistry.getInstance();
554554
const p = reg.getProvider("http_input");
555555
if (p && typeof p.setWebhookContext === "function") p.setWebhookContext(map);

0 commit comments

Comments
 (0)