You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Maksim Hadalau (Jira)" <ji...@apache.org> on 2024/03/18 18:57:00 UTC

[jira] [Updated] (JCLOUDS-1631) AWS S3, sign for authorization header failed if query part contains special chars

     [ https://issues.apache.org/jira/browse/JCLOUDS-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maksim Hadalau updated JCLOUDS-1631:
------------------------------------
    Description: 
Problem description:
Can not list blobs for aws-s3 provider if prefix contains special chars %/&

Steps to reproduce:
try to list blobs with following prefix: 
"Folder (`~!@#$%^&*-_+[]'|<>.?) Name/"

Actual behavior: 
Error: URLDecoder: Incomplete trailing escape (%) pattern

Expected behavior:
provided prefix must be listed

Problem location:

`AWSRequestAuthorizeSignatureV4.signForAuthorizationHeader()`

 
Multimap<String, String> queryMap = queryParser().apply(request.getEndpoint().getQuery());

request.getEndpoint().getQuery() - returns a decoded query string
however queryParser() require encoded one

Fix:
Multimap<String, String> queryMap = queryParser().apply(request.getEndpoint().getRawQuery());

When jclouds generates a request to the AWS it encodes prefix (encoding all special chars in it, including % and &), however calling `getQuery()` returns decoded version of query string which lead to unpredictable behavior. 

P.S. required patch in 2.5.x if possible

PR https://github.com/apache/jclouds/pull/200

  was:
Problem description:
Can not list blobs for aws-s3 provider if prefix contains special chars %/&

Steps to reproduce:
try to list blobs with following prefix: 
"Folder (`~!@#$%^&*-_+[]'|<>.?) Name/"

Actual behavior: 
Error: URLDecoder: Incomplete trailing escape (%) pattern

Expected behavior:
provided prefix must be listed

Problem location:

`AWSRequestAuthorizeSignatureV4.signForAuthorizationHeader()`

 
Multimap<String, String> queryMap = queryParser().apply(request.getEndpoint().getQuery());

request.getEndpoint().getQuery() - returns a decoded query string
however queryParser() require encoded one

Fix:
Multimap<String, String> queryMap = queryParser().apply(request.getEndpoint().getRawQuery());

When jclouds generates a request to the AWS it encodes prefix (encoding all special chars in it, including % and &), however calling `getQuery()` returns decoded version of query string which lead to unpredictable behavior. 

P.S. required patch in 2.5.x if possible


> AWS S3, sign for authorization header failed if query part contains special chars
> ---------------------------------------------------------------------------------
>
>                 Key: JCLOUDS-1631
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1631
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-blobstore
>    Affects Versions: 2.5.0
>            Reporter: Maksim Hadalau
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Problem description:
> Can not list blobs for aws-s3 provider if prefix contains special chars %/&
> Steps to reproduce:
> try to list blobs with following prefix: 
> "Folder (`~!@#$%^&*-_+[]'|<>.?) Name/"
> Actual behavior: 
> Error: URLDecoder: Incomplete trailing escape (%) pattern
> Expected behavior:
> provided prefix must be listed
> Problem location:
> `AWSRequestAuthorizeSignatureV4.signForAuthorizationHeader()`
>  
> Multimap<String, String> queryMap = queryParser().apply(request.getEndpoint().getQuery());
> request.getEndpoint().getQuery() - returns a decoded query string
> however queryParser() require encoded one
> Fix:
> Multimap<String, String> queryMap = queryParser().apply(request.getEndpoint().getRawQuery());
> When jclouds generates a request to the AWS it encodes prefix (encoding all special chars in it, including % and &), however calling `getQuery()` returns decoded version of query string which lead to unpredictable behavior. 
> P.S. required patch in 2.5.x if possible
> PR https://github.com/apache/jclouds/pull/200



--
This message was sent by Atlassian Jira
(v8.20.10#820010)