mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 09:45:36 +08:00
fix(security): protect system app and task file boundaries
This commit is contained in:
1 parent
487b213dd8
commit
b49b0b63e6
6 files changed
+52
-3
No files matched your search
@@ -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');
|
||||
});
|
||||
Reference in new issue
Block a user