From e849df2ef495c391a37f8f722a523fc86a62d9f0 Mon Sep 17 00:00:00 2001 From: asonix Date: Tue, 17 Mar 2020 19:02:33 -0500 Subject: [PATCH] Don't use created field when sending requests, masto is poopoo --- Cargo.lock | 35 +++++++++++++---------------------- Cargo.toml | 2 +- src/requests.rs | 10 ++++++---- 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66d05fb..023ca92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -550,7 +550,7 @@ dependencies = [ "block-padding", "byte-tools", "byteorder", - "generic-array 0.12.3", + "generic-array", ] [[package]] @@ -709,7 +709,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" dependencies = [ - "generic-array 0.12.3", + "generic-array", "subtle 1.0.0", ] @@ -730,7 +730,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array 0.12.3", + "generic-array", ] [[package]] @@ -968,15 +968,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "generic-array" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed1e761351b56f54eb9dcd0cfaca9fd0daecf93918e1cfc01c8a3d26ee7adcd" -dependencies = [ - "typenum", -] - [[package]] name = "getrandom" version = "0.1.14" @@ -1069,9 +1060,9 @@ dependencies = [ [[package]] name = "http-signature-normalization" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2db9cb1c64aaabb27523433fc8df0467670df81642fd770086cf8a2eb11b24a" +checksum = "6f09843aded69175105d933d8d47920b61b123c92bdf38eb8d71162414a040e6" dependencies = [ "chrono", "thiserror", @@ -1079,14 +1070,15 @@ dependencies = [ [[package]] name = "http-signature-normalization-actix" -version = "0.3.0-alpha.4" +version = "0.3.0-alpha.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93de73e7120cd0109107dd2594cba35f19841c75b09696db495554756d55727e" +checksum = "2ef97fd4d560efcc886defdd46b44ac9dbaa6000c467bf0a6a63592a5373a468" dependencies = [ "actix-http", "actix-web", "base64 0.11.0", "bytes", + "chrono", "futures", "http-signature-normalization", "log", @@ -1192,9 +1184,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" +checksum = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" [[package]] name = "libm" @@ -1511,15 +1503,14 @@ checksum = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" [[package]] name = "postgres-protocol" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a30f0e172ae0fb0653dbf777ad10a74b8e58d6de95a892f2e1d3e94a9df9a844" +checksum = "3f611afe4d1407ebe7f3ced1ffc66f730fac1b1c13085e230a8cdcb921e97710" dependencies = [ - "base64 0.11.0", + "base64 0.12.0", "byteorder", "bytes", "fallible-iterator", - "generic-array 0.13.2", "hmac", "md5", "memchr", diff --git a/Cargo.toml b/Cargo.toml index ff118e7..802ecb6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ base64 = "0.12" bb8-postgres = "0.4.0" dotenv = "0.15.0" futures = "0.3.4" -http-signature-normalization-actix = { version = "0.3.0-alpha.4", default-features = false, features = ["sha-2"] } +http-signature-normalization-actix = { version = "0.3.0-alpha.5", default-features = false, features = ["sha-2"] } log = "0.4" lru = "0.4.3" pretty_env_logger = "0.4.0" diff --git a/src/requests.rs b/src/requests.rs index c5ed805..9d15d3d 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -23,9 +23,11 @@ pub async fn fetch_actor( let mut res = client .get(actor_id.as_str()) .header("Accept", "application/activity+json") - .signature(&Config::default(), key_id, |signing_string| { - state.sign(signing_string) - })? + .signature( + &Config::default().dont_use_created_field(), + key_id, + |signing_string| state.sign(signing_string), + )? .send() .await .map_err(|e| { @@ -102,7 +104,7 @@ where .header("Content-Type", "application/activity+json") .header("User-Agent", "Aode Relay v0.1.0") .signature_with_digest( - &Config::default(), + &Config::default().dont_use_created_field(), &key_id, &mut digest, item_string,