aws / aws/git-remote-codecommit

URL parser silently ignores the "path" portion

Offen
#47 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
289
Forks
40
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne in git_remote_codecommit/__init__.py bei der urlparse-Behandlung um Zeile 95. Reproduziere das Parsen für codecommit://profile@repository und dieselbe URL mit einem nicht leeren Pfad. Überprüfe anschließend, dass Letztere mit einem expliziten path-not-allowed-Fehler abgelehnt wird, während das dokumentierte Format weiterhin akzeptiert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
cli
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.