Skip to content

Commit f0c71cc

Browse files
fix(data-retention): always apply logs policy to large-value refs when logs stage is on
1 parent 6e9587a commit f0c71cc

1 file changed

Lines changed: 17 additions & 18 deletions

File tree

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

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -637,27 +637,26 @@ export class ExecutionLogger implements IExecutionLoggerService {
637637
// truth; re-checking the flag/plan here returns false on a transient read and
638638
// would silently skip masking, leaking PII (fail-open). Absence of rules
639639
// yields the disabled default, so non-PII orgs incur only the lookup.
640-
const resolved = resolveEffectivePiiRedaction({ orgSettings: row.orgSettings, workspaceId })
641-
const config = resolved.logs
640+
const config = resolveEffectivePiiRedaction({ orgSettings: row.orgSettings, workspaceId }).logs
642641
if (!config.enabled) return payload
643642

644643
// The string redactor can't reach values already offloaded to large-value
645-
// storage (>8MB refs). Those are masked before offload only when the
646-
// block-output stage is on; when it's off, hydrate → mask → re-store the refs
647-
// so the log keeps redacted content (falling back to a marker only if a ref
648-
// can't be materialized/re-stored).
649-
const working = resolved.blockOutputs.enabled
650-
? payload
651-
: await redactLargeValueRefs(payload, {
652-
entityTypes: config.entityTypes,
653-
language: config.language,
654-
store: {
655-
workspaceId,
656-
workflowId: storeContext.workflowId ?? undefined,
657-
executionId: storeContext.executionId,
658-
userId: storeContext.userId ?? undefined,
659-
},
660-
})
644+
// storage (>8MB refs). Always hydrate → mask → re-store them under the LOGS
645+
// policy, even if the block-output stage already masked before offload: that
646+
// used the block-output entity set, which can differ from the logs set, so
647+
// the log's large values must get the logs policy applied like inline content
648+
// does. Masking is idempotent, so already-masked spans are unaffected; a ref
649+
// that can't be materialized/re-stored falls back to a marker.
650+
const working = await redactLargeValueRefs(payload, {
651+
entityTypes: config.entityTypes,
652+
language: config.language,
653+
store: {
654+
workspaceId,
655+
workflowId: storeContext.workflowId ?? undefined,
656+
executionId: storeContext.executionId,
657+
userId: storeContext.userId ?? undefined,
658+
},
659+
})
661660

662661
return redactPIIFromExecution(working, {
663662
entityTypes: config.entityTypes,

0 commit comments

Comments
 (0)