34 lines
546 B
Plaintext
34 lines
546 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
function (req, res) {
|
|
const tainted = req.query.name;
|
|
|
|
res.send(tainted); // Noncompliant
|
|
};
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
import sanitizeHtml from "sanitize-html";
|
|
|
|
function (req, res) {
|
|
const tainted = req.query.name;
|
|
|
|
res.send(sanitizeHtml(tainted)); // Noncompliant
|
|
};
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|