Skip to content

Commit 2fb062b

Browse files
jeefyk8s-ci-robot
authored andcommitted
Use better sanitize function (#4232)
1 parent c860be9 commit 2fb062b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/app/frontend/common/pipes/safehtml.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import {Pipe} from '@angular/core';
15+
import {Pipe, SecurityContext} from '@angular/core';
1616
import {DomSanitizer, SafeHtml} from '@angular/platform-browser';
1717

1818
/**
@@ -23,6 +23,9 @@ export class SafeHtmlFormatter {
2323
constructor(private readonly sanitizer: DomSanitizer) {}
2424

2525
transform(value: string): SafeHtml {
26-
return this.sanitizer.bypassSecurityTrustHtml(value.replace(' ', ' '));
26+
return this.sanitizer.sanitize(
27+
SecurityContext.HTML,
28+
value.replace('<', '&lt;').replace('>', '&gt;'),
29+
);
2730
}
2831
}

0 commit comments

Comments
 (0)