From d457779ee13fe44c7e11059c34ecf484dd4c9ec7 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Fri, 27 Oct 2023 22:24:04 +0700 Subject: [PATCH] fix: return an error on invalid voter address --- src/graphql/operations/vp.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/graphql/operations/vp.ts b/src/graphql/operations/vp.ts index 7c90ef23..19855e0b 100644 --- a/src/graphql/operations/vp.ts +++ b/src/graphql/operations/vp.ts @@ -4,6 +4,10 @@ import db from '../../helpers/mysql'; const scoreAPIUrl = process.env.SCORE_API_URL || 'https://score.snapshot.org'; export default async function (_parent, { voter, space, proposal }) { + if (voter === '0x0000000000000000000000000000000000000000' || voter === '') { + return Promise.reject(new Error('invalid address')); + } + if (proposal) { const query = `SELECT * FROM proposals WHERE id = ?`; const [p] = await db.queryAsync(query, [proposal]);