mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-11-08 22:02:12 +00:00
fix(security): prevent command injection in governance service and fix build errors
- Mitigate command injection in `src/services/governance/index.js` by using explicit array arguments with `execFileSync` and adding a security comment. - Add regression test `test/governance-security.test.mjs` verifying the fix against simulated exploit attempts. - Fix CI build failures by resolving circular dependencies and duplicate declarations in `src/lock-utils.mjs`, `src/lock-ops.mjs`, `src/lock-publisher.mjs`, and `src/relay-health.mjs`. - Resolve linting errors in tests and implementation files. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
5e639f1387
commit
bdd3ed8c8f
12 files changed
+21
-3790
No files matched your search
@@ -44,7 +44,7 @@ async function runTest() {
|
||||
|
||||
// Malicious payload
|
||||
const maliciousPayload = 'attacker"; touch /tmp/pwned_check; echo "';
|
||||
const proposalId = `test-proposal-${Date.now()}`;
|
||||
// const proposalId = `test-proposal-${Date.now()}`; // unused
|
||||
|
||||
// Manually create proposal metadata and files because createProposal also uses git diff
|
||||
// We can use createProposal from the service, but we need to pass the malicious agent name there.
|
||||
@@ -101,7 +101,7 @@ async function runTest() {
|
||||
process.chdir(originalCwd);
|
||||
await fs.rm(tempDir, { recursive: true, force: true });
|
||||
// Also remove /tmp/pwned_check if it exists (it shouldn't)
|
||||
try { await fs.unlink('/tmp/pwned_check'); } catch {}
|
||||
try { await fs.unlink('/tmp/pwned_check'); } catch { /* ignore */ }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user