Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

internal: Cleanup remote URL trimming for git #4675

Merged
merged 2 commits into from
May 9, 2023

Conversation

briancain
Copy link
Member

Prior to this commit, it was possible to craft a bad git remote and bypass our normalize func for remote git URLs. TrimLeft and TrimRight remote all occurances of the given pattern. The intention however is to only remove the first instance of git@ and the last instance of .git from the given url. This commit fixes that by updating the string trimmers to use TrimPrefix and TrimSuffix, which will only remove the single instance of the pattern.

Fixes WAYP-1173

Prior to this commit, it was possible to craft a bad git remote and
bypass our normalize func for remote git URLs. TrimLeft and TrimRight
remote all occurances of the given pattern. The intention however is to
only remove the first instance of `git@` and the last instance of `.git`
from the given url. This commit fixes that by updating the string
trimmers to use TrimPrefix and TrimSuffix, which will only remove the
single instance of the pattern.

Fixes WAYP-1173
@briancain briancain added pr/no-changelog No automatic changelog entry required for this pull request backport/0.11.x labels May 8, 2023
@briancain briancain requested a review from a team as a code owner May 8, 2023 17:32
@briancain briancain removed the pr/no-changelog No automatic changelog entry required for this pull request label May 8, 2023
@briancain briancain merged commit 2b00bab into main May 9, 2023
37 of 38 checks passed
@briancain briancain deleted the git/fixup-remote-string-parsing branch May 9, 2023 21:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants