46 lines
910 B
Plaintext
46 lines
910 B
Plaintext
include::../description.adoc[]
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
== Sensitive Code Example
|
|
|
|
----
|
|
// === Built-in NodeJS modules ===
|
|
const http = require('http');
|
|
const https = require('https');
|
|
|
|
http.createServer(function(req, res) {
|
|
res.setHeader('Set-Cookie', ['type=ninja', 'lang=js']); // Sensitive
|
|
});
|
|
https.createServer(function(req, res) {
|
|
res.setHeader('Set-Cookie', ['type=ninja', 'lang=js']); // Sensitive
|
|
});
|
|
----
|
|
|
|
----
|
|
// === ExpressJS ===
|
|
const express = require('express');
|
|
const app = express();
|
|
app.use(function(req, res, next) {
|
|
res.cookie('name', 'John'); // Sensitive
|
|
});
|
|
----
|
|
|
|
----
|
|
// === In browser ===
|
|
// Set cookie
|
|
document.cookie = "name=John"; // Sensitive
|
|
----
|
|
|
|
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[]
|