Skip to content

Commit 79d1fe2

Browse files
authored
test: Add tests for masking of sensitive data (#165)
This tests masking of initial & updated values for password & credit card fields. You can see that for now credit card data is not masked, which demonstrates the current behavior. In a future PR we can then verify that our fixed masking is working. ref getsentry/sentry-javascript#10258
1 parent 120e802 commit 79d1fe2

File tree

3 files changed

+154
-0
lines changed

3 files changed

+154
-0
lines changed

packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap

+73
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,79 @@ exports[`integration tests [html file]: form-fields.html 1`] = `
265265
<noscript>SCRIPT_PLACEHOLDER</noscript></body></html>"
266266
`;
267267

268+
exports[`integration tests [html file]: form-fields-sensitive.html 1`] = `
269+
"<!DOCTYPE html><html lang=\\"en\\"><head>
270+
<meta charset=\\"UTF-8\\" />
271+
<meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\" />
272+
<meta http-equiv=\\"X-UA-Compatible\\" content=\\"ie=edge\\" />
273+
<title>form fields</title>
274+
</head> <body>
275+
<form>
276+
<label>
277+
<input type=\\"password\\" value=\\"*******\\" />
278+
</label>
279+
<label>
280+
<input autocomplete=\\"current-password\\" value=\\"initial\\" />
281+
</label>
282+
<label>
283+
<input autocomplete=\\"new-password\\" value=\\"initial\\" />
284+
</label>
285+
<label>
286+
<input autocomplete=\\"cc-number\\" value=\\"initial\\" />
287+
</label>
288+
<label>
289+
<input autocomplete=\\"cc-exp\\" value=\\"initial\\" />
290+
</label>
291+
<label>
292+
<input autocomplete=\\"cc-exp-month\\" value=\\"initial\\" />
293+
</label>
294+
<label>
295+
<input autocomplete=\\"cc-exp-year\\" value=\\"initial\\" />
296+
</label>
297+
<label>
298+
<input autocomplete=\\"cc-csc\\" value=\\"initial\\" />
299+
</label>
300+
</form>
301+
</body></html>"
302+
`;
303+
304+
exports[`integration tests [html file]: form-fields-sensitive-update.html 1`] = `
305+
"<!DOCTYPE html><html lang=\\"en\\"><head>
306+
<meta charset=\\"UTF-8\\" />
307+
<meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\" />
308+
<meta http-equiv=\\"X-UA-Compatible\\" content=\\"ie=edge\\" />
309+
<title>form fields</title>
310+
</head> <body>
311+
<form>
312+
<label>
313+
<input type=\\"password\\" value=\\"*********\\" />
314+
</label>
315+
<label>
316+
<input autocomplete=\\"current-password\\" value=\\"new value\\" />
317+
</label>
318+
<label>
319+
<input autocomplete=\\"new-password\\" value=\\"new value\\" />
320+
</label>
321+
<label>
322+
<input autocomplete=\\"cc-number\\" value=\\"new value\\" />
323+
</label>
324+
<label>
325+
<input autocomplete=\\"cc-exp\\" value=\\"new value\\" />
326+
</label>
327+
<label>
328+
<input autocomplete=\\"cc-exp-month\\" value=\\"new value\\" />
329+
</label>
330+
<label>
331+
<input autocomplete=\\"cc-exp-year\\" value=\\"new value\\" />
332+
</label>
333+
<label>
334+
<input autocomplete=\\"cc-csc\\" value=\\"new value\\" />
335+
</label>
336+
</form>
337+
338+
<noscript>SCRIPT_PLACEHOLDER</noscript></body></html>"
339+
`;
340+
268341
exports[`integration tests [html file]: hover.html 1`] = `
269342
"<!DOCTYPE html><html lang=\\"en\\"><head>
270343
<meta charset=\\"UTF-8\\" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7+
<title>form fields</title>
8+
</head>
9+
10+
<body>
11+
<form>
12+
<label>
13+
<input type="password" value="initial" />
14+
</label>
15+
<label>
16+
<input autocomplete="current-password" value="initial" />
17+
</label>
18+
<label>
19+
<input autocomplete="new-password" value="initial" />
20+
</label>
21+
<label>
22+
<input autocomplete="cc-number" value="initial" />
23+
</label>
24+
<label>
25+
<input autocomplete="cc-exp" value="initial" />
26+
</label>
27+
<label>
28+
<input autocomplete="cc-exp-month" value="initial" />
29+
</label>
30+
<label>
31+
<input autocomplete="cc-exp-year" value="initial" />
32+
</label>
33+
<label>
34+
<input autocomplete="cc-csc" value="initial" />
35+
</label>
36+
</form>
37+
</body>
38+
<script>
39+
document.querySelectorAll('input').forEach((input) => {
40+
input.value = 'new value';
41+
});
42+
</script>
43+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7+
<title>form fields</title>
8+
</head>
9+
10+
<body>
11+
<form>
12+
<label>
13+
<input type="password" value="initial" />
14+
</label>
15+
<label>
16+
<input autocomplete="current-password" value="initial" />
17+
</label>
18+
<label>
19+
<input autocomplete="new-password" value="initial" />
20+
</label>
21+
<label>
22+
<input autocomplete="cc-number" value="initial" />
23+
</label>
24+
<label>
25+
<input autocomplete="cc-exp" value="initial" />
26+
</label>
27+
<label>
28+
<input autocomplete="cc-exp-month" value="initial" />
29+
</label>
30+
<label>
31+
<input autocomplete="cc-exp-year" value="initial" />
32+
</label>
33+
<label>
34+
<input autocomplete="cc-csc" value="initial" />
35+
</label>
36+
</form>
37+
</body>
38+
</html>

0 commit comments

Comments
 (0)