diff options
| author | Adam Soltys <[email protected]> | 2021-01-10 22:49:14 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-01-10 22:49:14 -0800 |
| commit | 936cea8723fdba362a06feb6809d3a06ae31659c (patch) | |
| tree | a9b62b5a6c3409ec4cb9f4eb1c52d4202e6a4416 | |
| parent | fbf9d28daeb5b40550c79e8920693b616d583c50 (diff) | |
| download | coinos-server-936cea8723fdba362a06feb6809d3a06ae31659c.tar.gz coinos-server-936cea8723fdba362a06feb6809d3a06ae31659c.zip | |
validate amounts
| -rw-r--r-- | routes/assets.js | 2 | ||||
| -rw-r--r-- | routes/send.js | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/routes/assets.js b/routes/assets.js index 270a3e78..9a9c6836 100644 --- a/routes/assets.js +++ b/routes/assets.js @@ -286,11 +286,13 @@ app.post( ah(async (req, res) => { const { user } = req; const { asset, amount } = req.body; + amount = parseInt(amount); try { await db.transaction(async transaction => { let { account } = user; + if (amount < 0) throw new Error("Amount to load cannot be negative"); if (account.asset !== config.liquid.btcasset) throw new Error( "Faucet has to be funded with bitcoin. Try sending from another wallet." diff --git a/routes/send.js b/routes/send.js index 78c6d9b7..6cb73b55 100644 --- a/routes/send.js +++ b/routes/send.js @@ -4,6 +4,7 @@ const uuidv4 = require("uuid/v4"); module.exports = ah(async (req, res, next) => { let { amount, asset, memo, username } = req.body; let { user } = req; + amount = parseInt(amount); if (!asset) asset = config.liquid.btcasset; |
