Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • add sanitization for kb tags when exporting workflow

Type of Change

  • New feature

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 14, 2025 11:47pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

Added sanitization for knowledge base tagFilters and documentTags fields when exporting workflows. These fields contain workspace-specific metadata that should not be included in exported workflows.

Changes made:

  • In sanitizeSubBlocks(): Skip tagFilters and documentTags fields when sanitizing for copilot (returns early, field is omitted from output)
  • In sanitizeForExport(): Clear tagFilters and documentTags values by setting them to empty strings (preserves field structure but removes workspace-specific data)

Impact:

  • Prevents workspace-specific knowledge base configuration from leaking when workflows are exported and shared across workspaces
  • Maintains consistency with existing sensitive data sanitization patterns (credentials, OAuth tokens, API keys)
  • Aligns with the principle that exported workflows should be portable across different workspace environments

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes follow established patterns in the codebase for sanitizing workspace-specific data. The implementation is straightforward, consistent with existing sanitization logic, and addresses a valid use case of preventing workspace-specific knowledge base metadata from being exported.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/lib/workflows/json-sanitizer.ts 5/5 Added sanitization for tagFilters and documentTags to prevent workspace-specific knowledge base metadata from being exported

Sequence Diagram

sequenceDiagram
    participant User
    participant WorkflowExport
    participant sanitizeForExport
    participant sanitizeForCopilot
    participant KnowledgeBlock
    
    User->>WorkflowExport: Export workflow
    WorkflowExport->>sanitizeForExport: sanitizeForExport(state)
    
    Note over sanitizeForExport: Clone workflow state
    
    sanitizeForExport->>sanitizeForExport: Iterate blocks.subBlocks
    
    alt Sensitive field (credentials/oauth/secrets)
        sanitizeForExport->>sanitizeForExport: Set value to ''
    end
    
    alt tagFilters or documentTags field
        Note over sanitizeForExport: NEW: Remove KB workspace data
        sanitizeForExport->>sanitizeForExport: Set value to ''
    end
    
    sanitizeForExport-->>WorkflowExport: Return sanitized state
    WorkflowExport-->>User: Export file (without KB metadata)
    
    Note over User,KnowledgeBlock: Copilot sanitization path
    
    User->>WorkflowExport: Send to copilot
    WorkflowExport->>sanitizeForCopilot: sanitizeForCopilot(state)
    sanitizeForCopilot->>sanitizeForCopilot: sanitizeSubBlocks()
    
    alt tagFilters or documentTags field
        Note over sanitizeForCopilot: NEW: Skip KB workspace data
        sanitizeForCopilot->>sanitizeForCopilot: return (skip field)
    end
    
    sanitizeForCopilot-->>WorkflowExport: Return sanitized state
    WorkflowExport-->>User: Send to copilot (without KB metadata)
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 6723adf into staging Oct 14, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the sim-149 branch October 14, 2025 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants