Description
reqsign-core::SigningRequest currently parses the request URI query with form_urlencoded::parse in SigningRequest::build, stores decoded query pairs, and rebuilds the URI query from those pairs in SigningRequest::apply.
This can change the wire representation of query parameters that already existed before signing.
For example, an existing query like:
versionId=a%2Bb%3Dc%2525%26e
can be rebuilt into a raw query like:
The rebuilt URI no longer preserves the original encoded value. In particular, the encoded & inside the value can become a query separator, and + can also become ambiguous for form-style query parsers.
This matters for downstream users such as OpenDAL. In apache/opendal#7888, COS requests need to keep an encoded versionId query parameter after signing.
Fixing this in OpenDAL requires service-local query restoration logic, but the root issue appears to be that reqsign-core does not preserve the raw query representation across SigningRequest::build and SigningRequest::apply.
Review context: apache/opendal#7888 (review)
Expected Behavior
Signing should not rewrite query parameters that already existed in the request URI.
Signers may still parse and canonicalize query parameters for signature calculation. Query-signing implementations may also append authentication query parameters. However, existing raw query parameters should keep their original wire representation unless a signer explicitly updates them.
Scope
This issue is about reqsign-core::SigningRequest, not a COS-specific workaround in OpenDAL.
At least reqsign-tencent-cos is affected because it builds on top of SigningRequest. Other signers using SigningRequest may need to be checked as well.
Description
reqsign-core::SigningRequestcurrently parses the request URI query withform_urlencoded::parseinSigningRequest::build, stores decoded query pairs, and rebuilds the URI query from those pairs inSigningRequest::apply.This can change the wire representation of query parameters that already existed before signing.
For example, an existing query like:
can be rebuilt into a raw query like:
The rebuilt URI no longer preserves the original encoded value. In particular, the encoded
&inside the value can become a query separator, and+can also become ambiguous for form-style query parsers.This matters for downstream users such as OpenDAL. In apache/opendal#7888, COS requests need to keep an encoded
versionIdquery parameter after signing.Fixing this in OpenDAL requires service-local query restoration logic, but the root issue appears to be that
reqsign-coredoes not preserve the raw query representation acrossSigningRequest::buildandSigningRequest::apply.Review context: apache/opendal#7888 (review)
Expected Behavior
Signing should not rewrite query parameters that already existed in the request URI.
Signers may still parse and canonicalize query parameters for signature calculation. Query-signing implementations may also append authentication query parameters. However, existing raw query parameters should keep their original wire representation unless a signer explicitly updates them.
Scope
This issue is about
reqsign-core::SigningRequest, not a COS-specific workaround in OpenDAL.At least
reqsign-tencent-cosis affected because it builds on top ofSigningRequest. Other signers usingSigningRequestmay need to be checked as well.