diff --git a/Cargo.lock b/Cargo.lock index 6da1363af..0732d3dfb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,9 +210,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "aws-config" -version = "0.57.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2bf00cb9416daab4ce4927c54ebe63c08b9caf4d7b9314b6d7a4a2c5a1afb09" +checksum = "8e245d7c741a8e4b23133f36750c4bcb3938a66ac49510caaf8b83afd52db1ec" dependencies = [ "aws-credential-types", "aws-http", @@ -241,9 +241,9 @@ dependencies = [ [[package]] name = "aws-credential-types" -version = "0.57.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9073c88dbf12f68ce7d0e149f989627a1d1ae3d2b680459f04ccc29d1cbd0f" +checksum = "e6dec6f3d42983be70a113f999476185e124884f43f4d60129c7157aede7bda1" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -253,11 +253,10 @@ dependencies = [ [[package]] name = "aws-http" -version = "0.57.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24067106d09620cf02d088166cdaedeaca7146d4d499c41b37accecbea11b246" +checksum = "361c4310fdce94328cc2d1ca0c8a48c13f43009c61d3367585685a50ca8c66b6" dependencies = [ - "aws-smithy-http", "aws-smithy-runtime-api", "aws-smithy-types", "aws-types", @@ -270,9 +269,9 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "0.57.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6ee0152c06d073602236a4e94a8c52a327d310c1ecd596570ce795af8777ff" +checksum = "36ba3ad97d674bfaeed684d528a07cee6e81cbf16e6d6c7e272a130b5e71e6b9" dependencies = [ "aws-credential-types", "aws-http", @@ -292,9 +291,9 @@ dependencies = [ [[package]] name = "aws-sdk-cloudfront" -version = "0.36.0" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3037ac132348f67dc7e81c5ff3940c0f2265db5ed08e573ccec2b26881c83c1" +checksum = "9e78d51555b3970a4d1f2d47d44e5ba68e05a314e8c1785653e612b72bde93a3" dependencies = [ "aws-credential-types", "aws-http", @@ -314,9 +313,9 @@ dependencies = [ [[package]] name = "aws-sdk-s3" -version = "0.36.0" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf188e8af89adb0b41ae2f21b6c666c618959e40242e79aaa43fafa9c0c90a8a" +checksum = "29223b1074621f1d011bac836d995c002936663052b1e7ad02927551b17d6625" dependencies = [ "aws-credential-types", "aws-http", @@ -344,9 +343,9 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "0.36.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb8158015232b4596ccef74a205600398e152d704b40b7ec9f486092474d7fa" +checksum = "5786afe1fd164e53f108b2bd4982a31c5a821dc1677d05a12de65ebcc6ede52a" dependencies = [ "aws-credential-types", "aws-http", @@ -366,9 +365,9 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "0.36.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36a1493e1c57f173e53621935bfb5b6217376168dbdb4cd459aebcf645924a48" +checksum = "31569ac7750ebc3097058c1e72d79576e16b3fb262aa0d6510188bff623f9804" dependencies = [ "aws-credential-types", "aws-http", @@ -388,9 +387,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "0.36.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e032b77f5cd1dd3669d777a38ac08cbf8ec68e29460d4ef5d3e50cffa74ec75a" +checksum = "9b1d955bacd8c3637908a40a4af2f7a732461ee7d95ec02599a3610ee55781d7" dependencies = [ "aws-credential-types", "aws-http", @@ -411,26 +410,28 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "0.57.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f81a6abc4daab06b53cabf27c54189928893283093e37164ca53aa47488a5b" +checksum = "b4d07e2f2fc32acb7423d054ec8ba2b361dafc95fabc5a211baf4a566571d20e" dependencies = [ "aws-credential-types", "aws-smithy-eventstream", "aws-smithy-http", "aws-smithy-runtime-api", + "aws-smithy-types", "bytes", + "crypto-bigint 0.5.5", "form_urlencoded", "hex", "hmac", "http", - "num-bigint", "once_cell", "p256", "percent-encoding", "regex", "ring", "sha2", + "subtle", "time", "tracing", "zeroize", @@ -438,9 +439,9 @@ dependencies = [ [[package]] name = "aws-smithy-async" -version = "0.57.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe53fccd3b10414b9cae63767a15a2789b34e6c6727b6e32b33e8c7998a3e80" +checksum = "1fbfa248f7f966d73e325dbc85851a5500042b6d96e3c3b535a8527707f36fe4" dependencies = [ "futures-util", "pin-project-lite", @@ -449,9 +450,9 @@ dependencies = [ [[package]] name = "aws-smithy-checksums" -version = "0.57.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb5701fbfb40600cc0fa547f318552dfd4e632b2099bd75d95fb0faae70675d" +checksum = "c5a373ec01aede3dd066ec018c1bc4e8f5dd11b2c11c59c8eef1a5c68101f397" dependencies = [ "aws-smithy-http", "aws-smithy-types", @@ -470,9 +471,9 @@ dependencies = [ [[package]] name = "aws-smithy-eventstream" -version = "0.57.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b33fa99f928a5815b94ee07e1377901bcf51aa749034a2c802dc38f9dcfacf5" +checksum = "1c669e1e5fc0d79561bf7a122b118bd50c898758354fe2c53eb8f2d31507cbc3" dependencies = [ "aws-smithy-types", "bytes", @@ -481,9 +482,9 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.57.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7972373213d1d6e619c0edc9dda2d6634154e4ed75c5e0b2bf065cd5ec9f0d1" +checksum = "5b1de8aee22f67de467b2e3d0dd0fb30859dc53f579a63bd5381766b987db644" dependencies = [ "aws-smithy-eventstream", "aws-smithy-runtime-api", @@ -502,18 +503,18 @@ dependencies = [ [[package]] name = "aws-smithy-json" -version = "0.57.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d64d5af16dd585de9ff6c606423c1aaad47c6baa38de41c2beb32ef21c6645" +checksum = "6a46dd338dc9576d6a6a5b5a19bd678dcad018ececee11cf28ecd7588bd1a55c" dependencies = [ "aws-smithy-types", ] [[package]] name = "aws-smithy-protocol-test" -version = "0.57.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26f2e88fc47108b787e2a5419adc22436db606557613e0bb02836d38e83c19bb" +checksum = "c3ad76ca454230a5540a47e44ba903a910ae09f2c39a86cd249f2f8c87da83eb" dependencies = [ "assert-json-diff 1.1.0", "aws-smithy-runtime-api", @@ -527,9 +528,9 @@ dependencies = [ [[package]] name = "aws-smithy-query" -version = "0.57.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7527bf5335154ba1b285479c50b630e44e93d1b4a759eaceb8d0bf9fbc82caa5" +checksum = "feb5b8c7a86d4b6399169670723b7e6f21a39fc833a30f5c5a2f997608178129" dependencies = [ "aws-smithy-types", "urlencoding", @@ -537,9 +538,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "0.57.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "839b363adf3b2bdab2742a1f540fec23039ea8bc9ec0f9f61df48470cfe5527b" +checksum = "064b808143d80b50744b1b22cce801238a545b84859c6cf8e275997252dd1d25" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -565,9 +566,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime-api" -version = "0.57.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f24ecc446e62c3924539e7c18dec8038dba4fdf8718d5c2de62f9d2fecca8ba9" +checksum = "4d27c3235d4972ed976b5c1a82286e7c4457f618f3c2ae6d4ae44f081dd24575" dependencies = [ "aws-smithy-async", "aws-smithy-types", @@ -581,9 +582,9 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "0.57.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051de910296522a21178a2ea402ea59027eef4b63f1cef04a0be2bb5e25dea03" +checksum = "d2fc32035dc0636a8583cf0c6dd7f1e6d5404103b836d26228b8730907a88d9f" dependencies = [ "base64-simd", "bytes", @@ -604,9 +605,9 @@ dependencies = [ [[package]] name = "aws-smithy-types-convert" -version = "0.57.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4b443daf8de62bb452e431a65d70c20e5c10d99e000cb9ee154b9f8b1b62128" +checksum = "f4e161aa33a99e36ed942974d02a73f08dc5f312f62ad7996d11e5f3e9c0251d" dependencies = [ "aws-smithy-types", "chrono", @@ -614,18 +615,18 @@ dependencies = [ [[package]] name = "aws-smithy-xml" -version = "0.57.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb1e3ac22c652662096c8e37a6f9af80c6f3520cab5610b2fe76c725bce18eac" +checksum = "0ec40d74a67fd395bc3f6b4ccbdf1543672622d905ef3f979689aea5b730cb95" dependencies = [ "xmlparser", ] [[package]] name = "aws-types" -version = "0.57.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048bbf1c24cdf4eb1efcdc243388a93a90ebf63979e25fc1c7b8cbd9cb6beb38" +checksum = "b18c0eb301cce69298555c4884795497c67b3bd511aa3f07470382f4bf3ef043" dependencies = [ "aws-credential-types", "aws-smithy-async", @@ -1296,6 +1297,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1680,7 +1691,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", - "crypto-bigint", + "crypto-bigint 0.4.9", "der 0.6.1", "digest", "ff", @@ -3766,17 +3777,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-bigint" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-bigint-dig" version = "0.8.4" @@ -4743,7 +4743,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ - "crypto-bigint", + "crypto-bigint 0.4.9", "hmac", "zeroize", ] diff --git a/Cargo.toml b/Cargo.toml index ad491cf75..6f006435b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,10 +75,10 @@ hex = "0.4.3" # Async tokio = { version = "1.0", features = ["rt-multi-thread", "signal", "macros"] } futures-util = "0.3.5" -aws-config = "0.57.1" -aws-sdk-s3 = "0.36.0" -aws-sdk-cloudfront = "0.36.0" -aws-smithy-types-convert = { version = "0.57.1", features = ["convert-chrono"] } +aws-config = "1.0.0" +aws-sdk-s3 = "0.39.1" +aws-sdk-cloudfront = "0.39.1" +aws-smithy-types-convert = { version = "0.60.0", features = ["convert-chrono"] } http = "0.2.6" uuid = "1.1.2" @@ -124,9 +124,9 @@ kuchikiki = "0.8" rand = "0.8" mockito = "1.0.2" test-case = "3.0.0" -aws-smithy-types = "0.57.1" -aws-smithy-runtime = {version = "0.57.1", features = ["client", "test-util"]} -aws-smithy-http = "0.57.1" +aws-smithy-types = "1.0.1" +aws-smithy-runtime = {version = "1.0.1", features = ["client", "test-util"]} +aws-smithy-http = "0.60.0" indoc = "2.0.0" [profile.dev.package.sqlx-macros] diff --git a/src/cdn.rs b/src/cdn.rs index 445a68081..7a12d41d7 100644 --- a/src/cdn.rs +++ b/src/cdn.rs @@ -1,5 +1,6 @@ use crate::{metrics::duration_to_seconds, utils::report_error, Config, InstanceMetrics}; use anyhow::{anyhow, bail, Context, Error, Result}; +use aws_config::BehaviorVersion; use aws_sdk_cloudfront::{ config::{retry::RetryConfig, Region}, error::SdkError, @@ -54,7 +55,8 @@ impl CdnBackend { pub fn new(config: &Arc, runtime: &Arc) -> CdnBackend { match config.cdn_backend { CdnKind::CloudFront => { - let shared_config = runtime.block_on(aws_config::load_from_env()); + let shared_config = + runtime.block_on(aws_config::load_defaults(BehaviorVersion::latest())); let config_builder = aws_sdk_cloudfront::config::Builder::from(&shared_config) .retry_config( RetryConfig::standard().with_max_attempts(config.aws_sdk_max_retries), @@ -220,7 +222,7 @@ impl CdnBackend { { Ok(response) => response, Err(SdkError::ServiceError(err)) => { - if err.raw().status() == http::StatusCode::NOT_FOUND { + if err.raw().status().as_u16() == http::StatusCode::NOT_FOUND.as_u16() { return Ok(None); } else { return Err(err.into_err().into()); @@ -938,7 +940,7 @@ mod tests { } async fn get_mock_config(http_client: StaticReplayClient) -> aws_sdk_cloudfront::Config { - let cfg = aws_config::from_env() + let cfg = aws_config::defaults(BehaviorVersion::latest()) .region(Region::new("eu-central-1")) .credentials_provider(Credentials::new( "accesskey", diff --git a/src/storage/s3.rs b/src/storage/s3.rs index 51e49d6e3..b2d93800b 100644 --- a/src/storage/s3.rs +++ b/src/storage/s3.rs @@ -1,6 +1,7 @@ use super::{Blob, FileRange}; use crate::{Config, InstanceMetrics}; use anyhow::{Context as _, Error}; +use aws_config::BehaviorVersion; use aws_sdk_s3::{ config::{retry::RetryConfig, Region}, error::SdkError, @@ -30,7 +31,7 @@ pub(super) struct S3Backend { impl S3Backend { pub(super) async fn new(metrics: Arc, config: &Config) -> Result { - let shared_config = aws_config::load_from_env().await; + let shared_config = aws_config::load_defaults(BehaviorVersion::latest()).await; let mut config_builder = aws_sdk_s3::config::Builder::from(&shared_config) .retry_config(RetryConfig::standard().with_max_attempts(config.aws_sdk_max_retries)) .region(Region::new(config.s3_region.clone())); @@ -78,7 +79,7 @@ impl S3Backend { Ok(_) => Ok(true), Err(SdkError::ServiceError(err)) if (matches!(err.err(), HeadObjectError::NotFound(_)) - || err.raw().status() == http::StatusCode::NOT_FOUND) => + || err.raw().status().as_u16() == http::StatusCode::NOT_FOUND.as_u16()) => { Ok(false) } @@ -101,7 +102,7 @@ impl S3Backend { .filter(|tag| tag.key() == PUBLIC_ACCESS_TAG) .any(|tag| tag.value() == PUBLIC_ACCESS_VALUE)), Err(SdkError::ServiceError(err)) => { - if err.raw().status() == http::StatusCode::NOT_FOUND { + if err.raw().status().as_u16() == http::StatusCode::NOT_FOUND.as_u16() { Err(super::PathNotFoundError.into()) } else { Err(err.into_err().into()) @@ -139,7 +140,7 @@ impl S3Backend { { Ok(_) => Ok(()), Err(SdkError::ServiceError(err)) => { - if err.raw().status() == http::StatusCode::NOT_FOUND { + if err.raw().status().as_u16() == http::StatusCode::NOT_FOUND.as_u16() { Err(super::PathNotFoundError.into()) } else { Err(err.into_err().into()) @@ -165,7 +166,7 @@ impl S3Backend { .map_err(|err| match err { SdkError::ServiceError(err) if (matches!(err.err(), GetObjectError::NoSuchKey(_)) - || err.raw().status() == http::StatusCode::NOT_FOUND) => + || err.raw().status().as_u16() == http::StatusCode::NOT_FOUND.as_u16()) => { super::PathNotFoundError.into() } @@ -174,7 +175,11 @@ impl S3Backend { .await?; let mut content = crate::utils::sized_buffer::SizedBuffer::new(max_size); - content.reserve(res.content_length.try_into().ok().unwrap_or(0)); + content.reserve( + res.content_length + .and_then(|length| length.try_into().ok()) + .unwrap_or(0), + ); let mut body = res.body; @@ -253,7 +258,7 @@ impl S3Backend { .send() .await?; - if list.key_count() > 0 { + if list.key_count().unwrap_or(0) > 0 { let to_delete = Delete::builder() .set_objects(Some( list.contents