-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix page tree node slug validation to prevent URL encoded characters #2229
Conversation
This would be very suitable for a unit test |
Please write a description for your PR |
This validation should also be adapted in the API: https://github.com/vivid-planet/comet/blob/main/packages/api/cms-api/src/common/validators/is-slug.ts |
But you are also:
(at least that is what I observed by looking at your regex) That should all have been explained in the description, together with reasons for the change. And as support for encoded special chars was explicitly implemented, are we really sure we can remove it? What was it originally inteded for? |
Was this explicitly implemented? Background: In a recent pen test it was concerned that certain characters in the slug input aren't allowed, but that the url-encoded variants of those characters are allowed. |
@fichtnerma could you please check when and why this was originally implemented? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to check why this was added and if it can be removed.
This validation was added before this repository was moved over to github and as far as i can tell this was not implemented for a specific reason other than the regex supporting all allowed chars in a URI according to https://tools.ietf.org/html/rfc3986#section-2.1 |
@fichtnerma please address this concern: #2229 (comment). IMO we should only remove the URL encoded characters here. |
I have adjusted the validator to only fail if a slash was provided. |
In the linked task it also mentions ".". Wouldn't it be better to remove URL encoding altogether? |
@fichtnerma we discussed this in last week's meeting: Please remove support for URL encoded characters in general (as it's supposedly a security issue). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @dkarnutsch @nsams please review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Daniel Karnutsch <dkarnutsch@users.noreply.github.com>
Co-authored-by: Daniel Karnutsch <dkarnutsch@users.noreply.github.com>
Quality Gate failedFailed conditions |
Improve the Slug validation to filter out url escaped special characters to prevent path traversal attacks
PR Checklist