`normalizePathSegments` replaces the password in the userinfo with `...`

Open Beginner friendly
#93 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
haskell
Domain
backend

Research direction

Read the normalizePathSegments implementation and its normstr branch, where the issue identifies show (normuri u) as the source of the password change. Check nearby tests for URI normalization and add coverage for userinfo containing a password, including paths with and without dot segments. Done means normalization preserves the original password while still removing dot segments; run the relevant tests with the reported network-uri and GHC versions if available.

Written by the indexing model from the issue text.

Description

normalizePathSegments changes the userinfo of a URI that contains a password:

>>> normalizePathSegments "http://user:[email protected]/a/../b"
"http://user:[email protected]/b"
>>> normalizePathSegments "http://user:[email protected]/b"
"http://user:[email protected]/b"

I expected "http://user:[email protected]/b" in both cases. The result is still a valid URI, now with the password
..., so nothing signals the change. normalizeCase and normalizeEscape keep the userinfo.

The function parses the string, removes the dot segments and renders the result with show:

normstr (Just u) = show (normuri u)

and the Show URI instance hides the password on purpose (uriToString defaultUserInfoMap). Using
uriToString id fixes it:

-        normstr (Just u) = show (normuri u)
+        normstr (Just u) = uriToString id (normuri u) ""

Tested with network-uri 2.6.4.2 and current master, GHC 9.6.7.

Dominant language
Haskell
Stars
28
Forks
34
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from haskell/network-uri

All issues in haskell/network-uri

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.