Skip to content

Commit 521579e

Browse files
committed
Fixes XSS vulnerabilities
1 parent 31bd318 commit 521579e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

web/backend/src/Server.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ function sendToDela(dataStr: string, req: express.Request, res: express.Response
251251
};
252252

253253
// we strip the `/api` part: /api/election/xxx => /election/xxx
254-
const uri = config.DELA_NODE_URL + req.baseUrl.slice(4);
254+
const uri = config.DELA_NODE_URL + xss(req.baseUrl.slice(4));
255255

256256
console.log('sending payload:', JSON.stringify(payload), 'to', uri);
257257

@@ -315,9 +315,7 @@ app.delete('/api/evoting/elections/:electionID', (req, res) => {
315315
const sign = kyber.sign.schnorr.sign(edCurve, scalar, Buffer.from(electionID));
316316

317317
// we strip the `/api` part: /api/election/xxx => /election/xxx
318-
const uri = config.DELA_NODE_URL + req.url.slice(4);
319-
320-
console.log('sending delete', 'to', uri, req.baseUrl, req.url);
318+
const uri = config.DELA_NODE_URL + xss(req.url.slice(4));
321319

322320
axios({
323321
method: req.method as Method,

0 commit comments

Comments
 (0)