Skip to content

Commit

Permalink
changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Hemu21 committed May 26, 2024
1 parent 7298183 commit 684caf7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions backend/app/routes/contactUs/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const { ErrorHandler } = require('../../../helpers/error');
const constants = require('../../../constants');

module.exports = async (req, res, next) => {
const payload = res.locals.decode;
if (!payload.isSuperAdmin) {
return res.status(401).json({ error: 'You are not authorized to perform this action' });
}
const [err, response] = await to(contactUs.find());
if (err) {
const error = new ErrorHandler(constants.ERRORS.DATABASE, {
Expand Down
4 changes: 2 additions & 2 deletions backend/app/routes/contactUs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const getContact = require('./get');
const deleteContactUs = require('./delete');
const { authMiddleware } = require('../../../helpers/middlewares/auth');

router.get('/getcontactus', getContact);
router.get('/getcontactus', authMiddleware, getContact);

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
router.post('/', validation(contactValidationSchema), postContact);
router.delete("/deleteContactUs",authMiddleware, deleteContactUs);
router.delete('/deleteContactUs', authMiddleware, deleteContactUs);

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
a database access
, but is not rate-limited.

module.exports = router;

0 comments on commit 684caf7

Please sign in to comment.