Files
codeql/javascript/ql/test/library-tests/frameworks/Angular2/source.component.ts
2023-04-26 14:33:04 +02:00

25 lines
637 B
TypeScript

import { Component,ElementRef } from "@angular/core";
import { DomSanitizer } from '@angular/platform-browser';
@Component({
selector: "source-component",
templateUrl: "./source.component.html"
})
export class Source {
taint: string;
taintedArray: string[];
safeArray: string[];
elementRef: ElementRef;
constructor(private sanitizer: DomSanitizer) {
this.taint = source();
this.taintedArray = [...source()];
this.safeArray = ['a', 'b'];
}
methodOnComponent(x) {
this.sanitizer.bypassSecurityTrustHtml(x);
this.elementRef.nativeElement.innerHTML = x;
}
}