mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 09:45:36 +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
@@ -24,8 +24,9 @@ test('startup closes interrupted instances without inventing exit codes or rewri
|
||||
{ id: 4, status: 3, started_at: 100, finished_at: 130, exit_code: 7 },
|
||||
]);
|
||||
const systemConfig = { info: { lang: 'en-US' } };
|
||||
const startupEvents = [];
|
||||
const service = {
|
||||
set_envs: async () => {},
|
||||
set_envs: async () => { startupEvents.push('environment'); },
|
||||
getAuthInfo: async () => ({}),
|
||||
initializeSystemApp: async () => {},
|
||||
refreshApps: async () => {},
|
||||
@@ -70,7 +71,10 @@ test('startup closes interrupted instances without inventing exit codes or rewri
|
||||
'../shared/i18n': { setLang() {} },
|
||||
'./logger': {},
|
||||
'../schedule/client': {
|
||||
readiness: { configure() {}, recover: async () => {} },
|
||||
readiness: {
|
||||
configure() {},
|
||||
recover: async () => { startupEvents.push('scheduler'); },
|
||||
},
|
||||
},
|
||||
}).default;
|
||||
// Dependency installation is unrelated to startup reconciliation.
|
||||
@@ -82,6 +86,7 @@ test('startup closes interrupted instances without inventing exit codes or rewri
|
||||
} finally {
|
||||
global.setTimeout = originalTimeout;
|
||||
}
|
||||
assert.deepEqual(startupEvents, ['environment', 'scheduler']);
|
||||
const rows = await instances.findAll({ order: [['id', 'ASC']], raw: true });
|
||||
assert.equal(rows[0].status, 2);
|
||||
assert.ok(
|
||||
@@ -109,6 +114,9 @@ test('startup closes interrupted instances without inventing exit codes or rewri
|
||||
} finally {
|
||||
global.setTimeout = originalTimeout;
|
||||
}
|
||||
assert.deepEqual(startupEvents, [
|
||||
'environment', 'scheduler', 'environment', 'scheduler',
|
||||
]);
|
||||
assert.deepEqual(
|
||||
await instances.findAll({ order: [['id', 'ASC']], raw: true }),
|
||||
rows,
|
||||
|
||||
Reference in new issue
Block a user