Skip to content

feat: add baseUrl to github provider to support github enterprise urls - #4944

Open
narcisonunez wants to merge 1 commit into
canaryfrom
feat/add-github-provider-baseurl
Open

feat: add baseUrl to github provider to support github enterprise urls#4944
narcisonunez wants to merge 1 commit into
canaryfrom
feat/add-github-provider-baseurl

Conversation

@narcisonunez

@narcisonunez narcisonunez commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What is this PR about?

Adds support for github enterprise instances. Currently, we only support github.com and it was hardcoded in the code base.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related (if applicable)

No related issue.

Screenshots (if applicable)

Screenshot 2026-07-31 at 11 46 37 AM

Greptile Summary

Adds configurable GitHub instance URLs for GitHub Enterprise support.

  • Persists the provider URL through a new database column and setup flow.
  • Routes GitHub API, repository listing, branch listing, clone, and UI links through the provider-specific host.
  • Adds client/server URL normalization and Enterprise URL coverage.

Confidence Score: 4/5

This PR should not merge until the setup callback prevents request-controlled GitHub hosts from targeting internal network services.

The callback uses an authenticated user's githubUrl query parameter as the destination of a server-side POST, while validation still permits private DNS names and hostnames that resolve to private addresses.

Files Needing Attention: apps/dokploy/pages/api/providers/github/setup.ts and packages/server/src/utils/providers/github.ts

Security Review

The setup callback permits authenticated blind SSRF because its query-controlled GitHub URL can resolve to an internal HTTPS service. How this was verified: The callback passes the accepted query hostname directly to Octokit's manifest-conversion request while validation allows arbitrary fully qualified DNS names.

Reviews (1): Last reviewed commit: "feat: add baseUrl to github provider to ..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 31, 2026
if ("error" in parsed) {
return res.status(400).json({ error: parsed.error });
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 security Callback-controlled API destination

When a user with Git-provider creation permission supplies an internally resolving HTTPS FQDN in githubUrl, the callback uses that host for Octokit's manifest-conversion POST, allowing blind requests to internal HTTPS services with redirect, error, and timing outcomes visible to the caller.

How this was verified: The callback passes the accepted query hostname directly to Octokit's manifest-conversion request while validation permits arbitrary fully qualified DNS names.

githubInstallationId: text("githubInstallationId"),
githubPrivateKey: text("githubPrivateKey"),
githubWebhookSecret: text("githubWebhookSecret"),
githubUrl: text("githubUrl").default("https://github.com").notNull(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small thing, is there a reason we default to https://github.com here? Heads up in case you hadn't seen it: providers/github.ts already checks host === "github.com" and returns the API URL, so this ends up being derived twice. I think we could default straight to https://api.github.com and drop the guessing in deriveGithubApiUrl

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Siumauricio You are right. However, I used https://github.com as default because githubUrl represents the base url. This keeps consistency because we save the base url for the enterprise url.

Do you want me to replace it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants