Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: address review (claude r3) — don't scan non-secret allowlisted env values (URLs/regions) to avoid false-positive promotion blocks (#2371)
Adam Eivy72fb983a3efc
diff --git a/autofixer/sandbox.js b/autofixer/sandbox.jsindex 557df5c88b..50a4407f7c 100644--- a/autofixer/sandbox.js+++ b/autofixer/sandbox.js@@ -103,10 +103,16 @@ export function sanitizeChildEnv(baseEnv = process.env) {* Collect the credential VALUES the agent's environment exposes, for the diff* secret-scan (scanDiffForSecrets) — so an agent that reads a key at runtime* (e.g. `/proc/self/environ`, which stays readable even with Bash denied) can't- * write it into a source file and promote it. Scoped to auth-bearing keys +- * everything the runner injects via `provider.envVars` (Bedrock/Vertex/custom- * keys delivered only there), and deliberately excludes system vars (PATH/HOME)- * so a diff legitimately referencing a path isn't a false positive.+ * write it into a source file and promote it.+ *+ * Scoped to keys whose NAME denotes a secret (`*_API_KEY`, `*_TOKEN`,+ * `*_SECRET`, `*_KEY`, `*CREDENTIAL*`) or a provider-auth prefix, plus every+ * value the runner injects via `provider.envVars` (Bedrock/Vertex/custom keys+ * delivered only there). It deliberately does NOT harvest values of non-secret+ * allowlisted config — base URLs, regions (`us-east-1`), on/off flags — nor+ * system vars (PATH/HOME): those are legitimate strings a fix might write into+ * source, and scanning them would false-positive the promotion block. Known+ * key *formats* embedded elsewhere are still caught by SECRET_LINE_PATTERNS.** @param {Record<string,string>} childEnv the sanitized child env* @param {Record<string,string>} [providerEnvVars] provider.envVars overlaid by the runner@@ -116,9 +122,8 @@ export function collectSecretEnvValues(childEnv = {}, providerEnvVars = {}) {const vals = [];for (const [k, v] of Object.entries(childEnv || {})) {if (- PROVIDER_AUTH_ALLOW.has(k) ||- PROVIDER_AUTH_PREFIXES.some((p) => k.startsWith(p)) ||- /API_KEY|TOKEN|SECRET|CREDENTIAL|_KEY$/i.test(k)+ /API_KEY|TOKEN|SECRET|CREDENTIAL|_KEY$/i.test(k) ||+ PROVIDER_AUTH_PREFIXES.some((p) => k.startsWith(p))) {vals.push(v);}diff --git a/autofixer/sandbox.test.js b/autofixer/sandbox.test.jsindex 83e0bb75c0..df031e625e 100644--- a/autofixer/sandbox.test.js+++ b/autofixer/sandbox.test.js@@ -71,20 +71,25 @@ describe('sanitizeChildEnv — credential stripping', () => {});describe('collectSecretEnvValues — exfil-scan value list', () => {- it('includes auth-key values and provider.envVars, excludes system paths', () => {+ it('includes secret-named + provider.envVars values, excludes URLs/regions/paths', () => {const childEnv = {PATH: '/usr/local/bin:/usr/bin',HOME: '/home/someuser',ANTHROPIC_API_KEY: 'sk-ant-childkeyvalue123',- OPENCODE_CONFIG_CONTENT: 'config-with-embedded-secret-abc',+ CLAUDE_CODE_OAUTH_TOKEN: 'oauth-secret-value-123',+ ANTHROPIC_BASE_URL: 'https://api.anthropic.com',+ AWS_REGION: 'us-east-1234',};// Bedrock/custom key delivered ONLY via provider.envVars (overlaid by runner).const providerEnvVars = { AWS_BEARER_TOKEN_BEDROCK: 'bedrock-opaque-token-xyz' };const values = collectSecretEnvValues(childEnv, providerEnvVars);- expect(values).toContain('sk-ant-childkeyvalue123');- expect(values).toContain('config-with-embedded-secret-abc'); // non-key-named allowlisted var- expect(values).toContain('bedrock-opaque-token-xyz'); // provider-injected- // System paths are NOT scanned (would false-positive on legit path edits).+ expect(values).toContain('sk-ant-childkeyvalue123'); // *_API_KEY+ expect(values).toContain('oauth-secret-value-123'); // CLAUDE_CODE_ prefix + *_TOKEN+ expect(values).toContain('bedrock-opaque-token-xyz'); // provider-injected+ // Non-secret allowlisted config + system vars must NOT be scanned — a fix+ // legitimately writing a base URL / region / path would else be blocked.+ expect(values).not.toContain('https://api.anthropic.com');+ expect(values).not.toContain('us-east-1234');expect(values).not.toContain('/usr/local/bin:/usr/bin');expect(values).not.toContain('/home/someuser');});