mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-23 00:16:25 +01:00
fix: remove consecutive slashes (#3882)
A small middleware who will rewrite potential dual slashes to a single slash.
This commit is contained in:
parent
52904ee038
commit
5534e4deeb
@ -66,6 +66,11 @@ export default async function getApp(
|
||||
app.use(compression());
|
||||
app.use(cookieParser());
|
||||
|
||||
app.use((req, res, next) => {
|
||||
req.url = req.url.replace(/\/+/g, '/');
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(
|
||||
`${baseUriPath}/api/admin/features-batch`,
|
||||
express.json({ strict: false, limit: '500kB' }),
|
||||
|
@ -29,6 +29,11 @@ afterAll(async () => {
|
||||
await db.destroy();
|
||||
});
|
||||
|
||||
test('Access to//api/admin/tags are refused no matter how many leading slashes', async () => {
|
||||
await app.request.get('//api/admin/tags').expect(401);
|
||||
await app.request.get('////api/admin/tags').expect(401);
|
||||
});
|
||||
|
||||
test('Access to /api/client/features are refused no matter how many leading slashes', async () => {
|
||||
await app.request.get('/api/client/features').expect(401);
|
||||
await app.request.get('/////api/client/features').expect(401);
|
||||
|
Loading…
Reference in New Issue
Block a user