mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
25 lines
626 B
JavaScript
25 lines
626 B
JavaScript
var express = require('express');
|
|
var app = express();
|
|
// ...
|
|
app.get('/full-profile/:userId', function(req, res) {
|
|
|
|
if (req.cookies.loggedInUserId !== req.params.userId) { // NOT OK
|
|
// BAD: login decision made based on user controlled data
|
|
requireLogin();
|
|
} else {
|
|
// ... show private information
|
|
}
|
|
|
|
});
|
|
|
|
app.get('/full-profile/:userId', function(req, res) {
|
|
|
|
if (req.signedCookies.loggedInUserId !== req.params.userId) { // OK
|
|
// GOOD: login decision made based on server controlled data
|
|
requireLogin();
|
|
} else {
|
|
// ... show private information
|
|
}
|
|
|
|
});
|