title: Security concerns about using bypassSecurityTrustResourceUrl() to display base64 images in Angular
body: <p>I have a working <strong>Angular application</strong> displaying <strong>base64 images</strong> in HTML using : <code>this.sanitizer.bypassSecurityTrustResourceUrl(&quot;data:image/jpeg;base64,...&quot;)</code></p>
  <p>However, bypassing this security opens a door for <strong>XSS attacks</strong> such as explained in the <a href="https://angular.io/api/platform-browser/DomSanitizer" rel="nofollow noreferrer">Angular documentation</a>.</p>
  <p>Besides, an external company paid to find security issues in my code found those lines of code inacceptable and asked me to fix it.</p>
  <p>Because I am not able to sanitize this base64 string image using <code>this.sanitizer.sanitize()</code> method, and because I cannot find any other way to do it on the internet, I would like to ask you how I could achieve my goal without exposing my application to XSS security issues.</p>
  <p>Is there any other way to (filter, escape, validate) sanitize a base64 image in order to use it in an <code>&lt;img&gt;</code>  tag ?</p>
  <p>Any help or advice would be greatly appreciated !</p>