Skip to content

Commit d52acee

Browse files
committed
removed reading x api key from query object for better security that is not allowed
1 parent ae378d8 commit d52acee

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

‎apps/public-api/src/middlewares/verifyApiKey.js‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@ const {
88
module.exports = async (req, res, next) => {
99
try {
1010
// x-api-key header is preferred. For browser-navigation endpoints (e.g. social OAuth start),
11-
// fall back to ?key= query param but only allow publishable keys via query to avoid
12-
// secret key exposure in server access logs.
1311
const headerKey = req.header('x-api-key');
14-
const queryKey = req.query.key && !String(req.query.key).startsWith('sk_')
15-
? req.query.key
16-
: undefined;
17-
const apiKey = headerKey || queryKey;
12+
13+
const apiKey = headerKey;
1814
if (!apiKey) {
1915
return res.status(401).json({ error: 'API key not found' });
2016
}

0 commit comments

Comments
 (0)