fix: harden container config DB layer
- config-add/remove-package now rebuild image + restart containers - Deduplicate packages in self-mod install_packages handler - Add runtime whitelist guards for SQL column interpolation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,15 +30,19 @@ export const applyInstallPackages: ApprovalHandler = async ({ session, payload,
|
||||
return;
|
||||
}
|
||||
|
||||
// Append new packages to existing lists in the DB
|
||||
// Append new packages to existing lists in the DB (deduplicated)
|
||||
if (payload.apt) {
|
||||
const existing = JSON.parse(configRow.packages_apt) as string[];
|
||||
existing.push(...(payload.apt as string[]));
|
||||
for (const pkg of payload.apt as string[]) {
|
||||
if (!existing.includes(pkg)) existing.push(pkg);
|
||||
}
|
||||
updateContainerConfigJson(agentGroup.id, 'packages_apt', existing);
|
||||
}
|
||||
if (payload.npm) {
|
||||
const existing = JSON.parse(configRow.packages_npm) as string[];
|
||||
existing.push(...(payload.npm as string[]));
|
||||
for (const pkg of payload.npm as string[]) {
|
||||
if (!existing.includes(pkg)) existing.push(pkg);
|
||||
}
|
||||
updateContainerConfigJson(agentGroup.id, 'packages_npm', existing);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user