A computed value is marked as trusted, so Angular's sanitizer passes it through

tx0/ts:sanitizer-bypassrecommendedwarningsecurity, cwe-79

What it finds

Angular sanitizes values bound into HTML, styles, URLs and scripts, unless they are marked as trusted with DomSanitizer.bypassSecurityTrust.... A value marked that way that holds anything from a user can run script in the page.

Reported are calls of bypassSecurityTrustHtml, bypassSecurityTrustScript, bypassSecurityTrustStyle, bypassSecurityTrustUrl and bypassSecurityTrustResourceUrl whose argument is not a string literal.

From the rule's source, sanitizer_bypass.rs.

Example from the rule's tests
export class Widget {  constructor(private readonly sanitizer: { bypassSecurityTrustHtml(v: string): unknown }) {}  render(html: string) {    const a = this.sanitizer.bypassSecurityTrustHtml(html);tx0 reports: skips Angular's sanitizer    const b = this.sanitizer.bypassSecurityTrustHtml("<b>fixed</b>");    return [a, b];  }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:sanitizer-bypass" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:sanitizer-bypass] reason="..."

tx0 explain tx0/ts:sanitizer-bypass shows the same in the terminal. Found a false positive? Report it.