Skip to content

Throw correct errors when attempting to create resource containing invalid characters on a file system #151

Closed

Description

@jvherweg

Currently the ResourceMapper just slices the tail of an URL and attaches it to the root to create a file path. We still need to add many checks there to make sure everything works as intended and nothing can be abused by external values.

E.g.:

  • convert escaped characters from URLs when generating a file path. (example issue)
  • check for invalid characters.
  • escape characters when going back to an URL.
  • URLs should get checked by a TargetExtractor, but this doesn't check the slug which we also use to generate URLs so should check again there.
  • Prevent files outside of the root scope to be accessed by for example having an ../../../etc/passwd slug.

Activity

  1. added
    ☀️ enhancement
    on Sep 11, 2020
  2. jvherweg commented on Oct 14, 2020

    @jvherweg
    MemberAuthor

    Mostly covered already by #173 . Only thing that is not covered yet is checking if the identifier contains any characters that might be illegal on a file system, so I'm guessing the server will currently still throw 500 errors there. We should just catch those errors and then throw a 400 instead.

  3. changed the title [-]Validate generated URLs and file paths[/-] [+]Throw correct errors when attempting to create resource containing invalid characters on a file system[/+] on Oct 5, 2022
  4. jvherweg commented on Oct 5, 2022

    @jvherweg
    MemberAuthor

    One way to trigger this (on Windows at least) is with

    curl -X PUT -H "Content-Type: text/turtle" -d "<ex:s> <ex:p> <ex:o>." "http://localhost:3000/<>|:?*"

    As mentioned above, this should just throw a 400 with a correct message.

  5. added
    🐛 bug
    good first issue
    and removed
    ☀️ enhancement
    on Oct 5, 2022
  6. jvherweg commented on Oct 10, 2023

    @jvherweg
    MemberAuthor

    This was fixed in #1654

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty:loweffort:lowgood first issue🐛 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions