apache / apache/maven-scm

[SCM-907] GitScmProviderRepository#parseUrl() does not comply with RFC 3986 and RFC 8089

Open
#1,138 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
104
Forks
189
Avg merge
17h 46m
Merged PRs (30d)
6

Description

**[Michael Osipov](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=michael-o)** opened **[SCM-907](https://issues.apache.org/jira/browse/SCM-907?redirect=false)** and commented

This issue was been found on one of Jenkins slaves. Consider the following path: `F:\jenkins\jenkins-slave\workspace\maven-box_maven-scm_SCM-906-3AXCXWOA5KAAL37TCEKGJUQCHVU3HMOGCVV63JP76C24C3X6DHOA@2\m\maven-scm-providers\maven-scm-providers-git\maven-scm-provider-gitexe\target`. THe aforementioned class outputs:

```
file:///F:/jenkins/jenkins-slave/workspace/maven-box_maven-scm_SCM-906-3AXCXWOA5KAAL37TCEKGJUQCHVU3HMOGCVV63JP76C24C3X6DHOA@2/m/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/target
file://2/m/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/target
```

The parse logic incorrectly assumes that the last `@` is for the user info. According to RFC 8089 a file URL may contain this information, but our parser would still fail becuase it uses `lastIndexOf`. It must stop searching to the first slash.

---

**Affects:** 1.10.0

**Sub-tasks:**
- [SCM-908](https://issues.apache.org/jira/browse/SCM-908) GitScmProviderRepository#parseUrl(): skip parsing of user info for file:// URLs

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at GitScmProviderRepository#parseUrl() and reproduce the Windows file URL examples from the issue. Trace how the parser handles the first slash and @ characters, then verify that file URLs are parsed according to RFC 3986 and RFC 8089 without producing the incorrect host/path output shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.