Skip to content

urlapi: make dedotdotify handle leading dots correctly - #20974

Closed
bagder wants to merge 3 commits into
masterfrom
bagder/leading-dot
Closed

bagder wants to merge 3 commits into
masterfrom
bagder/leading-dot

Conversation

@bagder

@bagder bagder commented Mar 18, 2026

Copy link
Copy Markdown
Member

Paths starting with one or two leading dots but without a following slash were not handled correctly.

Follow-up to c31dd66

Extended test 1395 accordingly with a set of new test string.

Reported by Codex Security

Paths starting with one or two leading dots but without a following
slash were not handled correctly.

Follow-up to c31dd66

Extended test 1395 accordingly with a set of new test string.

Reported by Codex Security
@bagder
bagder requested a review from Copilot March 18, 2026 08:18
@github-actions github-actions Bot added the tests label Mar 18, 2026
@bagder
bagder marked this pull request as ready for review March 18, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Expands coverage for URL path “remove dot segments” behavior (RFC 3986 §5.2.4) and adjusts dedotdotify() to avoid stripping a leading dot (. / %2e) unless it forms a complete dot-segment (e.g., ./, ../, . end, .. end).

Changes:

  • Add new unit test vectors for tricky prefixes (percent-encoded sequences, multiple slashes, “well-known” variants, and partial percent-escapes).
  • Update dedotdotify() to restore the original input when an initial . / %2e match does not represent a complete dot-segment.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/unit/unit1395.c Adds additional dedotdotify() test cases covering edge cases and regressions.
lib/urlapi.c Refines initial dot-segment handling by restoring original input when the leading dot match is not a full segment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tests/unit/unit1395.c Resolved
@bagder bagder closed this in 3f06e27 Mar 18, 2026
@bagder
bagder deleted the bagder/leading-dot branch April 3, 2026 20:29
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
Paths starting with one or two leading dots but without a following
slash were not handled correctly.

Follow-up to c31dd66

Extended test 1395 accordingly with a set of new test string.

Reported by Codex Security

Closes curl#20974
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants