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 #657

Open
wants to merge 3 commits into
base: release_2.6.1_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
2 changes: 1 addition & 1 deletion src/controllers/v1/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = class Sessions {
async update(req) {
try {
// check if notifyUser is true or false. By default true
const notifyUser = req.query.notifyUser ? req.query.notifyUser.toLowerCase() === 'true' : true
const notifyUser = req.query.notifyUser ? String(req.query.notifyUser).toLowerCase() === 'true' : true

if (req.params.id) {
if (req.headers.timezone) {
Expand Down
4 changes: 3 additions & 1 deletion src/middlewares/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ function containsSpecialChars(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) : ''
if (req.searchText != '') {
let buff = new Buffer.from(req.searchText, 'base64')
req.searchText = buff.toString('ascii')
Expand Down
2 changes: 1 addition & 1 deletion src/services/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ module.exports = class SessionsHelper {
})
}

if (session.seats_remaining <= 0) {
if (session.seats_remaining <= 0 && session.created_by != userId) {
return responses.failureResponse({
message: 'SESSION_SEAT_FULL',
statusCode: httpStatusCode.bad_request,
Expand Down