Python: Add html.escape as HTML sanitizer

This commit is contained in:
Rasmus Wriedt Larsen
2024-01-22 17:31:55 +01:00
parent 6533269387
commit cbed6e861d
2 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
import html
s = "tainted"
html.escape(s) # $ escapeInput=s escapeKind=html escapeOutput=html.escape(..)
html.escape(s, True) # $ escapeInput=s escapeKind=html escapeOutput=html.escape(..)
html.escape(s, False) # $ escapeInput=s escapeKind=html escapeOutput=html.escape(..)
html.escape(s, quote=False) # $ escapeInput=s escapeKind=html escapeOutput=html.escape(..)