Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/bin/ampup/src/version_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,14 @@
// Handle ampd symlink
let ampd_active_path = self.config.active_binary_path();
if ampd_active_path.exists() || ampd_active_path.is_symlink() {
fs::remove_file(&ampd_active_path).context("Failed to remove existing ampd symlink")?;

Check warning on line 124 in crates/bin/ampup/src/version_manager.rs

View workflow job for this annotation

GitHub Actions / Check rustfmt style

Diff in /home/runner/work/amp/amp/crates/bin/ampup/src/version_manager.rs
}
// Prevent path traversal attacks by rejecting paths containing '..'
if ampd_binary_path.components().any(|c| c == std::path::Component::ParentDir) ||
ampd_active_path.components().any(|c| c == std::path::Component::ParentDir) {
return Err(anyhow::anyhow!("Invalid input: {}, {}",
ampd_binary_path.display(), ampd_active_path.display()));
}
symlink(&ampd_binary_path, &ampd_active_path).context("Failed to create ampd symlink")?;

// Handle ampctl symlink
Expand Down
Loading