AWS sigv4: refactor and URL encode username#21923
Conversation
Verify with test 3222 Reported-by: Trail of Bits
There was a problem hiding this comment.
Pull request overview
This PR refactors the AWS SigV4 HTTP auth implementation and addresses header-injection risk by URL-encoding the SigV4 username used in the Credential= field.
Changes:
- Refactor
Curl_output_aws_sigv4()into smaller helper functions for parameter parsing, payload hashing, timestamp generation, canonical request creation, and signing. - URL-escape the SigV4 username before inserting it into the
Authorization:header. - Add a new regression test covering CRLF in the username and wire it into the test list.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lib/http_aws_sigv4.c |
Refactors SigV4 generation flow and URL-encodes the username used in the Authorization header. |
tests/data/test3222 |
Adds a regression test ensuring CRLF in username is encoded in SigV4 Credential=. |
tests/data/Makefile.am |
Registers the new test case. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This reverts commit 1f7e136.
|
augment review |
🤖 Augment PR SummarySummary: Refactors the HTTP AWS SigV4 authentication implementation and hardens how the access key (username) is emitted in the generated Authorization header. Changes:
Technical Notes: The change is primarily a refactor plus a safety hardening: encoding the credential field prevents header injection if a username contains CR/LF, and the new test asserts the encoded output. 🤖 Was this summary useful? React with 👍 or 👎 |
No description provided.