1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[PM-6328] Checkmarx - Resolve warnings (#7941)

This commit is contained in:
Oscar Hinton
2024-02-15 22:25:53 +01:00
committed by GitHub
parent c8c1ed42ba
commit 02dde0c0d3
49 changed files with 101 additions and 85 deletions

View File

@@ -75,6 +75,8 @@ export class AvatarComponent implements OnChanges {
svg.appendChild(charObj);
const html = window.document.createElement("div").appendChild(svg).outerHTML;
const svgHtml = window.btoa(unescape(encodeURIComponent(html)));
// This is safe because the only user provided value, chars is set using `textContent`
this.src = this.sanitizer.bypassSecurityTrustResourceUrl(
"data:image/svg+xml;base64," + svgHtml,
);
@@ -117,6 +119,7 @@ export class AvatarComponent implements OnChanges {
'"Open Sans","Helvetica Neue",Helvetica,Arial,' +
'sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"',
);
// Warning do not use innerHTML here, characters are user provided
textTag.textContent = character;
textTag.style.fontWeight = this.svgFontWeight.toString();
textTag.style.fontSize = this.svgFontSize + "px";