Skip to content

Commit aedee56

Browse files
committed
feat(jailer): remove requirement for an executable name
Now jailer will not complain if the executable does not contain `firecracker` in it's name. This restriction was unnecessary and it's removal is not a breaking change. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 931a233 commit aedee56

File tree

3 files changed

+0
-33
lines changed

3 files changed

+0
-33
lines changed

src/jailer/src/env.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,6 @@ impl Env {
301301
.unwrap()
302302
.to_string();
303303

304-
if !exec_file_name.contains("firecracker") {
305-
return Err(JailerError::ExecFileName(exec_file_name));
306-
}
307-
308304
Ok((exec_file_path, exec_file_name))
309305
}
310306

@@ -1048,17 +1044,6 @@ mod tests {
10481044
"/tmp/firecracker_test_dir is not a file"
10491045
);
10501046

1051-
// Error case 3: Filename without "firecracker"
1052-
File::create("/tmp/firecracker_test_dir/foobarbaz").unwrap();
1053-
assert_eq!(
1054-
format!(
1055-
"{}",
1056-
Env::validate_exec_file("/tmp/firecracker_test_dir/foobarbaz").unwrap_err()
1057-
),
1058-
"Invalid filename. The filename of `--exec-file` option must contain \"firecracker\": \
1059-
foobarbaz"
1060-
);
1061-
std::fs::remove_file("/tmp/firecracker_test_dir/foobarbaz").unwrap();
10621047
std::fs::remove_dir_all("/tmp/firecracker_test_dir").unwrap();
10631048
}
10641049

src/jailer/src/main.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ pub enum JailerError {
7373
Dup2(io::Error),
7474
#[error("Failed to exec into Firecracker: {0}")]
7575
Exec(io::Error),
76-
#[error(
77-
"Invalid filename. The filename of `--exec-file` option must contain \"firecracker\": {0}"
78-
)]
79-
ExecFileName(String),
8076
#[error("{}", format!("Failed to extract filename from path {:?}", .0).replace('\"', ""))]
8177
ExtractFileName(PathBuf),
8278
#[error("{}", format!("Failed to open file {:?}: {}", .0, .1).replace('\"', ""))]

tests/integration_tests/security/test_jail.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,6 @@ def test_exec_file_not_exist(uvm_plain, tmp_path):
106106
):
107107
test_microvm.spawn()
108108

109-
# Error case 3: Filename without "firecracker"
110-
pseudo_exec_file_path = tmp_path / "foobarbaz"
111-
pseudo_exec_file_path.touch()
112-
fc_dir = Path("/srv/jailer") / pseudo_exec_file_path.name / test_microvm.id
113-
fc_dir.mkdir(parents=True, exist_ok=True)
114-
test_microvm.jailer.exec_file = pseudo_exec_file_path
115-
116-
with pytest.raises(
117-
Exception,
118-
match=r"Jailer error: Invalid filename. The filename of `--exec-file` option"
119-
r' must contain "firecracker": foobarbaz',
120-
):
121-
test_microvm.spawn()
122-
123109

124110
def test_default_chroot_hierarchy(uvm_plain):
125111
"""

0 commit comments

Comments
 (0)