Skip to content

Commit 18f14d0

Browse files
committed
🩹 Attempt to fix JS server-side request forgery
1 parent f13a09c commit 18f14d0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎api/javascript/search/server.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,20 @@ class Server {
6666
});
6767

6868
app.get('/search/:query', async (req, res) => {
69-
res.send(await this.searchQuery(req.params.query));
69+
const search = encodeURIComponent(req.params.query)
70+
71+
res.send(await this.searchQuery(search));
7072
});
71-
73+
7274
app.get('/state', async (req, res) => {
7375
res.send(await this.getState());
7476
});
75-
77+
7678
app.post('/hooks', (req, res) => {
7779
res.send(200);
7880
});
7981
}
80-
82+
8183
// We could filter out the properties that we don't want the frontend to have
8284
async getState() {
8385
await this.refreshState();

0 commit comments

Comments
 (0)