Skip to content

Commit

Permalink
Setup HTML sanitizing
Browse files Browse the repository at this point in the history
Closes #28
  • Loading branch information
nachtjasmin committed Jul 10, 2023
1 parent f449fa2 commit 50cd509
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
41 changes: 28 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"sourceDir": "dist/"
},
"dependencies": {
"sanitize-html": "^2.11.0",
"webextension-polyfill": "^0.10.0"
}
}
5 changes: 5 additions & 0 deletions src/libs/pronouns.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sanitizeHtml from "sanitize-html";

const fieldMatchers = [/pro.*nouns?/i, "pronomen"];

/**
Expand Down Expand Up @@ -27,6 +29,9 @@ export function extractFromStatus(status) {
}
}
}
if (!pronouns) return null;
pronouns = sanitizeHtml(pronouns, { allowedTags: [], allowedAttributes: {} });

if (!pronouns) return null;
return pronouns;
}

0 comments on commit 50cd509

Please sign in to comment.