Skip to content

Commit cbdb5f1

Browse files
committed
fix(dashboard-api): allow LOADTEST_BYPASS_KEY header to skip CSRF for load testing
1 parent 937b321 commit cbdb5f1

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/dashboard-api/src/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ app.use((req, res, next) => {
8888
const authHeader = req.headers.authorization || '';
8989
const isPATRequest = authHeader.startsWith('Bearer ubpat_');
9090

91-
if (req.path === '/api/billing/webhook' || isCliRoute || isPATRequest) {
91+
const bypassKey = process.env.LOADTEST_BYPASS_KEY;
92+
const isLoadTestBypass = bypassKey && req.headers['x-bypass-rate-limit'] === bypassKey;
93+
94+
if (req.path === '/api/billing/webhook' || isCliRoute || isPATRequest || isLoadTestBypass) {
9295
return next();
9396
}
9497
csrfProtection(req, res, next);

0 commit comments

Comments
 (0)