Skip to content

Commit f3c7edc

Browse files
committed
fix: use proper linting
1 parent fe0a84d commit f3c7edc

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

‎packages/server/src/utils/builders/compose.ts‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,29 @@ const sanitizeCommand = (command: string) => {
8282
);
8383
}
8484

85-
if (sanitizedCommand.includes("&")) {
85+
if (sanitizedCommand.includes("&")) {
8686
// Block single '&' (e.g., backgrounding tasks) or malformed chains like '&&&'
87-
if (/(?<!&)&(?!&)/.test(sanitizedCommand) || sanitizedCommand.includes("&&&")) {
87+
if (
88+
/(?<!&)&(?!&)/.test(sanitizedCommand) ||
89+
sanitizedCommand.includes("&&&")
90+
) {
8891
throw new Error("Single '&' is not allowed. Use '&&' for chaining.");
8992
}
9093

9194
// Split by '&&' and check that every chained command (skipping the first one) is safe
9295
const chains = sanitizedCommand.split("&&").map((cmd) => cmd.trim());
93-
const isSafeChain = chains.slice(1).every((cmd) =>
94-
cmd.startsWith("docker compose ") || cmd.startsWith("docker-compose ")
95-
);
96+
const isSafeChain = chains
97+
.slice(1)
98+
.every(
99+
(cmd) =>
100+
cmd.startsWith("docker compose ") ||
101+
cmd.startsWith("docker-compose "),
102+
);
96103

97104
if (!isSafeChain) {
98-
throw new Error("Chained commands must strictly start with 'docker compose '");
105+
throw new Error(
106+
"Chained commands must strictly start with 'docker compose '",
107+
);
99108
}
100109
}
101110

0 commit comments

Comments
 (0)