Skip to content

Commit 84536ab

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

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎api/javascript/search/server.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,23 @@ class Server {
6565
}
6666
});
6767

68+
app.set('query parser', 'simple');
69+
6870
app.get('/search/:query', async (req, res) => {
69-
res.send(await this.searchQuery(req.params.query));
71+
const query = String(req.params.query)
72+
73+
res.send(await this.searchQuery(query))
7074
});
71-
75+
7276
app.get('/state', async (req, res) => {
7377
res.send(await this.getState());
7478
});
75-
79+
7680
app.post('/hooks', (req, res) => {
7781
res.send(200);
7882
});
7983
}
80-
84+
8185
// We could filter out the properties that we don't want the frontend to have
8286
async getState() {
8387
await this.refreshState();

0 commit comments

Comments
 (0)