aws / aws/git-remote-codecommit

URL parser silently ignores the "path" portion

Open
#47 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
289
Forks
40
PR merge metrics
No merged PRs in 30d

Description

The documented URL format is `codecommit://profile@repository`, where "profile" is effectively placed as the username and "repository" as the hostname when following typical URL rules.

The parsing code uses [`urlparse`](https://github.com/aws/git-remote-codecommit/blob/5ed175190c584bef20eceb84c1eb5aaafec22cf7/git_remote_codecommit/__init__.py#L95) and then inspects the various parts, but it totally ignores the path portion of the URL.

The tool will therefore accept a URL like `codecommit://profile@repository/any/other/nonsense`, but will silently discard the path and just treat it the same as `codecommit://profile@repository`, therefore still cloning the entire repository.

Since the path portion has no meaning, I'd suggest making it an error to specify a non-empty path, explicitly stating that a path is not allowed. Because Git repositories conceptually contain a filesystem subtree, it's tempting for someone to think that a path portion will clone a subdirectory of the repository, even though that's not technically possible due to how Git works. Returning an error would therefore give better feedback to someone who has made that mistake.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.