Chapter 9: XSS samples

This commit is contained in:
Beth Griggs
2020-09-06 00:58:03 +01:00
parent a77f753e2f
commit c4714dffa7
7 changed files with 534 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
const express = require("express");
const app = express();
const he = require("he");
app.get("*", (req, res) => {
const { previous, lang, token } = req.query;
getServiceStatus((status) => {
const href = he.encode(`${previous}${token}/${lang}`);
res.send(`
<h1>Service Status</h1>
<div id=status>
${status}
</div>
<div>
<a href="${href}">Back</a>
</div>
`);
});
});
getServiceStatus = (callback) => {
const status = "All systems are running.";
callback(status);
};
app.listen(3000, () => {
console.log("Server listening on port 3000");
});