Skip to content

Commit

Permalink
test: traversal attack
Browse files Browse the repository at this point in the history
  • Loading branch information
LeSim committed Jul 3, 2023
1 parent 29c399d commit 20d49ed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/fixtures/server-static/uploads/out_of_jail.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fail
1 change: 1 addition & 0 deletions tests/helpers/curl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub fn curl_get_status(url: &str) -> String {
let stdout = Command::new("curl")
.arg("-XGET")
.arg(url)
.arg("--path-as-is")
.arg("-o")
.arg("/dev/null")
.arg("-s")
Expand Down
14 changes: 14 additions & 0 deletions tests/traversal_attack.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use serial_test::serial;

mod helpers;
pub use helpers::*;

#[test]
#[serial(servers)]
fn traversal_attack_is_avoided() {
let _proxy_and_node = ProxyAndNode::start();

let curl_download = curl_get_status("localhost:4444/upstream/../../out_of_jail.txt");
println!("curl_download: {:?}", curl_download);
assert_eq!(curl_download, "404");
}

0 comments on commit 20d49ed

Please sign in to comment.