Problem
It seems until a route access checker gets called, a new Request gets created several times based on the raw path and because of that, special characters from query parameters get lost. So if you have an access checker that checks access based on a value of a query parameter that may contain special characters (ex.: a hash) then the access checker can return false-positive results. This probably happens because special characters in query params have not been URL encoded.
Callstack:
Proposed solution
Probably everywhere where new Request gets created from a raw path, the path should be exploded to parts and we should warrant that all query parameters get URL decoded before the new Request object is created. Ex.: \Drupal\Core\Url::toUriString()
Remaining tasks
Determine solution
Comment | File | Size | Author |
---|---|---|---|
#16 | 2902797-16.patch | 5.2 KB | smustgrave |
#16 | interdiff-14-16.txt | 498 bytes | smustgrave |
Comments
Comment #4
mxr576@joey-santiago, I am updating this issue because I think we have bumped into the same issue. Please let me know if I have misunderstood your problem.
I have created a POC test just to confirm that the issue exists. (Also uploading a seperate test which confirms the POC test is valid :) )
Comment #5
mxr576Comment #6
mxr576Probably this is the doing of
\Drupal\Core\Routing\AccessAwareRouter::matchRequest()
(partially) so I have removed PathValidator from the title.Comment #7
joey-santiago CreditAttribution: joey-santiago commentedwow! at first sight, that looks exactly what i was experiencing, but i haven't looked at the issue in the past 2+ yrs, so i don't recall how i found this out :) I'll try getting a test environment up to test this out
Comment #8
mxr576For the record, the test-without-special-char only failed because of some deprecation errors.
Comment #9
mxr576Silenced deprecation warnings.
Comment #14
smustgrave CreditAttribution: smustgrave at Mobomo commentedRerolled for 9.5.x
Comment #16
smustgrave CreditAttribution: smustgrave at Mobomo commentedDeprecation fix
Comment #18
smustgrave CreditAttribution: smustgrave at Mobomo commentedSelf review
All that was added was the tests. That was my mistake and one of my first issues.