Skip to content

Commit 7313e18

Browse files
fix(logs): redact executionData.correlation
The top-level correlation field is copied from pre-redaction trigger data, so webhook/schedule correlation values could persist unredacted. Add it to the redaction set alongside trigger/environment.
1 parent 9f2ed1c commit 7313e18

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

apps/sim/lib/logs/execution/logger.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,9 @@ export class ExecutionLogger implements IExecutionLoggerService {
770770
...(builtExecutionData.environment !== undefined
771771
? { environment: builtExecutionData.environment }
772772
: {}),
773+
...(builtExecutionData.correlation !== undefined
774+
? { correlation: builtExecutionData.correlation }
775+
: {}),
773776
})
774777

775778
const rawDurationMs =
@@ -797,6 +800,9 @@ export class ExecutionLogger implements IExecutionLoggerService {
797800
...(pii.environment !== undefined
798801
? { environment: pii.environment as ExecutionEnvironment }
799802
: {}),
803+
...(pii.correlation !== undefined
804+
? { correlation: pii.correlation as ExecutionData['correlation'] }
805+
: {}),
800806
}
801807

802808
stripSpanCosts((cleanExecutionData as Record<string, unknown>).traceSpans)

apps/sim/lib/logs/execution/pii-redaction.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ describe('redactPIIFromExecution', () => {
9393
trigger: { type: 'webhook', data: { from: 'caller@x.com' } },
9494
executionState: { status: 'completed', note: 'state for e@f.com' },
9595
environment: { variables: { CONTACT: 'admin@x.com' } },
96+
correlation: { source: 'corr@x.com' },
9697
}
9798

9899
const result = await redactPIIFromExecution(payload, { entityTypes: ['EMAIL_ADDRESS'] })
@@ -107,6 +108,7 @@ describe('redactPIIFromExecution', () => {
107108
expect((result.trigger as any).data.from).toBe('MASKED(caller@x.com)')
108109
expect((result.executionState as any).note).toBe('MASKED(state for e@f.com)')
109110
expect((result.environment as any).variables.CONTACT).toBe('MASKED(admin@x.com)')
111+
expect((result.correlation as any).source).toBe('MASKED(corr@x.com)')
110112
})
111113

112114
it('returns payload unchanged when there is nothing to mask', async () => {

apps/sim/lib/logs/execution/pii-redaction.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export interface RedactablePayload {
2929
trigger?: unknown
3030
executionState?: unknown
3131
environment?: unknown
32+
correlation?: unknown
3233
}
3334

3435
/** Keys of {@link RedactablePayload} processed by the redactor, in order. */
@@ -41,6 +42,7 @@ const REDACTABLE_KEYS: (keyof RedactablePayload)[] = [
4142
'trigger',
4243
'executionState',
4344
'environment',
45+
'correlation',
4446
]
4547

4648
/** Trace-span fields that carry runtime content (and therefore possible PII). */

0 commit comments

Comments
 (0)