mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-10 01:16:39 +02: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(compression());
|
||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
|
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
req.url = req.url.replace(/\/+/g, '/');
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
`${baseUriPath}/api/admin/features-batch`,
|
`${baseUriPath}/api/admin/features-batch`,
|
||||||
express.json({ strict: false, limit: '500kB' }),
|
express.json({ strict: false, limit: '500kB' }),
|
||||||
|
@ -29,6 +29,11 @@ afterAll(async () => {
|
|||||||
await db.destroy();
|
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 () => {
|
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);
|
||||||
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