Skip to content

Conversation

@raboof
Copy link
Contributor

@raboof raboof commented Mar 11, 2020

This makes sure 'strict' parsing of the Uri query string only allows characters that are actually allowed here by the RFC.

It does not change the fact that Uri's rawQueryString is the percent-encoded representation of the query string, since this information is needed to parse it into a key-value structure.

When parsing the Uri in 'relaxed' mode or constructing programmatically, we do accept characters that are not allowed, but percent-encode any would-be invalid characters.

API's that can be used to programmatically add or modify the query string are adapted to not accept invalid percent-encoded values (e.g. %x2) and convert illegal characters. withRawQueryString is made available both in a 'strict' and a 'relaxed' variation.

References #3002

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed validating PR that is currently being validated by Jenkins labels Mar 11, 2020
@akka-ci
Copy link

akka-ci commented Mar 11, 2020

Test FAILed.

Pull request validation report

Failed Test Suites

Test result for 'akka-http2-support / Pr-validation / ./ executeTests'

[info] ScalaTest
[info] Run completed in 3 minutes, 43 seconds.
[info] Total number of tests run: 131
[info] Suites: completed 10, aborted 0
[info] Tests: succeeded 130, failed 1, canceled 0, ignored 16, pending 27
[info] *** 1 TEST FAILED ***
[error] Failed: Total 131, Failed 1, Errors 0, Passed 130, Ignored 16, Pending 27
[error] Failed tests:
[error] 	akka.http.impl.engine.http2.RequestParsingSpec
Mima Failures
Problems for akka-http-core:
akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.9  (filtered 98)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.7  (filtered 195)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.6  (filtered 195)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.8  (filtered 106)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.11  (filtered 54)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.10  (filtered 54)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")


@akka-ci akka-ci added validating PR that is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR that is currently being validated by Jenkins labels Mar 11, 2020
@akka-ci
Copy link

akka-ci commented Mar 11, 2020

Test FAILed.

Pull request validation report

Mima Failures
Problems for akka-http-core:
akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.9  (filtered 98)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.7  (filtered 195)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.6  (filtered 195)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.8  (filtered 106)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.11  (filtered 54)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 2 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.10  (filtered 54)
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")


Copy link
Contributor

@ignasi35 ignasi35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@raboof
Copy link
Contributor Author

raboof commented Mar 12, 2020

(I'm confused why Jenkins is reporting mima failures, AFAICS those should be filtered out now..)

Copy link
Contributor

@jrudolph jrudolph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. Thanks for digging into this rabbit hole. A few small things below

uri.withQuery(Query(Map("param1" -> "value1"))) shouldEqual Uri("http://host/path?param1=value1#fragment")
uri.withRawQueryString("param1=value1") shouldEqual Uri("http://host/path?param1=value1#fragment")

uri.withQuery(Query("param1" -> "val\"ue1")) shouldEqual Uri("http://host/path?param1=val%22ue1#fragment")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this API should definitely encode when converting to raw 👍

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) labels Mar 12, 2020
@raboof raboof changed the title Encode query string on render Encode query string Mar 12, 2020
@akka-ci akka-ci added needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed validating PR that is currently being validated by Jenkins labels Mar 12, 2020
@akka-ci
Copy link

akka-ci commented Mar 12, 2020

Test FAILed.

Pull request validation report

Mima Failures
Problems for akka-http-core:
akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.7  (filtered 379)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.4  (filtered 249)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.9  (filtered 355)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.0  (filtered 311)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.9  (filtered 98)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.7  (filtered 195)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.6  (filtered 195)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.1  (filtered 413)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.8  (filtered 106)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.6  (filtered 390)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.13  (filtered 370)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.3  (filtered 244)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.0  (filtered 430)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.11  (filtered 386)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.4  (filtered 401)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.1  (filtered 271)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.3  (filtered 414)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.11  (filtered 54)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.15  (filtered 340)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.12  (filtered 370)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.10  (filtered 360)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.5  (filtered 397)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.10  (filtered 54)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.5  (filtered 226)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.8  (filtered 355)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.2  (filtered 413)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.0.14  (filtered 354)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.2  (filtered 244)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")


@akka-ci akka-ci added validating PR that is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR that is currently being validated by Jenkins labels Mar 12, 2020
@akka-ci
Copy link

akka-ci commented Mar 12, 2020

Test FAILed.

Pull request validation report

Mima Failures
Problems for akka-http-core:
akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.4  (filtered 249)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.9  (filtered 98)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.7  (filtered 195)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.6  (filtered 195)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.8  (filtered 106)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.3  (filtered 244)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.1  (filtered 271)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.11  (filtered 54)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 3 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.10  (filtered 54)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")
 * method raw-query-char()akka.parboiled2.CharPredicate in object akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")
 * static method raw-query-char()akka.parboiled2.CharPredicate in class akka.http.impl.model.parser.CharacterClasses does not have a correspondent in current version
   filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.model.parser.CharacterClasses.raw-query-char")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.5  (filtered 226)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")

akka-http-core: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-http-core_2.12:10.1.2  (filtered 244)
 * abstract method rawQueryString(java.lang.String,Boolean)akka.http.javadsl.model.Uri in class akka.http.javadsl.model.Uri is present only in current version
   filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.javadsl.model.Uri.rawQueryString")


raboof and others added 2 commits March 18, 2020 12:06
Co-Authored-By: Ignasi Marimon-Clos <ignasi@lightbend.com>
Co-Authored-By: Enno <458526+ennru@users.noreply.github.com>
@akka-ci akka-ci added validating PR that is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed tested PR that was successfully built and tested by Jenkins validating PR that is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) labels Mar 18, 2020
@akka-ci akka-ci added needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR that is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed validating PR that is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) labels Mar 18, 2020
@akka-ci
Copy link

akka-ci commented Mar 18, 2020

Test PASSed.

@raboof raboof requested a review from jrudolph March 18, 2020 11:22
Copy link
Contributor

@jrudolph jrudolph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great work, thanks.

Do you think you have now closed all loopholes to create Uris with an invalid rawQueryString? AFAICS, it now looks fine. copy goes through the safe variant. From Java you could create an unexpected subclass of sealed scaladsl.model.Uri but let's not worry about that one.

@raboof
Copy link
Contributor Author

raboof commented Mar 18, 2020

Do you think you have now closed all loopholes to create Uris with an invalid rawQueryString?

Yes, I think so - of course there's a couple of situations where we parse the string again to make sure there are no invalid percent-encodings in there, but no longer in the 'hot path'.

@jrudolph
Copy link
Contributor

Yes, I think so - of course there's a couple of situations where we parse the string again to make sure there are no invalid percent-encodings in there, but no longer in the 'hot path'.

Yeah, good point. If someone cares about those paths they can still be optimized later on.

@jrudolph jrudolph changed the title Encode query string core: percent encode illegal chars when creating URI query Mar 19, 2020
@jrudolph jrudolph merged commit e284816 into master Mar 19, 2020
@jrudolph jrudolph deleted the encode-query-string-on-render branch March 19, 2020 09:15
jrudolph pushed a commit to jrudolph/akka-http that referenced this pull request Mar 19, 2020
This makes sure 'strict' parsing of the Uri query string only allows characters that are actually allowed here by the RFC.

It does not change the fact that Uri's rawQueryString is the percent-encoded representation of the query string, since this information is needed to parse it into a key-value structure.

When parsing the Uri in 'relaxed' mode or constructing programmatically, we do accept characters that are not allowed, but percent-encode any would-be invalid characters.

API's that can be used to programmatically add or modify the query string are adapted to not accept invalid percent-encoded values (e.g. %x2) and convert illegal characters. withRawQueryString is made available both in a 'strict' and a 'relaxed' variation.

Fixes akka#3002

(cherry picked from commit e284816)
jrudolph pushed a commit to jrudolph/akka-http that referenced this pull request Mar 19, 2020
release 10.1 backport of akka#3003

This makes sure 'strict' parsing of the Uri query string only allows characters that are actually allowed here by the RFC.

It does not change the fact that Uri's rawQueryString is the percent-encoded representation of the query string, since this information is needed to parse it into a key-value structure.

When parsing the Uri in 'relaxed' mode or constructing programmatically, we do accept characters that are not allowed, but percent-encode any would-be invalid characters.

API's that can be used to programmatically add or modify the query string are adapted to not accept invalid percent-encoded values (e.g. %x2) and convert illegal characters. withRawQueryString is made available both in a 'strict' and a 'relaxed' variation.

Fixes akka#3002

(cherry picked from commit e284816)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-backport tested PR that was successfully built and tested by Jenkins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants