Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper Type Validation #438

Open
wants to merge 2 commits into
base: security_fixes
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions src/controllers/v1/mentors.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/middlewares/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ function containsSpecialChars(str) {
return specialChars.test(str)
}
module.exports = (req, res, next) => {
const searchData = req.query.search
req.pageNo = req.query.page && Number(req.query.page) > 0 ? Number(req.query.page) : 1

req.pageSize =
req.query.limit && Number(req.query.limit) > 0 && Number(req.query.limit) <= 100 ? Number(req.query.limit) : 100

req.searchText = req.query.search && req.query.search != '' ? decodeURI(req.query.search) : ''
req.searchText =
searchData && typeof searchData === 'string' && searchData.trim() !== '' ? decodeURI(searchData) : ''
/* let buff = new Buffer(req.searchText, 'base64')
req.searchText = buff.toString('ascii') */
if (containsSpecialChars(req.searchText)) {
Expand Down