Skip to content

Commit

Permalink
overwrite deriveMemo param before condition
Browse files Browse the repository at this point in the history
  • Loading branch information
gianfra-t committed Dec 16, 2024
1 parent 779ec3d commit 9a4c397
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions signer-service/src/api/middlewares/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ const { validateSignatureAndGetMemo } = require('../services/siwe.service');

const getMemoFromCookiesMiddleware = async (req, res, next) => {
// If the client didn't specify, we don't want to pass a derived memo even if a cookie was sent.

req.derivedMemo = null; // Explicit overwrite to avoid tampering, defensive.
if (!Boolean(req.body.memo)) {
req.derivedMemo = null;
return next();
}
try {
Expand Down Expand Up @@ -52,7 +53,6 @@ const getMemoFromCookiesMiddleware = async (req, res, next) => {
}

req.derivedMemo = resultMemo;
console.log('derived memo', req.derivedMemo);

next();
} catch (err) {
Expand Down

0 comments on commit 9a4c397

Please sign in to comment.