Skip to content

Commit ea64b4e

Browse files
committed
Added test case for axios.interceptors.request
1 parent cf8637f commit ea64b4e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const express = require("express");
2+
const axios = require("axios");
3+
4+
const app = express();
5+
6+
let userProvidedUrl = "";
7+
8+
axios.interceptors.request.use(
9+
function (config) {
10+
if (userProvidedUrl) {
11+
config.url = userProvidedUrl; // SSRF -- not flagged
12+
}
13+
return config;
14+
},
15+
error => error
16+
);
17+
18+
app.post("/fetch", (req, res) => {
19+
const { url } = req.body;
20+
userProvidedUrl = url;
21+
axios.get("placeholder");
22+
});

0 commit comments

Comments
 (0)