fix(deps): update vulnerable transitive dependencies

This commit is contained in:
DrSmoothl committed 2026-11-03 09:41:20 +08:00
1 parent a977228a09
commit a8f460499b
4 files changed
+69 -130

No files matched your search

@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { Hono } from 'hono';
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { registerStaticFrontend } from '../src/webui/static-frontend';
@@ -44,4 +44,35 @@ describe('runtime target document delivery', () => {
expect((await app.request(url)).status).toBe(404);
}
});
it('does not serve a protected static path through a second percent decode', async () => {
mkdirSync(path.join(root, 'admin'));
writeFileSync(path.join(root, 'admin', 'private.txt'), 'protected fixture');
const app = new Hono();
app.use('/admin/*', async (c) => c.text('unauthorized', 401));
registerStaticFrontend(app, root, null);
for (const url of ['/admin/private.txt', '/%61dmin/private.txt']) {
const response = await app.request(url);
expect(response.status).toBe(401);
expect(await response.text()).toBe('unauthorized');
}
// The router sees /%61dmin; decoding again would reach /admin
// after the middleware for that prefix has already been skipped.
const response = await app.request('/%%36%31dmin/private.txt');
expect(await response.text()).toBe(html);
});
it.each(['hello world.js', '图标.js'])(
'still serves ordinarily encoded asset names: %s',
async (filename) => {
writeFileSync(path.join(root, filename), 'window.encodedAsset = true;');
const app = new Hono();
registerStaticFrontend(app, root, null);
const response = await app.request(`/${encodeURIComponent(filename)}`);
expect(response.status).toBe(200);
expect(await response.text()).toBe('window.encodedAsset = true;');
},
);
});