Skip to content

Cannot use / in url params #31223

Closed

Description

@butonic

Steps to reproduce

  1. register a route with a param, eg /resource/{id}
  2. try to use an id with a /. it should be urlencoded, so the url in a request will look like /resource/id%2Fwith%2Fslashes

Expected behaviour

The controller should get id/with/slashes as a parameter.

Actual behaviour

The controller is never called because the url never matches.

  1. make sure apache does not auto decode slashes by adding AllowEncodedSlashes On to the virtualhosts section. Otherwise you get an immediate 404 without php ever seeing the request
  2. Even with AllowEncodedSlashes On the url gets decoded in Symphonys URLMatcher. In the worst case this might cause calling the wrong route.

Related

owncloud-archive/user_management#20 (comment)

Activity

  1. butonic commented on Apr 20, 2018

    @butonic
    ContributorAuthor
  2. butonic commented on Apr 20, 2018

    @butonic
    ContributorAuthor

    That means our resource urls are generated without this.

  3. self-assigned this
    on Apr 20, 2018
  4. changed the title [-]Cannot use `/` in url params[/-] [+]Cannot use / in url params[/+] on Apr 20, 2018
  5. ownclouders commented on Apr 20, 2018

    @ownclouders
    Contributor

    GitMate.io thinks possibly related issues are #883 (Can't use 'n' character in url for 'New > From Link'), #30097 (Logout URL doesn't work if using reverse proxy), #20414 (Can't use HTTPS: "URL /index.php/apps/files/ not found"), #23880 (How to use Pretty URL ?), and #16694 (No CardDav URL provided).

  6. phil-davis commented on Apr 20, 2018

    @phil-davis
    Contributor

    Are there any cases where {id} is followed by more parameters or URL parts?
    e.g. there is a ``groupa`

    /ocs/v1.php/settings/groups/groupa
    /ocs/v1.php/settings/groups/groupa/displayName
    

    and if you create a group called groupa/displayName then there could be trouble.
    It depends how long the %2F stays around. The client is going to access:

    /ocs/v1.php/settings/groupss/groupa%2FdisplayName
    /ocs/v1.php/settings/users/groupa%2FdisplayName/displayName
    

    to try and find out about that nasty-named user.

  7. added
    p4-low
    on Apr 20, 2018
  8. added this to the triage milestone on Apr 20, 2018
  9. self-assigned this
    on May 30, 2018
  10. butonic commented on May 30, 2018

    @butonic
    ContributorAuthor

    @paurakhsharma please try with #31224

  11. modified the milestones: development, QA on Jan 11, 2019
  12. locked as resolved and limited conversation to collaborators on Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions