Skip to content

Commit bf815da

Browse files
thomhurstclaude
andauthored
fix: Properly escape file path in chmod command (#1527) (#1732)
The chmod command was constructed with an unsanitized file path which could fail or be dangerous with special characters. This change wraps the path in single quotes and escapes any embedded single quotes with the standard '\'' technique. Fixes #1527 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent fac3579 commit bf815da

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/ModularPipelines/Context/FileInstaller.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public virtual async Task<CommandResult> InstallFromFileAsync(InstallerOptions o
2828
}, cancellationToken).ConfigureAwait(false);
2929
}
3030

31-
await _bash.Command(new BashCommandOptions($"chmod u+x {options.Path}"), cancellationToken).ConfigureAwait(false);
31+
var escapedPath = options.Path.Replace("'", "'\\''");
32+
await _bash.Command(new BashCommandOptions($"chmod u+x '{escapedPath}'"), cancellationToken).ConfigureAwait(false);
3233

3334
return await _bash.FromFile(new BashFileOptions(options.Path), cancellationToken).ConfigureAwait(false);
3435
}

0 commit comments

Comments
 (0)