Skip to content

Commit 3ef75af

Browse files
authored
fix sigv4 canonical request order and revamp test suite (#4237)
## Description Started as an investigation of #4227. I found that we 1. weren't utilizing most of our test suite (we only used 4 of the test directories from the v4 suite) and 2. that we had a bug in our canonical request implementation where we sort the query keys before encoding instead of after (see https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-create-signed-request.html#create-canonical-request and the `get-vanilla-query-order-encoded` test). This PR does a few things: 1. Imported the CRT test suite and removed the old ones. * The previous test suite we were using is the older format that was in use and floating around before CRT updated it. The newer version of this has standardized the file format and includes both header and query versions of each test. * We were already using this format for the sigv4a tests so now all of our tests for v4 and v4a use the same format. It also has a few additional tests we didn't have. * Using the same format as CRT (and Kotlin) will make it easier to update the test suite or add new tests 3. Updates the test utils to be common across v4 and v4a. 4. Added new test cases we weren't running for both v4 and v4a. Also every test now generally tests both headers and query signature locations (before we were only testing for headers most of the time). 5. Fixed a bug in canonical request implementation where we sort the query keys before encoding instead of after (found by new test and pointed out by engineer on ARC team as well). 6. Migrated a few tests `double-encode-path` and `double-url-encode` that we used in several places to the newer format (only for headers not query which was missing). 7. Inlined the `iam` related test request where it is used 8. Added a new `insert_encoded` for `QueryWriter` to append an already encoded key/value pair and skip encoding. ## Testing * During the migration I kept both the old and new test suites around. Then removed the old suite after verifying the tests that utilized the same files still passed on the new test suite. ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] For changes to the AWS SDK, generated SDK code, or SDK runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "aws-sdk-rust" in the `applies_to` key. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent e478e31 commit 3ef75af

File tree

1,092 files changed

+4303
-2359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,092 files changed

+4303
-2359
lines changed

.changelog/1753460364.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
applies_to:
3+
- aws-sdk-rust
4+
- client
5+
authors:
6+
- aajtodd
7+
references:
8+
- smithy-rs#4227
9+
breaking: false
10+
new_feature: false
11+
bug_fix: true
12+
---
13+
Fix canonical request sort order

aws/rust-runtime/Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/rust-runtime/aws-config/Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/rust-runtime/aws-sigv4/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-sigv4"
3-
version = "1.3.3"
3+
version = "1.3.4"
44
authors = ["AWS Rust SDK Team <[email protected]>", "David Barsky <[email protected]>"]
55
description = "SigV4 signer for HTTP requests and Event Stream messages."
66
edition = "2021"
@@ -43,7 +43,7 @@ aws-credential-types = { path = "../aws-credential-types", features = ["test-uti
4343
aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["client", "test-util"] }
4444
bytes = "1"
4545
hex-literal = "0.4.1"
46-
httparse = "1.8"
46+
httparse = "1.10.1"
4747
pretty_assertions = "1.3"
4848
proptest = "1.2"
4949
serde = "1.0.180"

aws/rust-runtime/aws-sigv4/aws-sig-v4-test-suite/LICENSE

Lines changed: 0 additions & 202 deletions
This file was deleted.

aws/rust-runtime/aws-sigv4/aws-sig-v4-test-suite/NOTICE

Lines changed: 0 additions & 2 deletions
This file was deleted.

aws/rust-runtime/aws-sigv4/aws-sig-v4-test-suite/README.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

aws/rust-runtime/aws-sigv4/aws-sig-v4-test-suite/double-url-encode/double-url-encode.authz

Lines changed: 0 additions & 1 deletion
This file was deleted.

aws/rust-runtime/aws-sigv4/aws-sig-v4-test-suite/get-header-key-duplicate/get-header-key-duplicate.authz

Lines changed: 0 additions & 1 deletion
This file was deleted.

aws/rust-runtime/aws-sigv4/aws-sig-v4-test-suite/get-header-key-duplicate/get-header-key-duplicate.req

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)