Privacy

By default, this package instrumentation hides a wide range of Personally Identifiable Information (PII) from session replays to protect user privacy:

Record elements

By default, no DOM elements are recorded. To record the content of an element and its children, explicitly add the data-public property to the element. When this attribute is present, the content inside the element, including child elements, will be captured in the session replay:

<div data-public>
    This text will be visible in the session replay.
</div>

Block elements

To prevent an element and its child elements from being recorded, use the data-private attribute.. This is especially useful when you want to selectively exclude sensitive parts of an element tree while allowing others to be captured.

<div data-public>
    <ul>
        <li>Page 1</li>
        <li>Page 2</li>
    </ul>
    <div data-private>
        This text will be not be visible in the session replay.
    </div>
</div>

Network requests

The body of a network request or response is never recorded.

The private query parameters are also redacted from the URL of the network requests.

A request or response header is redacted when its name contains one of the following values, regardless of the casing: auth, cookie, token, session, secret, key, csrf, xsrf or x-honeycomb-team. For example, the Authorization, Proxy-Authorization, Cookie, Set-Cookie, X-CSRF-Token and X-Api-Key headers are all redacted.

To redact additional headers, wrap the network sanitizers with a transformer function:

import { initializeTelemetry, type LogRocketSdkOptionsTransformer } from "@workleap/telemetry/react";

const redactTenantHeader: LogRocketSdkOptionsTransformer = config => {
    const requestSanitizer = config.network?.requestSanitizer;

    config.network = {
        ...config.network,
        requestSanitizer: request => {
            for (const name of Object.keys(request.headers ?? {})) {
                if (name.toLowerCase() === "x-tenant") {
                    request.headers[name] = "**redacted**";
                }
            }

            return requestSanitizer ? requestSanitizer(request) : request;
        }
    };

    return config;
};

const client = initializeTelemetry("wlp", {
    logRocket: {
        appId: "my-app-id",
        options: {
            transformers: [redactTenantHeader]
        }
    }
});

Use the same technique with responseSanitizer to redact additional response headers.