fix(security): protect system app and task file boundaries

This commit is contained in:
whyour committed 2026-11-03 09:32:40 +08:00
1 parent 487b213dd8
commit b49b0b63e6
6 files changed
+52 -3

No files matched your search

+16
View File
@@ -176,5 +176,21 @@ test('log APIs allow configuration-like names while retaining directory boundari
])
assert.equal((await invoke(method, route, values)).code, 403, filename);
}
const hidden = path.join(config.logPath, '.tmp', 'own_user.list');
fs.mkdirSync(path.dirname(hidden), { recursive: true });
fs.writeFileSync(hidden, 'hidden task command');
for (const values of [
{ path: '.tmp', file: 'own_user.list', filename: 'own_user.list' },
{ path: '', file: '.tmp/own_user.list', filename: '.tmp/own_user.list' },
]) {
for (const [method, route] of [
['get', '/detail'],
['post', '/download'],
['delete', '/'],
]) {
assert.equal((await invoke(method, route, values)).code, 403);
}
}
assert.equal(fs.readFileSync(hidden, 'utf8'), 'hidden task command');
assert.equal(fs.readFileSync(secret, 'utf8'), 'PANEL-SECRET');
});