mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-22 10:32:40 +08:00
fix(ql3): preserve automation manager least privilege
This commit is contained in:
+2
-3
@@ -319,8 +319,7 @@ async function loadPlan(
|
||||
const result = await client.query<Row>(
|
||||
`SELECT plan_json AS "planJson"
|
||||
FROM "ql3"."cluster_legacy_env_migration_plans"
|
||||
WHERE plan_id = $1
|
||||
FOR SHARE`,
|
||||
WHERE plan_id = $1`,
|
||||
[intent.planId],
|
||||
);
|
||||
if (result.rows.length !== 1) throw conflict();
|
||||
@@ -1126,7 +1125,7 @@ export class PostgresClusterLegacyEnvMigrationApplicationRepository
|
||||
);
|
||||
if (occupied) throw conflict();
|
||||
const project = await client.query<{ status: unknown }>(
|
||||
`SELECT status FROM "ql3"."projects" WHERE id = $1 FOR SHARE`,
|
||||
`SELECT status FROM "ql3"."projects" WHERE id = $1`,
|
||||
[intent.projectId],
|
||||
);
|
||||
if (project.rows.length !== 1 || project.rows[0]?.status !== 'active') {
|
||||
|
||||
@@ -5019,6 +5019,12 @@ if (!migrationConnectionString) {
|
||||
eventCount: 2,
|
||||
},
|
||||
]);
|
||||
await database.pool.query(
|
||||
`UPDATE "ql3"."trigger_schedules"
|
||||
SET next_fire_at_ms = $1
|
||||
WHERE project_id = $2 AND trigger_id = $3`,
|
||||
[forcedDueAtMs + 3_600_000, 'default', triggerId],
|
||||
);
|
||||
|
||||
const takeoverTriggerId = `trigger-takeover-${'x'.repeat(32)}`;
|
||||
await new PostgresTriggerRepository(database.pool).appendTriggerRevision({
|
||||
@@ -6982,7 +6988,7 @@ if (!migrationConnectionString) {
|
||||
assert.equal(row.taskSpec.config.timeoutMs, 30_000);
|
||||
assert.equal(row.taskName, task.name);
|
||||
assert.equal(row.taskDescription, task.description);
|
||||
assert.deepEqual(row.taskLabels, task.labels);
|
||||
assert.deepEqual(row.taskLabels, { ...task.labels });
|
||||
assert.equal(row.executionPlan.environmentBundleRef, secretRef);
|
||||
assert.equal(row.triggerRevision, 2);
|
||||
assert.equal(row.triggerTaskRevision, 3);
|
||||
|
||||
Reference in New Issue
Block a user