From 6b68fcab8c22d5de646973b438bb057bd03bf213 Mon Sep 17 00:00:00 2001
From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com>
Date: Sun, 7 Jun 2026 01:29:04 -0600
Subject: [PATCH] fix: strip credentials from gitProvider.getAll API response
(#4569)
* fix: strip credentials from gitProvider.getAll API response
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
---
.../settings/git/show-git-providers.tsx | 58 +++++++++----------
.../server/api/routers/git-provider.ts | 37 ++++++++++++
2 files changed, 65 insertions(+), 30 deletions(-)
diff --git a/apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx b/apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx
index a4214ddc2..de18bc64b 100644
--- a/apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx
+++ b/apps/dokploy/components/dashboard/settings/git/show-git-providers.tsx
@@ -134,15 +134,10 @@ export const ShowGitProviders = () => {
const canManage = gitProvider.isOwner || isOrgAdmin;
const haveGithubRequirements =
- isGithub &&
- gitProvider.github?.githubPrivateKey &&
- gitProvider.github?.githubAppId &&
- gitProvider.github?.githubInstallationId;
+ isGithub && gitProvider.github?.isConfigured;
const haveGitlabRequirements =
- isGitlab &&
- gitProvider.gitlab?.accessToken &&
- gitProvider.gitlab?.refreshToken;
+ isGitlab && gitProvider.gitlab?.isConfigured;
return (
{
)}
{isBitbucket &&
- gitProvider.bitbucket?.appPassword &&
- !gitProvider.bitbucket?.apiToken ? (
+ gitProvider.bitbucket?.isDeprecated ? (
Deprecated
) : null}
@@ -244,7 +238,7 @@ export const ShowGitProviders = () => {
Action Required
{
href={getGitlabUrl(
gitProvider.gitlab?.applicationId || "",
gitProvider.gitlab?.gitlabId || "",
- gitProvider.gitlab?.gitlabUrl,
+ gitProvider.gitlab?.gitlabUrl || "",
)}
target="_blank"
className={buttonVariants({
@@ -295,29 +289,33 @@ export const ShowGitProviders = () => {
{canManage && (
<>
- {isGithub && haveGithubRequirements && (
-
- )}
+ {isGithub &&
+ haveGithubRequirements &&
+ gitProvider.github?.githubId && (
+
+ )}
- {isGitlab && (
-
- )}
+ {isGitlab &&
+ gitProvider.gitlab?.gitlabId && (
+
+ )}
- {isBitbucket && (
-
- )}
+ {isBitbucket &&
+ gitProvider.bitbucket?.bitbucketId && (
+
+ )}
- {isGitea && (
+ {isGitea && gitProvider.gitea?.giteaId && (
)}
diff --git a/apps/dokploy/server/api/routers/git-provider.ts b/apps/dokploy/server/api/routers/git-provider.ts
index 5f48ff422..7e2aed9b3 100644
--- a/apps/dokploy/server/api/routers/git-provider.ts
+++ b/apps/dokploy/server/api/routers/git-provider.ts
@@ -42,6 +42,43 @@ export const gitProviderRouter = createTRPCRouter({
return results.map((r) => ({
...r,
isOwner: r.userId === ctx.session.userId,
+ github: r.github
+ ? {
+ githubId: r.github.githubId,
+ githubAppName: r.github.githubAppName,
+ githubAppId: r.github.githubAppId,
+ githubInstallationId: r.github.githubInstallationId,
+ isConfigured: !!(
+ r.github.githubPrivateKey &&
+ r.github.githubAppId &&
+ r.github.githubInstallationId
+ ),
+ }
+ : null,
+ gitlab: r.gitlab
+ ? {
+ gitlabId: r.gitlab.gitlabId,
+ applicationId: r.gitlab.applicationId,
+ gitlabUrl: r.gitlab.gitlabUrl,
+ isConfigured: !!(r.gitlab.accessToken && r.gitlab.refreshToken),
+ }
+ : null,
+ bitbucket: r.bitbucket
+ ? {
+ bitbucketId: r.bitbucket.bitbucketId,
+ bitbucketUsername: r.bitbucket.bitbucketUsername,
+ isConfigured: false,
+ isDeprecated: !!(r.bitbucket.appPassword && !r.bitbucket.apiToken),
+ }
+ : null,
+ gitea: r.gitea
+ ? {
+ giteaId: r.gitea.giteaId,
+ giteaUrl: r.gitea.giteaUrl,
+ clientId: r.gitea.clientId,
+ isConfigured: !!(r.gitea.accessToken && r.gitea.refreshToken),
+ }
+ : null,
}));
}),