fix: keep commands and secrets out of ExecError messages and inspect output

This commit is contained in:
Narciso
2026-10-21 22:18:25 -04:00
parent e0c8d80cde
commit e76283bc09
3 changed files with 46 additions and 14 deletions
@@ -0,0 +1,17 @@
import { inspect } from "node:util";
import { execAsync, ExecError } from "@dokploy/server/utils/process/execAsync";
import { describe, expect, it } from "vitest";
describe("execAsync failure", () => {
it("does not leak secrets embedded in the command", async () => {
const secret = "s3cr3t-value";
const error = await execAsync(`printf %s '${secret}' >/dev/null; exit 3`)
.then(() => null)
.catch((e) => e);
expect(error).toBeInstanceOf(ExecError);
expect(error.exitCode).toBe(3);
expect(error.message).not.toContain(secret);
expect(inspect(error)).not.toContain(secret);
});
});