From 3669a0097da15918ef6bd4feac58ee7ef1163afe Mon Sep 17 00:00:00 2001 From: Ana Gelez Date: Sun, 4 Aug 2019 12:37:38 +0200 Subject: [PATCH] Update rocket_csrf and re-enable it Thank you @fdb-hiroshima for the fix! --- Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- src/main.rs | 14 +++++--------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 463da0f8..9cbaf914 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1898,7 +1898,7 @@ dependencies = [ "plume-models 0.3.0", "rocket 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rocket_contrib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket_csrf 0.1.0 (git+https://github.com/fdb-hiroshima/rocket_csrf?rev=4a72ea2ec716cb0b26188fb00bccf2ef7d1e031c)", + "rocket_csrf 0.1.0 (git+https://github.com/Plume-org/rocket_csrf?rev=89ecb380266234f858c651354216bf5bf3cc09b2)", "rocket_i18n 0.4.0 (git+https://github.com/Plume-org/rocket_i18n?rev=e922afa7c366038b3433278c03b1456b346074f2)", "rpassword 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "rsass 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2438,7 +2438,7 @@ dependencies = [ [[package]] name = "rocket_csrf" version = "0.1.0" -source = "git+https://github.com/fdb-hiroshima/rocket_csrf?rev=4a72ea2ec716cb0b26188fb00bccf2ef7d1e031c#4a72ea2ec716cb0b26188fb00bccf2ef7d1e031c" +source = "git+https://github.com/Plume-org/rocket_csrf?rev=89ecb380266234f858c651354216bf5bf3cc09b2#89ecb380266234f858c651354216bf5bf3cc09b2" dependencies = [ "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3765,7 +3765,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rocket 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "55b83fcf219c8b4980220231d5dd9eae167bdc63449fdab0a04b6c8b8cd361a8" "checksum rocket_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5549dc59a729fbd0e6f5d5de33ba136340228871633485e4946664d36289ffd7" "checksum rocket_contrib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5af691b5f5c06c3a30213217696681d3d3bdc2f10428fa3ce6bbaeab156b6409" -"checksum rocket_csrf 0.1.0 (git+https://github.com/fdb-hiroshima/rocket_csrf?rev=4a72ea2ec716cb0b26188fb00bccf2ef7d1e031c)" = "" +"checksum rocket_csrf 0.1.0 (git+https://github.com/Plume-org/rocket_csrf?rev=89ecb380266234f858c651354216bf5bf3cc09b2)" = "" "checksum rocket_http 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "abec045da00893bd4eef6084307a4bec0742278a7635a6a8b943da023202a5f7" "checksum rocket_i18n 0.4.0 (git+https://github.com/Plume-org/rocket_i18n?rev=e922afa7c366038b3433278c03b1456b346074f2)" = "" "checksum rpassword 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c34fa7bcae7fca3c8471e8417088bbc3ad9af8066b0ecf4f3c0d98a0d772716e" diff --git a/Cargo.toml b/Cargo.toml index 8a716347..cce0eb56 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,8 +64,8 @@ path = "plume-common" path = "plume-models" [dependencies.rocket_csrf] -git = "https://github.com/fdb-hiroshima/rocket_csrf" -rev = "4a72ea2ec716cb0b26188fb00bccf2ef7d1e031c" +git = "https://github.com/Plume-org/rocket_csrf" +rev = "89ecb380266234f858c651354216bf5bf3cc09b2" [build-dependencies] ructe = "0.6.2" diff --git a/src/main.rs b/src/main.rs index 27e11f0d..d1a5a7e5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -290,7 +290,7 @@ Then try to restart Plume .manage(Arc::new(workpool)) .manage(searcher) .manage(include_i18n!()) - /*.attach( + .attach( CsrfFairingBuilder::new() .set_default_target( "/csrf-violation?target=".to_owned(), @@ -300,22 +300,18 @@ Then try to restart Plume ( "/inbox".to_owned(), "/inbox".to_owned(), - rocket::http::Method::Post, + Some(rocket::http::Method::Post), ), ( "/@//inbox".to_owned(), "/@//inbox".to_owned(), - rocket::http::Method::Post, - ), - ( - "/api/".to_owned(), - "/api/".to_owned(), - rocket::http::Method::Post, + Some(rocket::http::Method::Post), ), + ("/api/".to_owned(), "/api/".to_owned(), None), ]) .finalize() .expect("main: csrf fairing creation error"), - )*/; + ); #[cfg(feature = "test")] let rocket = rocket.mount("/test", routes![test_routes::health,]);