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

number Participation limit #343

Merged
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
14 changes: 12 additions & 2 deletions controllers/campaign.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,16 @@
} = req.body
let [prom, date, hash] = [{}, Math.floor(Date.now() / 1000), req.body.hash]
var campaignDetails = await Campaigns.findOne({ hash }).lean()
let limit = campaignDetails.limit;
let userWallet = await Wallet.findOne({ UserId: req.user._id })
let numberParticipation = await CampaignLink.find({ id_campaign: hash,id_wallet:"0x"+userWallet.walletV2.keystore.address}).count()

Check failure

Code scanning / CodeQL

Database query built from user-controlled sources High

This query object depends on a
user-provided value
.
if (limit=== numberParticipation){
return responseHandler.makeResponseError(
res,
401,
'Limit participation reached'
)
}

try {
let promExist = await CampaignLink.exists({
Expand Down Expand Up @@ -924,7 +934,7 @@
)
cred = await unlockV2(req, res)

let userWallet = await Wallet.findOne({ UserId: req.user._id })

let decryptAccount =
await cred.Web3BEP20.eth.accounts.wallet.decrypt(
[userWallet.walletV2.keystore],
Expand Down Expand Up @@ -2952,4 +2962,4 @@
err.message ? err.message : err.error
)
}
}
}
Loading