Skip to content

Commit ef0957d

Browse files
refactored the naming to be more clear
1 parent 43c1ba4 commit ef0957d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

har-extractor/har-extract.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require ('path');
33

44
const DEFAULT_OPTIONS = {
55
keepOptions: false,
6-
stripPII: false,
6+
stripPrivateInfo: true,
77
input: 'dlive.tv.har',
88
url: 'https://graphigo.prd.dlive.tv/',
99
output: 'extracted.dlive.tv.har'
@@ -24,8 +24,8 @@ function maybeExtractOptionalArguments (options) {
2424
let nextArg;
2525
while ((nextArg = process.argv.shift ())) {
2626
switch (nextArg) {
27-
case '-k': options.keepOptions = true; break;
28-
case '-s': options.stripPII = false; break;
27+
case '-k': options.keepOptions = true; break;
28+
case '-s': options.stripPrivateInfo = false; break;
2929
case '-i': required ('input', (options.input = process.argv.shift ())); break;
3030
case '-o': required ('output', (options.output = process.argv.shift ())); break;
3131
case '-u': required ('url', (options.url = process.argv.shift ())); break;
@@ -55,8 +55,8 @@ function processArguments() {
5555
`Usage: ${selfDetails.cmd} ${selfDetails.file} [options]\n\n` +
5656
' -k keep OPTIONS requests.\n' +
5757
` default: ${DEFAULT_OPTIONS.keepOptions}\n` +
58-
' -s strip personally identifiable information.\n' +
59-
` default: ${DEFAULT_OPTIONS.stripPII}\n` +
58+
' -s strip private info (username, password, tokens).\n' +
59+
` default: ${DEFAULT_OPTIONS.stripPrivateInfo}\n` +
6060
' -i input the path to the .har you want to parse.\n' +
6161
` default: ${DEFAULT_OPTIONS.input}\n` +
6262
' -o output the path to what output file you want.\n' +
@@ -105,8 +105,8 @@ function filterOutIrrelevantLogEntries(harObject, options) {
105105
});
106106
}
107107

108-
function shouldStripPIIFromEntries(harObject, options) {
109-
if (!options.stripPII) { return; }
108+
function maybeStripPrivateInfoFromEntries(harObject, options) {
109+
if (!options.stripPrivateInfo) { return; }
110110
harObject.log.entries = harObject.log.entries.map ((item) => {
111111

112112
// TODO: determine which requests contain PII
@@ -128,7 +128,7 @@ fs.readFile (options.input, 'utf8', (err, data) => {
128128
let harObject = JSON.parse (data);
129129

130130
filterOutIrrelevantLogEntries(harObject, options);
131-
shouldStripPIIFromEntries(harObject, options);
131+
maybeStripPrivateInfoFromEntries(harObject, options);
132132

133133
writeOrCreateTextFile (options.output, JSON.stringify(harObject, null, 2), (err) => {
134134
if (err) throw err;

0 commit comments

Comments
 (0)