Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
curl.35713
curl-aws_sigv4-canonicalise-valueless-query-par...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File curl-aws_sigv4-canonicalise-valueless-query-params.patch of Package curl.35713
From bbba69dada71ffa07e2949e3c6a76700f846520b Mon Sep 17 00:00:00 2001 From: Harry Mallon <hjmallon@gmail.com> Date: Wed, 1 Nov 2023 14:46:46 +0000 Subject: [PATCH] http_aws_sigv4: canonicalise valueless query params Fixes #8107 Closes #12244 --- lib/http_aws_sigv4.c | 11 ++++++++++- tests/data/test439 | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) --- curl-8.0.1.orig/lib/http_aws_sigv4.c +++ curl-8.0.1/lib/http_aws_sigv4.c @@ -423,6 +423,7 @@ static CURLcode canon_query(struct Curl_ for(i = 0; !result && (i < entry); i++, ap++) { size_t len; const char *q = ap->p; + bool found_equals = false; if(!ap->len) continue; for(len = ap->len; len && !result; q++, len--) { @@ -434,9 +435,13 @@ static CURLcode canon_query(struct Curl_ case '.': case '_': case '~': + /* allowed as-is */ + result = Curl_dyn_addn(dq, q, 1); + break; case '=': /* allowed as-is */ result = Curl_dyn_addn(dq, q, 1); + found_equals = true; break; case '%': /* uppercase the following if hexadecimal */ @@ -464,7 +469,11 @@ static CURLcode canon_query(struct Curl_ } } } - if(i < entry - 1) { + if(!result && !found_equals) { + /* queries without value still need an equals */ + result = Curl_dyn_addn(dq, "=", 1); + } + if(!result && i < entry - 1) { /* insert ampersands between query pairs */ result = Curl_dyn_addn(dq, "&", 1); } --- curl-8.0.1.orig/tests/data/test439 +++ curl-8.0.1/tests/data/test439 @@ -38,7 +38,7 @@ debug aws-sigv4 with query </name> <command> -"http://fake.fake.fake:8000/%TESTNUMBER/?name=me%&aim=b%aad&&&weirdo=*.//-" -u user:secret --aws-sigv4 "aws:amz:us-east-2:es" --connect-to fake.fake.fake:8000:%HOSTIP:%HTTPPORT +"http://fake.fake.fake:8000/%TESTNUMBER/?name=me%&noval&aim=b%aad&&&weirdo=*.//-" -u user:secret --aws-sigv4 "aws:amz:us-east-2:es" --connect-to fake.fake.fake:8000:%HOSTIP:%HTTPPORT </command> </client> @@ -46,9 +46,9 @@ aws-sigv4 with query # Verify data after the test has been "shot" <verify> <protocol crlf="yes"> -GET /%TESTNUMBER/?name=me%&aim=b%aad&&&weirdo=*.//- HTTP/1.1 +GET /439/?name=me%&noval&aim=b%aad&&&weirdo=*.//- HTTP/1.1 Host: fake.fake.fake:8000 -Authorization: AWS4-HMAC-SHA256 Credential=user/19700101/us-east-2/es/aws4_request, SignedHeaders=host;x-amz-date, Signature=88884e3b3142133685b2092d29d8b522b785b1a9ec9e4a90cbea83e882f8dcb6 +Authorization: AWS4-HMAC-SHA256 Credential=user/19700101/us-east-2/es/aws4_request, SignedHeaders=host;x-amz-date, Signature=cbbf4a72764e27e396730f5e56cea046d4ce862a2d91db4856fb086b92f49270 X-Amz-Date: 19700101T000000Z User-Agent: curl/%VERSION Accept: */*
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor