Skip to content

Commit

Permalink
fix(core-p2p): ensure asset recipientId and amount are strings
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiodf authored and air1one committed Dec 3, 2020
1 parent c6d7421 commit 29eaf10
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/core-p2p/src/socket-server/utils/validate.ts
Expand Up @@ -35,7 +35,13 @@ export const validateTransactionLight = (transaction: any): boolean => {
return false;
}
for (const p of transaction.asset.payments) {
if (!p || typeof p !== "object" || Object.keys(p).length !== 2 || !p.recipientId || !p.amount) {
if (
!p ||
typeof p !== "object" ||
typeof p.recipientId !== "string" ||
typeof p.amount !== "string" ||
Object.keys(p).length !== 2
) {
return false;
}
}
Expand Down

0 comments on commit 29eaf10

Please sign in to comment.