Skip to content

Commit

Permalink
[FIX] Incomplete multi-character sanitization (#959)
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Nov 30, 2023
1 parent d6d58b7 commit d61f1b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/processors/manifestCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ async function createManifest(
if ( library.getDocumentation() ) {
let desc = library.getDocumentation();
// remove all tags
desc = desc.replace(/\s+/g, " ").replace(/<\/?[a-zA-Z][a-zA-Z0-9_$.]*(\s[^>]*)>/g, "");
let prevDesc;
do { // Safely strip tags (https://codeql.github.com/codeql-query-help/javascript/js-incomplete-multi-character-sanitization/#example)
prevDesc = desc;
desc = desc.replace(/\s+/g, " ").replace(/<\/?[a-zA-Z][a-zA-Z0-9_$.]*(\s[^>]*)>/g, "");
} while (prevDesc !== desc);
// extract summary (first sentence)
const m = /^([\w\W]+?[.;!?])[^a-zA-Z0-9_$]/.exec(desc);
return m ? m[1] : desc;
Expand Down

0 comments on commit d61f1b7

Please sign in to comment.