Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percent Encoding Test & Spec Enhancements #803

Merged
merged 2 commits into from
May 17, 2021

Conversation

rcoh
Copy link
Contributor

@rcoh rcoh commented May 16, 2021

Description of changes:
Two separate commits that increase coverage of percent encoding tests:

  1. The current test actually admits buggy behavior where neither greedy nor non-greedy labels are escaped, a bug I know
    impacts at least 1 SDK. This updates the test to include / in the non-greedy label to ensure that it is, in fact, escaped.

  2. Add test for httpLabel/httpQuery escaping.
    Smithy recently amended the HTTP label spec to clarify the set of characters that must be escaped. But, due to
    a peculiarity of the spec, it Smithy omitted the % character from this set which definitely needs to be escaped.

    This diff updates the spec and adds exhaustive test cases for both. These tests have been run on and pass the Rust SDK protocol test suite. (They also went the other way, I had 2 bugs caused by copy-paste errors converting the Smithy set to the percent encoding set used by the Rust SDK).

    Exhaustive tests are important here, because I suspect other SDKs may have similar copy-paste errors, furthermore, several of these characters, namely: :()!, may not be escaped by a "out of the box" percent encoder but these are known to cause problems when sent to AWS services.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

rcoh added 2 commits May 16, 2021 11:00
The current test actually admits buggy behavior where neither greedy nor non-greedy labels are escaped, a bug I know
impacts at least 1 SDK. This updates the test to include `/` in the non-greedy label.
Smithy recently amended the HTTP label spec to clarify the set of characters that must be escaped. But, due to
a peculiarty of the spec, it Smithy ommitted the `%` character from this set which definitely needs to be escaped.

This diff updates the spec and adds exhaustive test cases for both. These tests have been run on and pass the Rust SDK protocol
test suite. (They also went the other way, I had 2 bugs caused by copy-paste errors converting the Smithy set to the percent
encoding set used by the Rust SDK).

Exhaustive tests are important here, because I suspect other SDKs may have similar copy-paste errors, furthermore, several
of these characters, namely: `:()!,` may not be escaped by a "out of the box" protocol coder but these are known to cause
problems when sent to AWS services.
@mtdowling mtdowling merged commit 7ec2b66 into smithy-lang:main May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants