style: rustfmt the four files the repo-less mission fix touched
Found while removing .github/workflows/ci.yml: three of the four files in that change were unformatted, and four of the diffs were newly introduced (the new prompt tests and the tool_preamble format! call). Formatting only the files that change already touched — a repo-wide `cargo fmt` would be 63 files of unrelated churn and belongs in its own commit. Mechanical; `cargo test -p cm-api --lib` stays at 322 passed. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
022ef98e44
commit
548f977212
@@ -280,7 +280,11 @@ async fn register_empty_marker(
|
||||
/// the end of the turn (`microvm_executor` writes them over
|
||||
/// `mission_workspace::checkout_path`). Asking docker for a VM mission's files
|
||||
/// would query a container that never existed.
|
||||
async fn collect_into(mission_id: Uuid, dest: &Path, runtime_kind: &str) -> Result<Vec<PathBuf>, String> {
|
||||
async fn collect_into(
|
||||
mission_id: Uuid,
|
||||
dest: &Path,
|
||||
runtime_kind: &str,
|
||||
) -> Result<Vec<PathBuf>, String> {
|
||||
// A stale copy from an earlier attempt would be registered as this pass's
|
||||
// output — the same "captured a tree nobody wrote" shape capture avoids.
|
||||
let _ = std::fs::remove_dir_all(dest);
|
||||
@@ -308,8 +312,7 @@ async fn collect_into(mission_id: Uuid, dest: &Path, runtime_kind: &str) -> Resu
|
||||
/// shell-out, and this runs as the server's own uid against its own directory.
|
||||
fn copy_tree(src: &Path, dest: &Path) -> Result<(), String> {
|
||||
std::fs::create_dir_all(dest).map_err(|e| format!("create {}: {e}", dest.display()))?;
|
||||
let entries =
|
||||
std::fs::read_dir(src).map_err(|e| format!("read {}: {e}", src.display()))?;
|
||||
let entries = std::fs::read_dir(src).map_err(|e| format!("read {}: {e}", src.display()))?;
|
||||
for entry in entries.flatten() {
|
||||
let from = entry.path();
|
||||
let to = dest.join(entry.file_name());
|
||||
@@ -466,17 +469,15 @@ mod tests {
|
||||
|
||||
// ...and the traversal shape this guards against is not, once resolved.
|
||||
let escaped = root.join("..").join("..").join("etc/passwd");
|
||||
let normalised: PathBuf = escaped
|
||||
.components()
|
||||
.fold(PathBuf::new(), |mut acc, c| {
|
||||
match c {
|
||||
std::path::Component::ParentDir => {
|
||||
acc.pop();
|
||||
}
|
||||
other => acc.push(other),
|
||||
let normalised: PathBuf = escaped.components().fold(PathBuf::new(), |mut acc, c| {
|
||||
match c {
|
||||
std::path::Component::ParentDir => {
|
||||
acc.pop();
|
||||
}
|
||||
acc
|
||||
});
|
||||
other => acc.push(other),
|
||||
}
|
||||
acc
|
||||
});
|
||||
assert!(
|
||||
!normalised.starts_with(&root),
|
||||
"a traversal must not resolve back inside the outputs root: {normalised:?}"
|
||||
|
||||
Reference in New Issue
Block a user