A newer version of this documentation is available.

View Latest

Function: redactSharedData

    February 16, 2025
    + 12

    Goal: Redact Sensitive Data prior to sharing.

    • This function redactSharedData will remove sensitive data and write "safe" redacted records.

    • Requires Eventing Storage (or metadata collection), a "source" collection, and a "destination" collection.

    • Will operate on all documents where doc.type === "master_profile".

    • Will create redacted documents in real-time of doc.type === "shared_profile".

    • The "destination" collection can be shared (or replicated via XCDR to a business partner) too the cloud (AWS, Azure or GCP).

    javascript
    // To run configure the settings for this Function, redactSharedData, as follows: // // Version 7.1+ // "Function Scope" // *.* (or try bulk.data if non-privileged) // Version 7.0+ // "Listen to Location" // bulk.data.source // "Eventing Storage" // rr100.eventing.metadata // Binding(s) // 1. "binding type", "alias name...", "bucket.scope.collection", "Access" // "bucket alias", "aws_col", "bulk.data.destination", "read and write" // // Version 6.X // "Source Bucket" // source // "MetaData Bucket" // metadata // Binding(s) // 1. "binding type", "alias name...", "bucket", "Access" // "bucket alias", "aws_col", "destination", "read and write" function OnUpdate(doc, meta) { // only process our profile documents if (doc.type !== "master_profile") return; // aws_col is a bucket alias to the target bucket to replicate to AWS via // XCDR. Write the minimal (non-sensitive) profile doc to the bucket for AWS. aws_col["shared_profile::"+doc.id] = { "type": "shared_profile", "first_name": doc.first_name, "id": doc.id, "basic_profile": doc.basic_profile, "timezone": doc.timezone }; }