Skip to content

Add or adjust several new validation classes#1733

Merged
jpdillingham merged 8 commits into
masterfrom
validation
May 17, 2026
Merged

Add or adjust several new validation classes#1733
jpdillingham merged 8 commits into
masterfrom
validation

Conversation

@jpdillingham
Copy link
Copy Markdown
Member

@jpdillingham jpdillingham commented May 17, 2026

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.

@jpdillingham jpdillingham merged commit c9acb8f into master May 17, 2026
8 checks passed
@jpdillingham jpdillingham deleted the validation branch May 17, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant