Skip to content

Commit

Permalink
ignore not deny
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Sep 15, 2023
1 parent 3efb2d7 commit 7c2b533
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/__tests__/autocapture.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ describe('Autocapture system', () => {
expect(props['_nghost-dpm-c448']).toBeUndefined()
})

it('should filter element attributes based on the denylist', () => {
it('should filter element attributes based on the ignorelist', () => {
autocapture.config = {
element_attribute_denylist: ['data-attr', 'data-attr-2'],
element_attribute_ignorelist: ['data-attr', 'data-attr-2'],
}
div.setAttribute('data-attr', 'value')
div.setAttribute('data-attr-2', 'value')
Expand Down
4 changes: 2 additions & 2 deletions src/autocapture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ const autocapture = {
})

// capture the deny list here because this not-a-class class makes it tricky to use this.config in the function below
const elementAttributeDenylist = this.config?.element_attribute_denylist
const elementAttributeIgnorelist = this.config?.element_attribute_ignorelist
_each(elem.attributes, function (attr: Attr) {
// Only capture attributes we know are safe
if (isSensitiveElement(elem) && ['name', 'id', 'class'].indexOf(attr.name) === -1) return

if (elementAttributeDenylist?.includes(attr.name)) return
if (elementAttributeIgnorelist?.includes(attr.name)) return

if (!maskInputs && shouldCaptureValue(attr.value) && !isAngularStyleAttr(attr.name)) {
props['attr__' + attr.name] = limitText(1024, attr.value)
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export interface AutocaptureConfig {
* Exclude certain element attributes from autocapture
* E.g. ['aria-label'] or [data-attr-pii]
*/
element_attribute_denylist?: string[]
element_attribute_ignorelist?: string[]
}

export type UUIDVersion = 'og' | 'v7'
Expand Down

0 comments on commit 7c2b533

Please sign in to comment.