CtrlB
Search
K

Data Redaction

Our agent lets you define custom data redaction functions. Use them when you don't want sensitive data from your application getting captured in developer's frontend.
In the following example, there is a simple express server with /secret endpoint defined on line 18. It defines a sensitive variable called secret at line 19 which you do not want to be captured in tracepoints or logpoints.
1
const heimdall = require('@dev0/heimdall-nodejs');
2
heimdall.start({
3
apiKey : "<company api key>",
4
captureFrameDataReductionCallback: (captureFrames) => {
5
captureFrames[0].locals.secret = "XXXXXX"
6
return captureFrames;
7
},
8
});
9
10
const express = require('express');
11
const app = express();
12
const port = 5000;
13
// Define routes
14
app.get('/', (req, res) => {
15
res.send('Hello, World!');
16
});
17
18
app.get('/secret', (req, res) => {
19
const secret = "SECRET DATA NOT MEANT FOR DEVS!";
20
res.send('The secret is '+ secret);
21
});
You can specify the configuration parametercaptureFrameDataReductionCallback at line 4 which defines the custom callback function. ArgumentcaptureFrames is a list of frames captured. Easily redact the secret variable from the top frame as done in this example. Remember to return the captureFrames variable at the end of the callback function.