Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
remove unused code
adilson34ece490353a
diff --git a/backend/src/server/routes/v1/app-connection-routers/gitlab-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/gitlab-connection-router.tsindex 501eee0436..f7a6c10026 100644--- a/backend/src/server/routes/v1/app-connection-routers/gitlab-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/gitlab-connection-router.ts@@ -130,12 +130,12 @@ export const registerGitLabConnectionRouter = async (server: FastifyZodProvider)server.route({method: "GET",- url: `/:connectionId/search-groups-and-projects`,+ url: `/:connectionId/search-projects`,config: {rateLimit: readLimit},schema: {- operationId: "searchGitLabGroupsAndProjects",+ operationId: "searchGitLabProjects",params: z.object({connectionId: z.string().uuid()}),@@ -156,13 +156,13 @@ export const registerGitLabConnectionRouter = async (server: FastifyZodProvider)handler: async (req) => {const { connectionId } = req.params;const { search } = req.query;- const items: TGitLabGroupTreeItem[] = await server.services.appConnection.gitlab.searchGroupAndProject(+ const projects: TGitLabGroupTreeItem[] = await server.services.appConnection.gitlab.searchProjects(connectionId,search,req.permission);- return items;+ return projects;}});diff --git a/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts b/backend/src/services/app-connection/gitlab/gitlab-connection-fns.tsindex d5acdc7093..63b2db4c72 100644--- a/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts+++ b/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts@@ -505,7 +505,10 @@ export const searchGitLabGroups = async (if (!client) return [];try {- const groups = await client.Groups.search(search);+ const groups = await client.Groups.all({+ search,+ minAccessLevel: 20+ });return groups.map((g) => ({ id: g.id.toString(), name: g.name, fullPath: g.fullPath }));} catch (error: unknown) {@@ -519,7 +522,7 @@ export const searchGitLabGroups = async (}};-export const searchGitLabGroupAndProject = async (+export const searchGitLabProjects = async (search: string,params: TNavigationParams): Promise<TGitLabGroupTreeItem[]> => {@@ -527,10 +530,6 @@ export const searchGitLabGroupAndProject = async (if (!client) return [];try {- const groups = await client.Groups.all({- search,- minAccessLevel: 20- });const projects = await client.Projects.all({search,archived: false,@@ -539,17 +538,15 @@ export const searchGitLabGroupAndProject = async (includeHidden: false,imported: false});- return [- ...groups.map((g) => ({ id: g.id.toString(), name: g.name, fullPath: g.fullPath })),- ...projects.map((p) => ({ id: p.id.toString(), name: p.name, fullPath: p.pathWithNamespace }))- ];++ return projects.map((p) => ({ id: p.id.toString(), name: p.name, fullPath: p.pathWithNamespace }));} catch (error: unknown) {if (error instanceof GitbeakerRequestError) {throw new BadRequestError({- message: `Failed to search GitLab group and project: ${error.message ?? "Unknown error"}${error.cause?.description && error.message !== "Unauthorized" ? `. Cause: ${error.cause.description}` : ""}`+ message: `Failed to search GitLab projects: ${error.message ?? "Unknown error"}${error.cause?.description && error.message !== "Unauthorized" ? `. Cause: ${error.cause.description}` : ""}`});}if (error instanceof InternalServerError) throw error;- throw new InternalServerError({ message: "Unable to search GitLab group and project" });+ throw new InternalServerError({ message: "Unable to search GitLab projects" });}};diff --git a/backend/src/services/app-connection/gitlab/gitlab-connection-service.ts b/backend/src/services/app-connection/gitlab/gitlab-connection-service.tsindex a3f8ada76e..7c184c4854 100644--- a/backend/src/services/app-connection/gitlab/gitlab-connection-service.ts+++ b/backend/src/services/app-connection/gitlab/gitlab-connection-service.ts@@ -10,8 +10,8 @@ import {listGitLabProjects,listGitLabRootGroups,listGitLabSubgroups,- searchGitLabGroupAndProject,- searchGitLabGroups+ searchGitLabGroups,+ searchGitLabProjects} from "./gitlab-connection-fns";import { TGitLabConnection } from "./gitlab-connection-types";@@ -93,12 +93,12 @@ export const gitlabConnectionService = (}};- const searchGroupAndProject = async (connectionId: string, search: string, actor: OrgServiceActor) => {+ const searchProjects = async (connectionId: string, search: string, actor: OrgServiceActor) => {try {const appConnection = await getAppConnection(AppConnection.GitLab, connectionId, actor);- return await searchGitLabGroupAndProject(search, { appConnection, appConnectionDAL, kmsService });+ return await searchGitLabProjects(search, { appConnection, appConnectionDAL, kmsService });} catch (error) {- logger.error(error, `Failed to search group and project for GitLab connection ${connectionId}`);+ logger.error(error, `Failed to search projects for GitLab connection ${connectionId}`);return [];}};@@ -107,9 +107,9 @@ export const gitlabConnectionService = (listProjects,listGroups,listRootGroups,- searchGroups,listSubgroups,listGroupProjects,- searchGroupAndProject+ searchGroups,+ searchProjects};};diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsxindex e3511fb774..20c1c6f066 100644--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsx+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsx@@ -38,7 +38,6 @@ export const GitLabDataSourceConfigFields = () => {const { data: projects, isPending: isProjectsPending } = useGitLabConnectionListProjects(connectionId,- undefined,{ enabled: Boolean(connectionId) });diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsxindex eaa14780dc..1a7590f27c 100644--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsx+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsx@@ -21,7 +21,7 @@ import {useGitLabConnectionListRootGroups,useGitLabConnectionListSubgroups,useGitLabConnectionSearchGroups,- useGitLabConnectionSearchGroupsAndProjects+ useGitLabConnectionSearchProjects} from "@app/hooks/api/appConnections/gitlab";import { useDebounce } from "@app/hooks/useDebounce";@@ -219,11 +219,9 @@ export const GitLabProjectPicker = ({enabled: hasConnection});- const groupsAndProjectsSearchQuery = useGitLabConnectionSearchGroupsAndProjects(- connectionId,- debouncedSearch,- { enabled: hasConnection && tab === "groups" && isSearching }- );+ const projectSearchQuery = useGitLabConnectionSearchProjects(connectionId, debouncedSearch, {+ enabled: hasConnection && tab === "groups" && isSearching+ });const groupNameSearchQuery = useGitLabConnectionSearchGroups(connectionId, debouncedSearch, {enabled: hasConnection && tab === "groups" && isSearching@@ -251,9 +249,7 @@ export const GitLabProjectPicker = ({project.name.toLowerCase().includes(normalizedSearch));- const searchedGroupIds = new Set((groupNameSearchQuery.data ?? []).map((group) => group.id));- const searchedProjects = (groupsAndProjectsSearchQuery.data ?? [])- .filter((item) => !searchedGroupIds.has(item.id))+ const searchedProjects = (projectSearchQuery.data ?? []).filter((project) => project.name.toLowerCase().includes(normalizedSearch)).map((project) => ({ id: project.id, name: project.name })).slice(0, SEARCH_ITEMS_LIMIT);@@ -317,7 +313,7 @@ export const GitLabProjectPicker = ({<div className={cn(TREE_PICKER_SCROLL_CLASS, "p-1")}><SearchResultsListquery={debouncedSearch}- isLoading={groupsAndProjectsSearchQuery.isLoading || groupNameSearchQuery.isLoading}+ isLoading={projectSearchQuery.isLoading || groupNameSearchQuery.isLoading}groups={groupNameSearchQuery.data ?? []}projects={searchedProjects}selectedProjectId={selectedProjectId}diff --git a/frontend/src/hooks/api/appConnections/gitlab/queries.tsx b/frontend/src/hooks/api/appConnections/gitlab/queries.tsxindex f8a99075d6..e16f7405b7 100644--- a/frontend/src/hooks/api/appConnections/gitlab/queries.tsx+++ b/frontend/src/hooks/api/appConnections/gitlab/queries.tsx@@ -15,8 +15,8 @@ const gitlabConnectionKeys = {[...gitlabConnectionKeys.all, "groups", "root", connectionId] as const,searchGroups: (connectionId: string, search: string) =>[...gitlabConnectionKeys.all, "search-groups", connectionId, search] as const,- searchGroupsAndProjects: (connectionId: string, search: string) =>- [...gitlabConnectionKeys.all, "search-groups-and-projects", connectionId, search] as const,+ searchProjects: (connectionId: string, search: string) =>+ [...gitlabConnectionKeys.all, "search-projects", connectionId, search] as const,listSubgroups: (connectionId: string, groupId: string) =>[...gitlabConnectionKeys.all, "subgroups", connectionId, groupId] as const,listGroupProjects: (connectionId: string, groupId: string) =>@@ -124,7 +124,7 @@ export const useGitLabConnectionSearchGroups = (});};-export const useGitLabConnectionSearchGroupsAndProjects = (+export const useGitLabConnectionSearchProjects = (connectionId: string,search: string,options?: Omit<@@ -132,16 +132,16 @@ export const useGitLabConnectionSearchGroupsAndProjects = (TGitLabGroupTreeItem[],unknown,TGitLabGroupTreeItem[],- ReturnType<typeof gitlabConnectionKeys.searchGroupsAndProjects>+ ReturnType<typeof gitlabConnectionKeys.searchProjects>>,"queryKey" | "queryFn">) => {return useQuery({- queryKey: gitlabConnectionKeys.searchGroupsAndProjects(connectionId, search),+ queryKey: gitlabConnectionKeys.searchProjects(connectionId, search),queryFn: async () => {const { data } = await apiRequest.get<TGitLabGroupTreeItem[]>(- `/api/v1/app-connections/gitlab/${connectionId}/search-groups-and-projects?search=${encodeURIComponent(search)}`+ `/api/v1/app-connections/gitlab/${connectionId}/search-projects?search=${encodeURIComponent(search)}`);return data;