Skip to content

Conversation

CL0Pinette
Copy link

@CL0Pinette CL0Pinette commented Jun 17, 2025

Checklist

  • Read CONTRIBUTING.md.
  • PR title is short and non-generic (see previously merged PRs for examples).
  • PR only implements a single feature or fixes a single bug.
  • Tests passing (uv run pytest tests)?
  • Lint / pre-commits passing (pre-commit run --all-files)?

Description

This PR allows the user to have a git repository with SSH server on a non default port.

Steps to QA

Add a new repository git+ssh://git@host/org/repo.git
Add a new repository git+ssh://git@host:1234/org/repo.git
Both repositories should sync well


Summary by cubic

Added support for specifying a port in git repository SSH URLs.

  • New Features
    • Users can now add repositories using SSH URLs with custom ports, such as git+ssh://git@host:1234/org/repo.git.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic found 1 issue across 1 file. Review it in cubic.dev

React with 👍 or 👎 to teach cubic. Tag @cubic-dev-ai to give specific feedback.

@@ -64,6 +64,7 @@ def validate_origin(cls, v: str) -> str:
if not re.match(
r"^git\+ssh://git@" # Protocol and user prefix
r"[-a-zA-Z0-9.]+" # Hostname
r"(:[0-9]{1,5})?" # Port
Copy link
Contributor

Choose a reason for hiding this comment

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

The regex accepts any 1-5 digit number, so ports like 0 or 99999—outside the valid 1-65535 range—are treated as valid. This can let users configure repositories that will later fail to connect or open a security hole by silently accepting invalid endpoints.

Copy link
Contributor

Choose a reason for hiding this comment

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

@CL0Pinette looks good but just a small suggestion here ^

Copy link
Author

Choose a reason for hiding this comment

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

You're right, I just pushed a new version with a more restrictive regex for ports

@topher-lo topher-lo added enhancement New feature or request api Improvements or additions to the backend API labels Jun 17, 2025
@topher-lo
Copy link
Contributor

@CL0Pinette running the tests now. Have you dealt with the case where port is NOT required? Would it be possible to add 1-2 tests as well.

Once that's through I think it's good to go!

@CL0Pinette
Copy link
Author

Yes, if port is not set, it is defaulted to 22. Sure, I will add test at the end of this week

@topher-lo
Copy link
Contributor

Yes, if port is not set, it is defaulted to 22. Sure, I will add test at the end of this week

I believe it should be no port set at all as default.

@Kilroy1337
Copy link
Contributor

Hi!
Is this PR still active, or has it been abandoned? The issue it addresses is still very relevant - especially for those running self-hosted GitLab instances on a non-standard SSH port.

@topher-lo
Copy link
Contributor

topher-lo commented Aug 19, 2025

Is this PR still active, or has it been abandoned? The issue it addresses is still very relevant - especially for those running self-hosted GitLab instances on a non-standard SSH port.

@Kilroy1337:

Thank you @CL0Pinette for taking a first shot at this, help us a lot! I'm going to close this PR and take it on / open it up to others. Looks like it's a bigger priority for folks.

@topher-lo topher-lo closed this Aug 19, 2025
@topher-lo
Copy link
Contributor

@Kilroy1337 @CL0Pinette tracking here: #1356. I'm working on it now. Will be out this week as part of 0.43.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Improvements or additions to the backend API enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants