2020-12-21 15:38:52 +01:00
|
|
|
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[]
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|