Files
codeql/javascript/ql/test/library-tests/frameworks/HTTP-heuristics/src/tst.js
2026-07-05 17:41:04 +01:00

159 lines
4.1 KiB
JavaScript

var express = require('express');
var app = express();
app.get('/some/path', function(req, res) {})
someOtherApp.get('/some/path', function(req, res) {}) // $ Alert[js/unpromoted-route-setup-candidate]
someOtherApp.get('/some/path', function(request, response) {}) // $ Alert[js/unpromoted-route-setup-candidate]
someOtherApp.get('/some/path', function(r) {
r.acceptsCharsets()
})
someOtherApp.get('/some/path', function(r) {
r.protocol
})
someOtherApp.get('/some/path', function(r, s) {
s.attachment()
})
someOtherApp.get('/some/path', function(r, s) {
s.headersSent
})
someOtherApp.get('/some/path', function(r, s, n) {
n('route')
})
someOtherApp.delete('/some/path', function(req, res) {}) // $ Alert[js/unpromoted-route-setup-candidate]
someOtherApp.get('/some/path',
function(req, res) {},
function(req, res) {}) // $ Alert[js/unpromoted-route-setup-candidate]
someOtherApp.get('/some/path', [
function(req, res) {},
function(req, res) {}
]) // $ Alert[js/unpromoted-route-setup-candidate]
someOtherApp.get('/some/path',
function() {},
function(req, res) {}) // $ Alert[js/unpromoted-route-setup-candidate]
function f(req, res) {} // $ Alert[js/unpromoted-route-handler-candidate]
function f(ctx, next) {
ctx.acceptsCharsets()
}
function f(req, res) {
req()
} // $ Alert[js/unpromoted-route-handler-candidate]
function called(req,res) {
} // $ Alert[js/unpromoted-route-handler-candidate]
called()
function f(req,res) {
return;
} // $ Alert[js/unpromoted-route-handler-candidate]
function f(req,res) {
return x;
} // $ Alert[js/unpromoted-route-handler-candidate]
function adHocTestsFor_HeuristicRouteHandler() {
function rh_dead(req, res) {
} // $ Alert[js/unpromoted-route-handler-candidate]
function rh_flowToSetup(req, res) {
}
app.get('/some/path', rh_flowToSetup);
function rh_flowToSetupArray(req, res) {
}
app.get('/some/path', [rh_flowToSetupArray]);
function rh_flowToHeuristicSetup(req, res) {
}
unknownApp.get('/some/path', rh_flowToHeuristicSetup) // $ Alert[js/unpromoted-route-setup-candidate]
}
function adHocTestsFor_HeuristicRouteSetups() {
function rh(req, res) {
}
app.get('/some/path', rh);
unknownApp.get('/some/path', rh); // $ Alert[js/unpromoted-route-setup-candidate]
unknownApp.get('/some/path', [rh]); // $ Alert[js/unpromoted-route-setup-candidate]
unknownApp.get('/some/path', unknown);
unknownApp.get('/some/path', [unknown]);
unknownApp.get('/some/path', unknown, rh); // $ Alert[js/unpromoted-route-setup-candidate]
}
function adHocTestsFor_HeuristicRouteHandler_withTracking() {
function get_rh_dead() {
return function rh_dead(req, res) {
} // $ Alert[js/unpromoted-route-handler-candidate]
}
var rh_dead = get_rh_dead();
function get_rh_flowToSetup() {
return function rh_flowToSetup(req, res) {
}
}
var rh_flowToSetup = get_rh_flowToSetup();
app.get('/some/path', rh_flowToSetup);
function get_rh_flowToSetupArray() {
return function rh_flowToSetupArray(req, res) {
}
}
var rh_flowToSetupArray = get_rh_flowToSetupArray();
app.get('/some/path', [rh_flowToSetupArray]);
function get_rh_flowToHeuristicSetup() {
return function rh_flowToHeuristicSetup(req, res) {
}
}
var rh_flowToHeuristicSetup = get_rh_flowToHeuristicSetup();
unknownApp.get('/some/path', rh_flowToHeuristicSetup) // $ Alert[js/unpromoted-route-setup-candidate]
}
function adHocTestsFor_HeuristicRouteSetups_withTracking() {
function get_rh() {
return function rh(req, res) {
}
}
var rh = get_rh();
app.get('/some/path', rh);
unknownApp.get('/some/path', rh); // $ Alert[js/unpromoted-route-setup-candidate]
unknownApp.get('/some/path', [rh]); // $ Alert[js/unpromoted-route-setup-candidate]
unknownApp.get('/some/path', unknown);
unknownApp.get('/some/path', [unknown]);
unknownApp.get('/some/path', unknown, rh); // $ Alert[js/unpromoted-route-setup-candidate]
}