mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 01:39:52 +08:00
fix(security): restrict task environment controls and app scopes (#3121)
* fix(security): restrict task environment controls and app scopes * fix(security): preserve legacy scopes and add read-only access * feat(security): add read-only scopes for remaining resources * fix(security): reject apps scope grants in app API * fix(security): protect system app and task file boundaries * fix: block case-variant secret paths and task runner env overrides
This commit is contained in:
1 parent
a5f22f8d44
commit
442ab2c616
28 files changed
+782
-28
No files matched your search
@@ -115,7 +115,9 @@ for (const customData of [false, true]) {
|
||||
);
|
||||
for (const name of [
|
||||
'token.json',
|
||||
'TOKEN.JSON',
|
||||
'grpc/client.key',
|
||||
'Grpc/client.key',
|
||||
'secret-link',
|
||||
'data/scripts/secret-link',
|
||||
'data/scripts/../config/token.json',
|
||||
@@ -176,5 +178,23 @@ 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: '.TMP', file: 'own_user.list', filename: 'own_user.list' },
|
||||
{ path: '', file: '.tmp/own_user.list', filename: '.tmp/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