Skip to content

Commit 74180a1

Browse files
committed
improvement(oauth): coalesce token refresh + scrub unknown credential refs
1 parent 3f7698c commit 74180a1

17 files changed

Lines changed: 1184 additions & 188 deletions

File tree

apps/realtime/src/handlers/subblocks.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { createLogger } from '@sim/logger'
44
import { SUBBLOCK_OPERATIONS } from '@sim/realtime-protocol/constants'
55
import { getErrorMessage } from '@sim/utils/errors'
66
import { assertWorkflowMutable, WorkflowLockedError } from '@sim/workflow-authz'
7+
import { scrubSingleCredentialValue } from '@sim/workflow-persistence/credential-scrub'
78
import { isWorkflowBlockProtected } from '@sim/workflow-types/workflow'
89
import { and, eq } from 'drizzle-orm'
910
import type { AuthenticatedSocket } from '@/middleware/auth'
@@ -234,8 +235,19 @@ async function flushSubblockUpdate(
234235
pending: PendingSubblock,
235236
roomManager: IRoomManager
236237
) {
237-
const { blockId, subblockId, value, timestamp } = pending.latest
238+
const { blockId, subblockId, value: incomingValue, timestamp } = pending.latest
238239
const io = roomManager.io
240+
const { value, cleared: credentialCleared } = await scrubSingleCredentialValue(
241+
subblockId,
242+
incomingValue
243+
)
244+
if (credentialCleared) {
245+
logger.warn('Cleared dangling credential ref in realtime subblock update', {
246+
workflowId,
247+
blockId,
248+
subblockId,
249+
})
250+
}
239251

240252
try {
241253
// Verify workflow still exists

0 commit comments

Comments
 (0)