Skip to content

Commit

Permalink
58 fix code scanning issue set number 3 (#62)
Browse files Browse the repository at this point in the history
* added rateLimmiter to get requests

* added limiter to routes

---------

Co-authored-by: d-linko <[email protected]>
  • Loading branch information
d-linko and d-linko authored Nov 28, 2023
1 parent f46b409 commit b646125
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions anms-ui/server/core/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
// Do something here in the future? Maybe...
next(); // continue doing what we were doing and go to the route
});


// Better Message
router.all('/', function (req, res) {
Expand All @@ -91,16 +92,16 @@
// ---- User Routes ---- //
const users = require('../components/users');

router.get('/users/:userName', users.getUserByUsernameWebSafe);
router.post('/users', users.createUserProfile);
router.put('/users/:userName', users.updateUserProfile);
router.get('/users/:userName', userLimiter, users.getUserByUsernameWebSafe);
router.post('/users', userLimiter, users.createUserProfile);
router.put('/users/:userName', userLimiter, users.updateUserProfile);

// ---- Adm Routes ---- //
const adms = require('../components/adms');

router.get('/core/adms', adms.getAll);
router.get('/core/adms', userLimiter, adms.getAll);
router.get('/core/adms/:adm_enum', adms.getOne);
router.post('/core/adms', upload.single('adm'), adms.upload);
router.post('/core/adms', userLimiter, upload.single('adm'), adms.upload);



Expand Down Expand Up @@ -180,7 +181,7 @@

//------------- Routes -------------//

router.all('/*', function (req, res) {
router.all('/*', userLimiter, function (req, res) {
res.status(404);
res.type('html').sendFile(config.client.error);
});
Expand Down

0 comments on commit b646125

Please sign in to comment.