Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change clone URL check for gitlab to account for possible subpath #5177

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

philslab-ninja
Copy link

what

This change allows GitLab URLs that include a subpath in the hostname while maintaining the security checks for repository path validation. The validation will pass as long as the full URL path ends with the expected repository path, which accommodates the case where ATLANTIS_GITLAB_HOSTNAME includes a path component.

why

In one of my projects github enterprise unfortunately was setup with a basepath (like git.acme.com/gitlab). Setting ATLANTIS_GITLAB_HOSTNAME to git.acme.com/gitlab results in an error like:

expected clone url to have path "/path/to/repo.git" but had "/gitlab/path/to/repo.git"

tests

  • I have tested my changes by building and using the application with the changed behaviour

references

closes #1450

@philslab-ninja philslab-ninja requested review from a team as code owners December 17, 2024 13:05
@philslab-ninja philslab-ninja requested review from GenPage, lukemassa and nitrocode and removed request for a team December 17, 2024 13:05
@github-actions github-actions bot added the go Pull requests that update Go code label Dec 17, 2024
@dosubot dosubot bot added bug Something isn't working provider/gitlab labels Dec 17, 2024
@jamengual jamengual added the waiting-on-review Waiting for a review from a maintainer label Dec 31, 2024
Copy link
Member

@chenrui333 chenrui333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense, can you add a test for it?

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 31, 2024
@jamengual jamengual added waiting-on-response Waiting for a response from the user and removed waiting-on-review Waiting for a review from a maintainer labels Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working go Pull requests that update Go code lgtm This PR has been approved by a maintainer provider/gitlab waiting-on-response Waiting for a response from the user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Atlantis doesn't work when Gitlab is installed under a relative URL
3 participants