Drop fields node (for data redaction and branching)

Redaction Mode For The Set Node

TL;DR: A redaction node for the ‘set’ node whose purpose is to exclude field(s) from the JSON array. Use-case: using an automation that sends data to different groups of stakeholders some of which will require a narrower view of the data downstream for compliance/exposure reasons.

Outline

The Set node in n8n is very useful for restructuring or cleaning up data within workflows.

A use-case I commonly make for it is preparing data differently for multiple branches of the same automation.

For example:

When writing data both to a public GitHub repository and to an internal database, one often needs to redact a handful of non-public fields (from many) before sending data to the public branch.

Example:

I have a GitHub repository which has all my system prompt configurations in it. I open source most of these but a portion are personal and I do not.

I use booleans like “contains PII” or “for public release” for creating “if” conditions in the flow logic, but I also want to narrow down the public facing data to exclude some of my internal tracking data that is not of interest to external parties.

Currently, I do this by using multiple set field nodes: on the “public facing” side of an automation like this, I’ll map a subset of the input fields.

However, it would be far more efficient to do this the other way around: state which fields you wish to redact

Suggestion / FR

This could be implemented in two ways (just ideas, of course!):

1: A dedicated “field redaction” node for doing this.

2: A “field exclusion” setting for ‘set node’ which maps the fields to drop rather than to keep

Can you do this with the existing “All Except” option under “Include Other Input Fields” on the Set node?