Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,42 @@ document.write("Hello, world!");
document.write(window.location.search);

document.write(window.location.search);


var express = require('express'),
app = express(),
port = process.env.PORT || 3000;

app.use(express.static('public'));

var routes = require("./api/routes");
routes(app);

if (! module.parent) {
app.listen(port);
}

module.exports = app

console.log("Server running on port " + port);

document.write("Hello, world!");

document.write(window.location.search);

Check warning

Code scanning / CodeQL

Client-side cross-site scripting

Cross-site scripting vulnerability due to [user-provided value](1).

document.write(window.location.search);

Check warning

Code scanning / CodeQL

Client-side cross-site scripting

Cross-site scripting vulnerability due to [user-provided value](1).


// It's a classic:
document.write(window.location.search)

Check warning

Code scanning / CodeQL

Client-side cross-site scripting

Cross-site scripting vulnerability due to [user-provided value](1).

// Here's a different one
app.get('/some/path', function(req, res) {
let url = req.param('url'),
host = urlLib.parse(url).host;
// BAD: the host of `url` may be controlled by an attacker
let regex = /^((www|beta).)?example.com/;

Check failure

Code scanning / CodeQL

Incomplete regular expression for hostnames

This regular expression has an unescaped '.' before 'example.com', so it might match more hosts than expected.
if (host.match(regex)) {
res.redirect(url);

Check warning

Code scanning / CodeQL

Server-side URL redirect

Untrusted URL redirection depends on a [user-provided value](1).
}
});