Encountering XSS vulnerabilities while working with the IT security team during the build process. The (this.res) contains the code for embedding a video with script tags to play the video and its content. Any suggestions for an alternative solution are greatly appreciated.
Include
import {
Component,
OnInit,
ViewChild,
SecurityContext,
} from '@angular/core';
import {DomSanitizer} from '@angular/platform-browser';
Incorporate the following code in your component:
ngOnInit() {
this.res = `<div class="embed-container">
<iframe
src="https://www.youtube.com/embed/{{ include.id }}"
width="700"
height="480"
frameborder="0"
allowfullscreen="true">
</iframe>
</div>`
this._domSanitizer.bypassSecurityTrustHtml(this.res)
}
I have attempted to use this._domSanitizer.bypassSecurityTrustHtml(this.res) to display the video and its content, but I am wondering if there is an API or any other alternative solution to address these XSS vulnerabilities?