39 lines
676 B
Plaintext
39 lines
676 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
module.exports.index = async function (req, res) {
|
|
const value = req.query.value;
|
|
|
|
res.setHeader("Set-Cookie", value); // Noncompliant
|
|
res.cookie("connect.sid", value); // Noncompliant
|
|
};
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
module.exports.index = async function (req, res) {
|
|
const value = req.query.value;
|
|
|
|
res.setHeader("X-Data", value);
|
|
res.cookie("data", value);
|
|
};
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|