Skip to content

fix: reject dot-segment path parameter values - #372

Closed
pyrooka wants to merge 1 commit into
mainfrom
nb/disallow-relative-path
Closed

pyrooka wants to merge 1 commit into
mainfrom
nb/disallow-relative-path

Conversation

@pyrooka

@pyrooka pyrooka commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

No description provided.

@pyrooka
pyrooka force-pushed the nb/disallow-relative-path branch from 3ecc1cd to f49d6ba Compare September 24, 2026 14:26
Path parameters with value "." or ".." are not encoded by the
standard encoding functions (encodeURIComponent, requests.utils.quote,
OkHttp addPathSegment, url.PathEscape) because dots are RFC 3986
unreserved characters. The downstream HTTP client then performs
standard dot-segment normalisation, silently retargeting the request
to a different resource than the caller intended.

Add a validation guard that rejects any path parameter value that is
exactly "." or ".." with a clear error message, in the same location
and following the same pattern as the existing empty-value guards.
Pre-encoding is not a viable workaround as it produces double-encoded
values (%252E) which change the meaning of the parameter.

Fixes: CWE-23 (Relative Path Traversal) / CWE-116
CVSS 3.1: AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H = 8.8

Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
@pyrooka
pyrooka force-pushed the nb/disallow-relative-path branch from f49d6ba to 3cd17e6 Compare September 24, 2026 14:30
@pyrooka pyrooka changed the title fix: reject dot-segment path parameter values to prevent path traversal fix: reject dot-segment path parameter values Sep 24, 2026
@pyrooka pyrooka closed this Sep 24, 2026
@pyrooka
pyrooka deleted the nb/disallow-relative-path branch September 24, 2026 14:32
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