Skip to content

Commit a66e6d5

Browse files
authored
Extend masking cases to include aria-label and name (#3961)
1 parent e53e865 commit a66e6d5

File tree

2 files changed

+41
-18
lines changed

2 files changed

+41
-18
lines changed

packages/rum-core/src/domain/privacy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ export function shouldMaskAttribute(
175175
case 'title':
176176
case 'alt':
177177
case 'placeholder':
178+
case 'aria-label':
179+
case 'name':
178180
return true
179181
}
180182
if (tagName === 'A' && attributeName === 'href') {

packages/rum/src/domain/record/serialization/htmlAst.specHelper.ts

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ export const HTML = `
8282
<p>Your browser cannot play the provided video file.</p>
8383
</video>
8484
<select>
85-
<option>private option A</option>
86-
<option>private option B</option>
87-
<option>private option C</option>
85+
<option aria-label='A'>private option A</option>
86+
<option aria-label='B'>private option B</option>
87+
<option aria-label='C'>private option C</option>
8888
</select>
8989
<input type="password">
9090
<input type="text">
@@ -339,7 +339,9 @@ export const AST_MASK = {
339339
{
340340
type: 2,
341341
tagName: 'option',
342-
attributes: {},
342+
attributes: {
343+
'aria-label': '***',
344+
},
343345
childNodes: [
344346
{
345347
type: 3,
@@ -350,7 +352,9 @@ export const AST_MASK = {
350352
{
351353
type: 2,
352354
tagName: 'option',
353-
attributes: {},
355+
attributes: {
356+
'aria-label': '***',
357+
},
354358
childNodes: [
355359
{
356360
type: 3,
@@ -361,7 +365,9 @@ export const AST_MASK = {
361365
{
362366
type: 2,
363367
tagName: 'option',
364-
attributes: {},
368+
attributes: {
369+
'aria-label': '***',
370+
},
365371
childNodes: [
366372
{
367373
type: 3,
@@ -404,7 +410,7 @@ export const AST_MASK = {
404410
tagName: 'input',
405411
attributes: {
406412
type: 'checkbox',
407-
name: 'inputFoo',
413+
name: '***',
408414
value: '***',
409415
},
410416
childNodes: [],
@@ -435,7 +441,7 @@ export const AST_MASK = {
435441
tagName: 'input',
436442
attributes: {
437443
type: 'radio',
438-
name: 'radioGroup',
444+
name: '***',
439445
value: '***',
440446
},
441447
childNodes: [],
@@ -448,7 +454,7 @@ export const AST_MASK = {
448454
type: 2,
449455
tagName: 'textarea',
450456
attributes: {
451-
name: 'baz',
457+
name: '***',
452458
rows: '2',
453459
cols: '20',
454460
value: '***',
@@ -705,7 +711,9 @@ export const AST_MASK_USER_INPUT = {
705711
{
706712
type: 2,
707713
tagName: 'option',
708-
attributes: {},
714+
attributes: {
715+
'aria-label': 'A',
716+
},
709717
childNodes: [
710718
{
711719
type: 3,
@@ -716,7 +724,9 @@ export const AST_MASK_USER_INPUT = {
716724
{
717725
type: 2,
718726
tagName: 'option',
719-
attributes: {},
727+
attributes: {
728+
'aria-label': 'B',
729+
},
720730
childNodes: [
721731
{
722732
type: 3,
@@ -727,7 +737,9 @@ export const AST_MASK_USER_INPUT = {
727737
{
728738
type: 2,
729739
tagName: 'option',
730-
attributes: {},
740+
attributes: {
741+
'aria-label': 'C',
742+
},
731743
childNodes: [
732744
{
733745
type: 3,
@@ -1071,7 +1083,9 @@ export const AST_MASK_UNLESS_ALLOWLISTED = {
10711083
{
10721084
type: 2,
10731085
tagName: 'option',
1074-
attributes: {},
1086+
attributes: {
1087+
'aria-label': '***',
1088+
},
10751089
childNodes: [
10761090
{
10771091
type: 3,
@@ -1082,7 +1096,9 @@ export const AST_MASK_UNLESS_ALLOWLISTED = {
10821096
{
10831097
type: 2,
10841098
tagName: 'option',
1085-
attributes: {},
1099+
attributes: {
1100+
'aria-label': '***',
1101+
},
10861102
childNodes: [
10871103
{
10881104
type: 3,
@@ -1093,7 +1109,9 @@ export const AST_MASK_UNLESS_ALLOWLISTED = {
10931109
{
10941110
type: 2,
10951111
tagName: 'option',
1096-
attributes: {},
1112+
attributes: {
1113+
'aria-label': '***',
1114+
},
10971115
childNodes: [
10981116
{
10991117
type: 3,
@@ -1136,7 +1154,7 @@ export const AST_MASK_UNLESS_ALLOWLISTED = {
11361154
tagName: 'input',
11371155
attributes: {
11381156
type: 'checkbox',
1139-
name: 'inputFoo',
1157+
name: '***',
11401158
value: '***',
11411159
},
11421160
childNodes: [],
@@ -1167,7 +1185,7 @@ export const AST_MASK_UNLESS_ALLOWLISTED = {
11671185
tagName: 'input',
11681186
attributes: {
11691187
type: 'radio',
1170-
name: 'radioGroup',
1188+
name: '***',
11711189
value: '***',
11721190
},
11731191
childNodes: [],
@@ -1180,7 +1198,7 @@ export const AST_MASK_UNLESS_ALLOWLISTED = {
11801198
type: 2,
11811199
tagName: 'textarea',
11821200
attributes: {
1183-
name: 'baz',
1201+
name: '***',
11841202
rows: '2',
11851203
cols: '20',
11861204
value: '***',
@@ -1443,6 +1461,7 @@ export const AST_ALLOW = {
14431461
tagName: 'option',
14441462
attributes: {
14451463
selected: true,
1464+
'aria-label': 'A',
14461465
value: 'private option A',
14471466
},
14481467
childNodes: [
@@ -1460,6 +1479,7 @@ export const AST_ALLOW = {
14601479
type: 2,
14611480
tagName: 'option',
14621481
attributes: {
1482+
'aria-label': 'B',
14631483
value: 'private option B',
14641484
},
14651485
childNodes: [
@@ -1477,6 +1497,7 @@ export const AST_ALLOW = {
14771497
type: 2,
14781498
tagName: 'option',
14791499
attributes: {
1500+
'aria-label': 'C',
14801501
value: 'private option C',
14811502
},
14821503
childNodes: [

0 commit comments

Comments
 (0)