Skip to content
Snippets Groups Projects
Commit b3d862bb authored by Lloyd Hilaiel's avatar Lloyd Hilaiel
Browse files

ensure that the internal code_update URL is hit *precisely* to reduce the risk...

ensure that the internal code_update URL is hit *precisely* to reduce the risk of improperly configured servers and sloppy expressjs routing letting just anyone reboot a server.  bug #699171
parent 989aeb74
No related branches found
No related tags found
No related merge requests found
......@@ -111,9 +111,15 @@ exports.handleTerminationSignals = function(app, callback) {
process.on('SIGINT', endIt('INT')).on('SIGTERM', endIt('TERM')).on('SIGQUIT', endIt('QUIT'));
};
const CODE_UPDATE_URL = '/code_update';
exports.installUpdateHandler = function(app, callback) {
var terminate = connectionListener(app);
app.get('/code_update', function(req, resp, next) {
app.get(CODE_UPDATE_URL, function(req, resp, next) {
// don't allow an imprecise match (like one with a trailing slash) to shut the server down.
// bug #699171
if (req.url !== CODE_UPDATE_URL) return next();
logger.warn("code updated. closing " + app.connections + " connections and shutting down.");
terminate(callback);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment