Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: various ui and github sync fixes

Scott Wilsone78ad1147b46
diff --git a/backend/src/services/secret-sync/github/github-sync-fns.ts b/backend/src/services/secret-sync/github/github-sync-fns.ts
index 39d458b68e..8e0759d11e 100644
--- a/backend/src/services/secret-sync/github/github-sync-fns.ts
+++ b/backend/src/services/secret-sync/github/github-sync-fns.ts
@@ -2,7 +2,7 @@ import { Octokit } from "@octokit/rest";
import sodium from "libsodium-wrappers";
import { getGitHubClient } from "@app/services/app-connection/github";
-import { GitHubSyncScope } from "@app/services/secret-sync/github/github-sync-enums";
+import { GitHubSyncScope, GitHubSyncVisibility } from "@app/services/secret-sync/github/github-sync-enums";
import { SECRET_SYNC_NAME_MAP } from "@app/services/secret-sync/secret-sync-maps";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
@@ -149,7 +149,9 @@ const putSecret = async (client: Octokit, secretSync: TGitHubSyncWithCredentials
org: destinationConfig.org,
...payload,
visibility,
- selected_repository_ids: selectedRepositoryIds
+ ...(visibility === GitHubSyncVisibility.Selected && {
+ selected_repository_ids: selectedRepositoryIds
+ })
});
break;
}
diff --git a/backend/src/services/secret-sync/github/github-sync-schemas.ts b/backend/src/services/secret-sync/github/github-sync-schemas.ts
index 6f802ed902..0302312c90 100644
--- a/backend/src/services/secret-sync/github/github-sync-schemas.ts
+++ b/backend/src/services/secret-sync/github/github-sync-schemas.ts
@@ -34,10 +34,20 @@ const GitHubSyncDestinationConfigSchema = z
.superRefine((options, ctx) => {
if (options.scope !== GitHubSyncScope.Organization) return;
- if (options.visibility === GitHubSyncVisibility.Selected && !options.selectedRepositoryIds?.length) {
+ if (options.visibility === GitHubSyncVisibility.Selected) {
+ if (!options.selectedRepositoryIds?.length)
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Select at least 1 repository",
+ path: ["selectedRepositoryIds"]
+ });
+ return;
+ }
+
+ if (options.selectedRepositoryIds?.length) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
- message: "Select at least 1 repository",
+ message: `Selected repositories is only supported for visibility "Selected"`,
path: ["selectedRepositoryIds"]
});
}
diff --git a/frontend/src/components/secret-syncs/SecretSyncImportSecretsModal.tsx b/frontend/src/components/secret-syncs/SecretSyncImportSecretsModal.tsx
index 99334294f1..aab8a42436 100644
--- a/frontend/src/components/secret-syncs/SecretSyncImportSecretsModal.tsx
+++ b/frontend/src/components/secret-syncs/SecretSyncImportSecretsModal.tsx
@@ -107,7 +107,7 @@ const Content = ({ secretSync, onComplete }: ContentProps) => {
}
errorText={error?.message}
isError={Boolean(error?.message)}
- label="Initial Sync Behavior"
+ label="Import Behavior"
>
<Select
value={value}
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitHubSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitHubSyncFields.tsx
index e7e51b515a..cabda1e669 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitHubSyncFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitHubSyncFields.tsx
@@ -20,18 +20,13 @@ import {
import { TSecretSyncForm } from "../schemas";
export const GitHubSyncFields = () => {
- const {
- control,
- formState: { errors },
- watch,
- setValue
- } = useFormContext<TSecretSyncForm & { destination: SecretSync.GitHub }>();
-
- console.log("errors", errors, watch());
+ const { control, watch, setValue } = useFormContext<
+ TSecretSyncForm & { destination: SecretSync.GitHub }
+ >();
const connectionId = useWatch({ name: "connection.id", control });
const currentScope = watch("destinationConfig.scope");
- const currentVisibility = watch("destinationConfig.visibility", GitHubSyncVisibility.All);
+ const currentVisibility = watch("destinationConfig.visibility");
const currentOrg = watch("destinationConfig.org");
const currentRepo = watch("destinationConfig.repo");
const currentOwner = watch("destinationConfig.owner");
@@ -70,7 +65,7 @@ export const GitHubSyncFields = () => {
setValue("destinationConfig.org", "");
setValue("destinationConfig.repo", "");
setValue("destinationConfig.owner", "");
- setValue("destinationConfig.selectedRepositoryIds", []);
+ setValue("destinationConfig.selectedRepositoryIds", undefined);
}}
/>
<Controller
@@ -134,6 +129,7 @@ export const GitHubSyncFields = () => {
value={value}
onValueChange={(val) => {
onChange(val);
+ setValue("destinationConfig.selectedRepositoryIds", undefined);
}}
className="w-full border border-mineshaft-500 capitalize"
position="popper"
@@ -194,6 +190,7 @@ export const GitHubSyncFields = () => {
onChange(repo?.name);
setValue("destinationConfig.owner", repo?.owner.login ?? "");
+ setValue("destinationConfig.env", "");
}}
options={repositories}
placeholder="Select a repository..."
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDetailsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDetailsSection.tsx
index 540870ccd9..90d5817768 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDetailsSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDetailsSection.tsx
@@ -58,7 +58,7 @@ export const SecretSyncDetailsSection = ({ secretSync, onEditDetails }: Props) =
)}
{syncStatus === SecretSyncStatus.Failed && lastSyncMessage && (
<SecretSyncLabel labelClassName="text-red" label="Last Sync Error">
- <p className="rounded bg-mineshaft-600 p-2 text-xs">{lastSyncMessage}</p>
+ <p className="break-words rounded bg-mineshaft-600 p-2 text-xs">{lastSyncMessage}</p>
</SecretSyncLabel>
)}
</div>