Add or adjust several new validation classes#1733
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
[Guid],[String], and[NonTraversingPath]annotation attributes to help with validating HTTP and configuration inputs, along with tests for each. Previously[AbsolutePath]and[RelativePath]were testing for traversal segments, and that logic has been taken out; all paths require an explicit check for traversal segments moving forward, so it's top of mind.[String]will eventually take over for a lot of existing built-in annotations and the pre-existing[NotNullOrWhiteSpace]; it covers null/empty/whitespace/min/max and regular expression tests all in one, and it will be easy to extend later (arguably, it could be extended now to handle path variations, but I decided not to).Lastly, I've added a check for traversal segments in configured shares. The validation logic requires absolute/rooted paths already, but a careless user (or one trying to get around the absolute requirement) might use
\..\or/../to get around this, which has no effect on Windows and results in broken shares on Linux. This follows with the previous work I've done in #1729 to guard against similar path traversal issues in other areas of the codebase.Spun out of #1720 which has gotten too large and off-topic.