Scheduling infrastructure for absolutely everyone.
feat: add missing sensitive fields to redactSensitiveData (#24121)
devin-ai-integration[bot]7505b3b2719b
diff --git a/packages/lib/redactSensitiveData.test.ts b/packages/lib/redactSensitiveData.test.tsindex 835907fda0d..776bd2dc6b3 100644--- a/packages/lib/redactSensitiveData.test.ts+++ b/packages/lib/redactSensitiveData.test.ts@@ -150,7 +150,7 @@ describe("redactSensitiveData", () => {});it("should handle circular references gracefully", () => {- const input: any = { name: "test" };+ const input: Record<string, unknown> = { name: "test" };input.self = input;expect(redactSensitiveData(input)).toMatchInlineSnapshot(`{@@ -175,4 +175,51 @@ describe("redactSensitiveData", () => {}`);});++ it("should redact delegation credential sensitive fields", () => {+ const input = {+ serviceAccountKey: {+ client_id: "client123",+ client_email: "[email protected]",+ private_key: "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC...",+ tenant_id: "tenant123",+ },+ encrypted_credentials: "encrypted_data_here",+ normalField: "value",+ };+ expect(redactSensitiveData(input)).toMatchInlineSnapshot(`+ {+ "encrypted_credentials": "[REDACTED]",+ "normalField": "value",+ "serviceAccountKey": "[REDACTED]",+ }+ `);+ });++ it("should redact nested delegation credential fields", () => {+ const input = {+ credential: {+ delegatedTo: {+ serviceAccountKey: {+ private_key: "sensitive_key",+ client_email: "[email protected]",+ tenant_id: "tenant123",+ },+ },+ },+ config: {+ private_key: "another_private_key",+ client_email: "[email protected]",+ },+ };+ expect(redactSensitiveData(input)).toMatchInlineSnapshot(`+ {+ "config": {+ "client_email": "[REDACTED]",+ "private_key": "[REDACTED]",+ },+ "credential": "[REDACTED]",+ }+ `);+ });});diff --git a/packages/lib/redactSensitiveData.ts b/packages/lib/redactSensitiveData.tsindex 683bc49a57a..aada55098e6 100644--- a/packages/lib/redactSensitiveData.ts+++ b/packages/lib/redactSensitiveData.ts@@ -7,14 +7,19 @@ const SENSITIVE_FIELDS = ["apiKey","auth","authorization",+ "client_email","client_id","client_secret","credential",+ "encrypted_credentials","hash","key","password",+ "private_key","refreshToken","secret",+ "serviceAccountKey",+ "tenant_id","token",];