Skip to content

Reject encoded separators in non-greedy path parameters - #310

Merged
ringabout merged 1 commit into
planety:develfrom
puffball1567:fix/path-param-encoded-separators
Sep 7, 2026
Merged

Reject encoded separators in non-greedy path parameters#310
ringabout merged 1 commit into
planety:develfrom
puffball1567:fix/path-param-encoded-separators

Conversation

@puffball1567

Copy link
Copy Markdown
Contributor

Summary

  • reject percent-encoded forward slashes and backslashes in non-greedy path parameters before URL decoding
  • preserve ordinary and double-encoded values, as well as the documented multi-segment behavior of greedy parameters
  • add matrix coverage for route position, separator position and casing, malformed encodings, HTTP methods, and greedy parameters

Tests

  • nim c -r tests/mock/tmock_mocking/tmock_route.nim
  • nim c -r -d:usestd tests/mock/tmock_mocking/tmock_route.nim
  • nimble tests

Fixes #296

@ringabout ringabout left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed PR #310 against devel. The guard is applied before storing non-greedy captures, handles case-insensitive %2F/%5C, and leaves greedy parameters and double-encoded values unchanged. Focused tests pass on the default and -d:usestd backends. The regex-route behavior is pre-existing and can be followed up separately. LGTM.

@ringabout
ringabout merged commit 2956ef2 into planety:devel Sep 7, 2026
2 checks passed
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.

getPathParams() decodes %2F after route matching, which breaks segment boundaries and enables unintended traversal vulnerabilities

2 participants