Skip to content

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

feat: add codespace and dependabot as possible syncs inside github

adilsonc712a7c9b053
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index b6f691916a..059f5f341c 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -3356,7 +3356,9 @@ export const SecretSyncs = {
org: "The name of the GitHub organization.",
owner: "The name of the GitHub account owner of the repository.",
repo: "The name of the GitHub repository.",
- env: "The name of the GitHub environment."
+ env: "The name of the GitHub environment.",
+ secretType:
+ "The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server."
},
AZURE_ENTRA_ID_SCIM: {
servicePrincipalId:
diff --git a/backend/src/services/github-app/github-app-service.ts b/backend/src/services/github-app/github-app-service.ts
index 1dcb9d6971..b30e5db0df 100644
--- a/backend/src/services/github-app/github-app-service.ts
+++ b/backend/src/services/github-app/github-app-service.ts
@@ -464,7 +464,14 @@ export const gitHubAppServiceFactory = ({
secrets: "write",
environments: "write",
actions: "read",
- organization_secrets: "write"
+ organization_secrets: "write",
+ dependabot_secrets: "write",
+ organization_dependabot_secrets: "write",
+ // GitHub Enterprise Server has no Codespaces, so these permissions do not exist there
+ ...(instanceType !== "server" && {
+ codespaces_secrets: "write",
+ organization_codespaces_secrets: "write"
+ })
},
default_events: [] as string[]
};
diff --git a/backend/src/services/secret-sync/github/github-sync-enums.ts b/backend/src/services/secret-sync/github/github-sync-enums.ts
index c0109370ed..2b2962e44a 100644
--- a/backend/src/services/secret-sync/github/github-sync-enums.ts
+++ b/backend/src/services/secret-sync/github/github-sync-enums.ts
@@ -4,6 +4,12 @@ export enum GitHubSyncScope {
RepositoryEnvironment = "repository-environment"
}
+export enum GitHubSyncSecretType {
+ Actions = "actions",
+ Dependabot = "dependabot",
+ Codespaces = "codespaces"
+}
+
export enum GitHubSyncVisibility {
All = "all",
Private = "private",
diff --git a/backend/src/services/secret-sync/github/github-sync-fns.test.ts b/backend/src/services/secret-sync/github/github-sync-fns.test.ts
new file mode 100644
index 0000000000..8cb2fee563
--- /dev/null
+++ b/backend/src/services/secret-sync/github/github-sync-fns.test.ts
@@ -0,0 +1,449 @@
+/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument */
+import { AxiosError } from "axios";
+import sodium from "libsodium-wrappers";
+import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
+
+const { requestMock, paginatedMock, appTokenMock, decryptMock } = vi.hoisted(() => ({
+ requestMock: vi.fn(),
+ paginatedMock: vi.fn(),
+ appTokenMock: vi.fn(),
+ decryptMock: vi.fn()
+}));
+
+vi.mock("@app/services/app-connection/github", () => ({
+ GitHubConnectionMethod: { OAuth: "oauth", App: "github-app", Pat: "pat" },
+ getGitHubAppAuthToken: (...args: unknown[]) => (appTokenMock as any)(...args),
+ getGitHubGatewayConnectionDetails: vi.fn(),
+ getGitHubInstanceApiUrl: async (connection: any) =>
+ connection.credentials.instanceType === "server" ? `${connection.credentials.host}/api/v3` : "api.github.com",
+ makePaginatedGitHubRequest: (...args: unknown[]) => (paginatedMock as any)(...args),
+ requestWithGitHubGateway: (...args: unknown[]) => (requestMock as any)(...args)
+}));
+vi.mock("@app/services/app-connection/app-connection-fns", () => ({
+ decryptAppConnectionCredentials: (...args: unknown[]) => (decryptMock as any)(...args)
+}));
+// The real module loads every sync provider; a prefix match is all these tests rely on.
+vi.mock("@app/services/secret-sync/secret-sync-fns", () => ({
+ matchesSchema: (key: string, _environment: string, schema?: string) =>
+ !schema || key.startsWith(schema.replace("{{secretKey}}", ""))
+}));
+vi.mock("@app/services/secret-sync/secret-sync-maps", () => ({ SECRET_SYNC_NAME_MAP: { github: "GitHub" } }));
+
+/* eslint-disable import/first */
+import { BadRequestError } from "@app/lib/errors";
+import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+
+import { GitHubSyncScope, GitHubSyncSecretType, GitHubSyncVisibility } from "./github-sync-enums";
+import { getGitHubSecretsBasePath, gitHubPreSaveTransformDestinationConfig, GithubSyncFns } from "./github-sync-fns";
+/* eslint-enable import/first */
+
+const repoConfig = (secretType?: GitHubSyncSecretType) =>
+ ({ scope: GitHubSyncScope.Repository, owner: "acme", repo: "app", secretType }) as any;
+
+const orgConfig = (secretType: GitHubSyncSecretType, extra: Record<string, unknown> = {}) =>
+ ({
+ scope: GitHubSyncScope.Organization,
+ org: "acme",
+ visibility: GitHubSyncVisibility.All,
+ secretType,
+ ...extra
+ }) as any;
+
+const makeSync = (
+ destinationConfig: any,
+ {
+ syncOptions = {},
+ credentials = { personalAccessToken: "token", instanceType: "cloud" }
+ }: { syncOptions?: Record<string, unknown>; credentials?: Record<string, unknown> } = {}
+) =>
+ ({
+ destination: "github",
+ destinationConfig,
+ syncOptions,
+ environment: { slug: "dev" },
+ connection: { method: "pat", credentials, gatewayId: null, gatewayPoolId: null }
+ }) as any;
+
+const makePayload = (keys: string[]) =>
+ ({
+ flatten: () => Object.fromEntries(keys.map((key) => [key, { value: `value-of-${key}` }]))
+ }) as any;
+
+const gatewayV2Service = {} as any;
+const gatewayPoolService = { resolveEffectiveGatewayId: vi.fn(async ({ gatewayId }) => gatewayId ?? null) } as any;
+const gitHubAppDeps = {} as any;
+
+const runSync = (secretSync: any, payload: any) =>
+ GithubSyncFns.syncSecrets(secretSync, payload, gatewayV2Service, gatewayPoolService, gitHubAppDeps);
+
+const httpError = (status: number, { headers = {}, data = {} }: { headers?: any; data?: any } = {}) =>
+ new AxiosError("Request failed", undefined, undefined, undefined, {
+ status,
+ statusText: "",
+ headers,
+ data,
+ config: {} as any
+ });
+
+const callsWith = (method: string) =>
+ requestMock.mock.calls.map(([, , config]) => config).filter((c) => c.method === method);
+
+let keyPair: { publicKey: Uint8Array; privateKey: Uint8Array };
+
+beforeAll(async () => {
+ await sodium.ready;
+ keyPair = sodium.crypto_box_keypair();
+});
+
+beforeEach(() => {
+ requestMock.mockReset();
+ paginatedMock.mockReset();
+ decryptMock.mockReset();
+ paginatedMock.mockResolvedValue([]);
+ requestMock.mockImplementation(async (_gateway: unknown, _service: unknown, config: any) => {
+ if (config.method === "GET" && config.url.endsWith("/public-key")) {
+ return { data: { key_id: "key-1", key: sodium.to_base64(keyPair.publicKey, sodium.base64_variants.ORIGINAL) } };
+ }
+ return { data: {} };
+ });
+});
+
+describe("getGitHubSecretsBasePath", () => {
+ it.each([
+ [GitHubSyncSecretType.Actions, "/repos/acme/app/actions/secrets", "/orgs/acme/actions/secrets"],
+ [GitHubSyncSecretType.Dependabot, "/repos/acme/app/dependabot/secrets", "/orgs/acme/dependabot/secrets"],
+ [GitHubSyncSecretType.Codespaces, "/repos/acme/app/codespaces/secrets", "/orgs/acme/codespaces/secrets"]
+ ])("builds the %s paths for repository and organization scope", (secretType, repoPath, orgPath) => {
+ expect(getGitHubSecretsBasePath(repoConfig(secretType))).toBe(repoPath);
+ expect(getGitHubSecretsBasePath(orgConfig(secretType))).toBe(orgPath);
+ });
+
+ it("treats a config saved before secretType existed as Actions", () => {
+ expect(getGitHubSecretsBasePath(repoConfig(undefined))).toBe("/repos/acme/app/actions/secrets");
+ });
+
+ it("builds the environment path for Actions", () => {
+ expect(
+ getGitHubSecretsBasePath({
+ scope: GitHubSyncScope.RepositoryEnvironment,
+ owner: "acme",
+ repo: "app",
+ env: "prod",
+ secretType: GitHubSyncSecretType.Actions
+ })
+ ).toBe("/repos/acme/app/environments/prod/secrets");
+ });
+
+ it.each([GitHubSyncSecretType.Dependabot, GitHubSyncSecretType.Codespaces])(
+ "refuses the environment scope for %s without retrying",
+ (secretType) => {
+ const build = () =>
+ getGitHubSecretsBasePath({
+ scope: GitHubSyncScope.RepositoryEnvironment,
+ owner: "acme",
+ repo: "app",
+ env: "prod",
+ secretType
+ });
+
+ expect(build).toThrow(SecretSyncError);
+ expect(build).toThrow(/cannot be synced to a repository environment/);
+ }
+ );
+
+ it("encodes every path segment", () => {
+ expect(
+ getGitHubSecretsBasePath({
+ scope: GitHubSyncScope.Repository,
+ owner: "a b",
+ repo: "c/d",
+ secretType: GitHubSyncSecretType.Dependabot
+ })
+ ).toBe("/repos/a%20b/c%2Fd/dependabot/secrets");
+ });
+});
+
+describe("GithubSyncFns.syncSecrets", () => {
+ it("writes Dependabot secrets that decrypt to the original value, fetching the public key once", async () => {
+ await runSync(makeSync(repoConfig(GitHubSyncSecretType.Dependabot)), makePayload(["DB_URL", "API_KEY"]));
+
+ expect(paginatedMock).toHaveBeenCalledTimes(1);
+ expect(paginatedMock.mock.calls[0][3]).toBe("/repos/acme/app/dependabot/secrets");
+
+ const publicKeyCalls = callsWith("GET");
+ expect(publicKeyCalls).toHaveLength(1);
+ expect(publicKeyCalls[0].url).toBe("https://api.github.com/repos/acme/app/dependabot/secrets/public-key");
+
+ const puts = callsWith("PUT");
+ expect(puts.map((c) => c.url)).toEqual([
+ "https://api.github.com/repos/acme/app/dependabot/secrets/DB_URL",
+ "https://api.github.com/repos/acme/app/dependabot/secrets/API_KEY"
+ ]);
+ expect(puts[0].data).toEqual({ secret_name: "DB_URL", key_id: "key-1", encrypted_value: expect.any(String) });
+
+ const sealed = sodium.from_base64(puts[0].data.encrypted_value, sodium.base64_variants.ORIGINAL);
+ const opened = sodium.crypto_box_seal_open(sealed, keyPair.publicKey, keyPair.privateKey);
+ expect(sodium.to_string(opened)).toBe("value-of-DB_URL");
+ });
+
+ it("sends the organization visibility and selected repositories for Codespaces", async () => {
+ await runSync(
+ makeSync(
+ orgConfig(GitHubSyncSecretType.Codespaces, {
+ visibility: GitHubSyncVisibility.Selected,
+ selectedRepositoryIds: [11, 22]
+ })
+ ),
+ makePayload(["TOKEN"])
+ );
+
+ const [put] = callsWith("PUT");
+ expect(put.url).toBe("https://api.github.com/orgs/acme/codespaces/secrets/TOKEN");
+ expect(put.data).toMatchObject({ visibility: "selected", selected_repository_ids: [11, 22] });
+ });
+
+ it("keeps syncing a config saved before secretType existed to Actions", async () => {
+ await runSync(makeSync(repoConfig(undefined)), makePayload(["A"]));
+
+ expect(callsWith("PUT")[0].url).toBe("https://api.github.com/repos/acme/app/actions/secrets/A");
+ });
+
+ it("deletes only stale secrets that match the key schema", async () => {
+ paginatedMock.mockResolvedValue([{ name: "INFISICAL_A" }, { name: "INFISICAL_STALE" }, { name: "SOMEONE_ELSES" }]);
+
+ await runSync(
+ makeSync(repoConfig(GitHubSyncSecretType.Codespaces), { syncOptions: { keySchema: "INFISICAL_{{secretKey}}" } }),
+ makePayload(["INFISICAL_A"])
+ );
+
+ expect(callsWith("DELETE").map((c) => c.url)).toEqual([
+ "https://api.github.com/repos/acme/app/codespaces/secrets/INFISICAL_STALE"
+ ]);
+ });
+
+ it("deletes nothing when secret deletion is disabled", async () => {
+ paginatedMock.mockResolvedValue([{ name: "STALE" }]);
+
+ await runSync(
+ makeSync(repoConfig(GitHubSyncSecretType.Dependabot), { syncOptions: { disableSecretDeletion: true } }),
+ makePayload(["A"])
+ );
+
+ expect(callsWith("DELETE")).toHaveLength(0);
+ });
+
+ it("refuses Codespaces on GitHub Enterprise Server before calling GitHub", async () => {
+ const sync = makeSync(repoConfig(GitHubSyncSecretType.Codespaces), {
+ credentials: { personalAccessToken: "token", instanceType: "server", host: "github.example.com" }
+ });
+
+ await expect(runSync(sync, makePayload(["A"]))).rejects.toMatchObject({
+ shouldRetry: false,
+ message: expect.stringContaining("not available on GitHub Enterprise Server")
+ });
+ expect(requestMock).not.toHaveBeenCalled();
+ expect(paginatedMock).not.toHaveBeenCalled();
+ });
+
+ it("allows Dependabot on GitHub Enterprise Server", async () => {
+ const sync = makeSync(repoConfig(GitHubSyncSecretType.Dependabot), {
+ credentials: { personalAccessToken: "token", instanceType: "server", host: "github.example.com" }
+ });
+
+ await runSync(sync, makePayload(["A"]));
+
+ expect(callsWith("PUT")[0].url).toBe("https://github.example.com/api/v3/repos/acme/app/dependabot/secrets/A");
+ });
+
+ it.each([
+ [orgConfig(GitHubSyncSecretType.Codespaces), 101, "more than 100 Codespaces secrets at the organization level"],
+ [repoConfig(GitHubSyncSecretType.Dependabot), 101, "more than 100 Dependabot secrets at the repository level"],
+ [orgConfig(GitHubSyncSecretType.Actions), 1001, "more than 1,000 Actions secrets at the organization level"]
+ ])("enforces the per-type secret limit (%#)", async (config, count, message) => {
+ const keys = Array.from({ length: count }, (_, i) => `KEY_${i}`);
+
+ await expect(runSync(makeSync(config), makePayload(keys))).rejects.toMatchObject({
+ shouldRetry: false,
+ message: expect.stringContaining(message)
+ });
+ });
+
+ it("allows 1,000 Dependabot secrets at the organization level", async () => {
+ const keys = Array.from({ length: 1000 }, (_, i) => `KEY_${i}`);
+
+ await runSync(makeSync(orgConfig(GitHubSyncSecretType.Dependabot)), makePayload(keys));
+
+ expect(callsWith("PUT")).toHaveLength(1000);
+ });
+});
+
+describe("GitHub permission errors", () => {
+ it("names the missing repository permission for the secret type and stops retrying", async () => {
+ requestMock.mockRejectedValueOnce(httpError(403, { data: { message: "Resource not accessible by integration" } }));
+
+ const error = await runSync(makeSync(repoConfig(GitHubSyncSecretType.Dependabot)), makePayload(["A"])).catch(
+ (err: unknown) => err
+ );
+
+ expect(error).toBeInstanceOf(SecretSyncError);
+ expect(error).toMatchObject({ shouldRetry: false });
+ expect((error as SecretSyncError).message).toContain(
+ "lacks the 'Dependabot secrets' repository permission for repository 'acme/app'"
+ );
+ expect((error as SecretSyncError).message).toContain("'repo' scope");
+ });
+
+ it("names the organization permission and the admin:org scope at organization scope", async () => {
+ paginatedMock.mockRejectedValueOnce(httpError(403));
+
+ await expect(
+ runSync(makeSync(orgConfig(GitHubSyncSecretType.Codespaces)), makePayload(["A"]))
+ ).rejects.toMatchObject({
+ shouldRetry: false,
+ message: expect.stringMatching(
+ /lacks the 'Organization codespaces secrets' organization permission for organization 'acme'.*'admin:org' scope/
+ )
+ });
+ });
+
+ it("names both permissions an Actions environment sync needs", async () => {
+ paginatedMock.mockRejectedValueOnce(httpError(403));
+ const environmentConfig = {
+ scope: GitHubSyncScope.RepositoryEnvironment,
+ owner: "acme",
+ repo: "app",
+ env: "prod",
+ secretType: GitHubSyncSecretType.Actions
+ };
+
+ await expect(runSync(makeSync(environmentConfig), makePayload(["A"]))).rejects.toMatchObject({
+ shouldRetry: false,
+ message: expect.stringContaining(
+ "lacks the 'Secrets' and 'Environments' repository permissions for environment 'prod' in repository 'acme/app'"
+ )
+ });
+ });
+
+ it("reports a 404 as a missing target or permission", async () => {
+ paginatedMock.mockRejectedValueOnce(httpError(404));
+
+ await expect(
+ runSync(makeSync(repoConfig(GitHubSyncSecretType.Codespaces)), makePayload(["A"]))
+ ).rejects.toMatchObject({
+ shouldRetry: false,
+ message: expect.stringContaining(
+ "GitHub could not find the Codespaces secrets for repository 'acme/app'. Check that the repository exists"
+ )
+ });
+ });
+
+ it("names the permission when a write is refused, rather than blaming the secret", async () => {
+ requestMock.mockImplementation(async (_gateway: unknown, _service: unknown, config: any) => {
+ if (config.method === "PUT") throw httpError(403);
+ return { data: { key_id: "key-1", key: sodium.to_base64(keyPair.publicKey, sodium.base64_variants.ORIGINAL) } };
+ });
+
+ await expect(
+ runSync(makeSync(repoConfig(GitHubSyncSecretType.Codespaces)), makePayload(["A"]))
+ ).rejects.toMatchObject({
+ shouldRetry: false,
+ secretKey: undefined,
+ message: expect.stringContaining("'Codespaces secrets' repository permission")
+ });
+ });
+
+ it("keeps reporting other write failures against the secret, and retries them", async () => {
+ requestMock.mockImplementation(async (_gateway: unknown, _service: unknown, config: any) => {
+ if (config.method === "PUT") throw httpError(500);
+ return { data: { key_id: "key-1", key: sodium.to_base64(keyPair.publicKey, sodium.base64_variants.ORIGINAL) } };
+ });
+
+ await expect(
+ runSync(makeSync(repoConfig(GitHubSyncSecretType.Dependabot)), makePayload(["A"]))
+ ).rejects.toMatchObject({ shouldRetry: true, secretKey: "A" });
+ });
+
+ it.each([
+ ["an exhausted rate limit", { headers: { "x-ratelimit-remaining": "0" } }],
+ ["a secondary rate limit", { headers: { "retry-after": "60" } }],
+ ["a rate limit message", { data: { message: "You have exceeded a secondary rate limit" } }]
+ ])("leaves %s as a retryable error", async (_label, response) => {
+ const rateLimited = httpError(403, response);
+ paginatedMock.mockRejectedValueOnce(rateLimited);
+
+ await expect(runSync(makeSync(repoConfig(GitHubSyncSecretType.Dependabot)), makePayload(["A"]))).rejects.toBe(
+ rateLimited
+ );
+ });
+});
+
+describe("GithubSyncFns.removeSecrets", () => {
+ it("deletes only the synced secrets from the Dependabot endpoints", async () => {
+ paginatedMock.mockResolvedValue([{ name: "A" }, { name: "B" }, { name: "OTHER" }]);
+
+ await GithubSyncFns.removeSecrets(
+ makeSync(orgConfig(GitHubSyncSecretType.Dependabot)),
+ makePayload(["A", "B"]),
+ gatewayV2Service,
+ gatewayPoolService,
+ gitHubAppDeps
+ );
+
+ expect(paginatedMock.mock.calls[0][3]).toBe("/orgs/acme/dependabot/secrets");
+ expect(callsWith("DELETE").map((c) => c.url)).toEqual([
+ "https://api.github.com/orgs/acme/dependabot/secrets/A",
+ "https://api.github.com/orgs/acme/dependabot/secrets/B"
+ ]);
+ });
+});
+
+describe("gitHubPreSaveTransformDestinationConfig", () => {
+ const appConnectionDAL = {
+ findById: vi.fn(async () => ({ orgId: "org", projectId: null, encryptedCredentials: Buffer.from("") }))
+ } as any;
+ const deps = { appConnectionDAL, kmsService: {} as any, secretV2BridgeDAL: {} as any };
+
+ it("leaves non-Codespaces configs alone without reading the connection", async () => {
+ const destinationConfig = repoConfig(GitHubSyncSecretType.Dependabot);
+
+ await expect(
+ gitHubPreSaveTransformDestinationConfig({ destinationConfig, connectionId: "conn" }, deps)
+ ).resolves.toBe(destinationConfig);
+ expect(decryptMock).not.toHaveBeenCalled();
+ });
+
+ it("rejects Codespaces for a GitHub Enterprise Server connection", async () => {
+ decryptMock.mockResolvedValue({ personalAccessToken: "token", instanceType: "server", host: "github.example.com" });
+
+ await expect(
+ gitHubPreSaveTransformDestinationConfig(
+ { destinationConfig: repoConfig(GitHubSyncSecretType.Codespaces), connectionId: "conn" },
+ deps
+ )
+ ).rejects.toThrow(BadRequestError);
+ });
+
+ it("allows Codespaces for a GitHub.com connection", async () => {
+ decryptMock.mockResolvedValue({ personalAccessToken: "token", instanceType: "cloud" });
+ const destinationConfig = orgConfig(GitHubSyncSecretType.Codespaces);
+
+ await expect(
+ gitHubPreSaveTransformDestinationConfig({ destinationConfig, connectionId: "conn" }, deps)
+ ).resolves.toBe(destinationConfig);
+ });
+
+ it("checks the stored config when an update only changes the connection", async () => {
+ decryptMock.mockResolvedValue({ personalAccessToken: "token", instanceType: "server", host: "github.example.com" });
+
+ await expect(
+ gitHubPreSaveTransformDestinationConfig(
+ {
+ destinationConfig: undefined,
+ existingDestinationConfig: repoConfig(GitHubSyncSecretType.Codespaces),
+ connectionId: "conn"
+ },
+ deps
+ )
+ ).rejects.toThrow(/not available on GitHub Enterprise Server/);
+ });
+});
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 3c7c7dbda1..32f3deaeaa 100644
--- a/backend/src/services/secret-sync/github/github-sync-fns.ts
+++ b/backend/src/services/secret-sync/github/github-sync-fns.ts
@@ -1,7 +1,10 @@
+import { AxiosError, isAxiosError } from "axios";
import sodium from "libsodium-wrappers";
import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";
import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";
+import { BadRequestError, NotFoundError } from "@app/lib/errors";
+import { decryptAppConnectionCredentials } from "@app/services/app-connection/app-connection-fns";
import {
getGitHubAppAuthToken,
getGitHubGatewayConnectionDetails,
@@ -9,77 +12,150 @@ import {
GitHubConnectionMethod,
makePaginatedGitHubRequest,
requestWithGitHubGateway,
- TGitHubAppCredentialResolverDeps
+ TGitHubAppCredentialResolverDeps,
+ TGitHubConnection
} from "@app/services/app-connection/github";
-import { GitHubSyncScope, GitHubSyncVisibility } from "@app/services/secret-sync/github/github-sync-enums";
+import {
+ GitHubSyncScope,
+ GitHubSyncSecretType,
+ GitHubSyncVisibility
+} from "@app/services/secret-sync/github/github-sync-enums";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { SECRET_SYNC_NAME_MAP } from "@app/services/secret-sync/secret-sync-maps";
import { TSecretSyncPayload } from "@app/services/secret-sync/secret-sync-payload";
+import { TPreSaveTransformDestinationConfigFn } from "@app/services/secret-sync/secret-sync-types";
import { TGitHubPublicKey, TGitHubSecret, TGitHubSecretPayload, TGitHubSyncWithCredentials } from "./github-sync-types";
-// TODO: rate limit handling
+type TGitHubSyncDestinationConfig = TGitHubSyncWithCredentials["destinationConfig"];
-const getEncryptedSecrets = async (
- secretSync: TGitHubSyncWithCredentials,
- gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">,
- gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">,
- gitHubAppDeps: TGitHubAppCredentialResolverDeps
-) => {
- const { destinationConfig, connection } = secretSync;
+type TGitHubSyncDeps = {
+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;
+ gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;
+};
+
+type TGitHubOrgOrRepoValues = { organization: string; repository: string };
+
+type TGitHubSecretTypeDefinition = {
+ name: string;
+ pathSegment: string;
+ permission: TGitHubOrgOrRepoValues;
+ limit: Record<keyof TGitHubOrgOrRepoValues, number>;
+};
+
+const GITHUB_SECRET_TYPES: Record<GitHubSyncSecretType, TGitHubSecretTypeDefinition> = {
+ [GitHubSyncSecretType.Actions]: {
+ name: "Actions",
+ pathSegment: "actions",
+ permission: { organization: "Secrets", repository: "Secrets" },
+ limit: { organization: 1000, repository: 100 }
+ },
+ // GitHub publishes no Dependabot-specific limits, so these mirror the Actions limits
+ [GitHubSyncSecretType.Dependabot]: {
+ name: "Dependabot",
+ pathSegment: "dependabot",
+ permission: { organization: "Organization dependabot secrets", repository: "Dependabot secrets" },
+ limit: { organization: 1000, repository: 100 }
+ },
+ [GitHubSyncSecretType.Codespaces]: {
+ name: "Codespaces",
+ pathSegment: "codespaces",
+ permission: { organization: "Organization codespaces secrets", repository: "Codespaces secrets" },
+ limit: { organization: 100, repository: 100 }
+ }
+};
+
+const CODESPACES_ON_GITHUB_SERVER_MESSAGE =
+ "Codespaces secrets are not available on GitHub Enterprise Server. Choose the Actions or Dependabot secret type, or use a GitHub.com connection.";
+
+// actions is the default for legacy syncs
+export const getGitHubSyncSecretType = (destinationConfig: { secretType?: GitHubSyncSecretType }) =>
+ destinationConfig.secretType ?? GitHubSyncSecretType.Actions;
+
+const isGitHubServerConnection = (credentials: { instanceType?: string | null }) =>
+ credentials.instanceType === "server";
+
+export const getGitHubSecretsBasePath = (destinationConfig: TGitHubSyncDestinationConfig) => {
+ const secretType = getGitHubSyncSecretType(destinationConfig);
+ const { name, pathSegment } = GITHUB_SECRET_TYPES[secretType];
- let path: string;
switch (destinationConfig.scope) {
- case GitHubSyncScope.Organization: {
- path = `/orgs/${encodeURIComponent(destinationConfig.org)}/actions/secrets`;
- break;
- }
- case GitHubSyncScope.Repository: {
- path = `/repos/${encodeURIComponent(destinationConfig.owner)}/${encodeURIComponent(destinationConfig.repo)}/actions/secrets`;
- break;
- }
+ case GitHubSyncScope.Organization:
+ return `/orgs/${encodeURIComponent(destinationConfig.org)}/${pathSegment}/secrets`;
+ case GitHubSyncScope.Repository:
+ return `/repos/${encodeURIComponent(destinationConfig.owner)}/${encodeURIComponent(destinationConfig.repo)}/${pathSegment}/secrets`;
case GitHubSyncScope.RepositoryEnvironment:
- default: {
- path = `/repos/${encodeURIComponent(destinationConfig.owner)}/${encodeURIComponent(destinationConfig.repo)}/environments/${encodeURIComponent(destinationConfig.env)}/secrets`;
- break;
- }
+ if (secretType !== GitHubSyncSecretType.Actions) {
+ throw new SecretSyncError({
+ message: `GitHub ${name} secrets cannot be synced to a repository environment. Use the Repository or Organization scope instead.`,
+ shouldRetry: false
+ });
+ }
+ return `/repos/${encodeURIComponent(destinationConfig.owner)}/${encodeURIComponent(destinationConfig.repo)}/environments/${encodeURIComponent(destinationConfig.env)}/secrets`;
+ default:
+ throw new SecretSyncError({
+ message: `Unsupported GitHub Sync scope ${(destinationConfig as TGitHubSyncDestinationConfig).scope}`,
+ shouldRetry: false
+ });
}
-
- return makePaginatedGitHubRequest<TGitHubSecret, { secrets: TGitHubSecret[] }>(
- connection,
- gatewayV2Service,
- gatewayPoolService,
- path,
- gitHubAppDeps,
- (data) => data.secrets
- );
};
-const getPublicKey = async (
- secretSync: TGitHubSyncWithCredentials,
- gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">,
- gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">,
- token: string
-) => {
- const { destinationConfig, connection } = secretSync;
-
- let path: string;
+const describeGitHubSecretsTarget = (destinationConfig: TGitHubSyncDestinationConfig) => {
switch (destinationConfig.scope) {
- case GitHubSyncScope.Organization: {
- path = `/orgs/${encodeURIComponent(destinationConfig.org)}/actions/secrets/public-key`;
- break;
- }
- case GitHubSyncScope.Repository: {
- path = `/repos/${encodeURIComponent(destinationConfig.owner)}/${encodeURIComponent(destinationConfig.repo)}/actions/secrets/public-key`;
- break;
- }
+ case GitHubSyncScope.Organization:
+ return {
+ target: `organization '${destinationConfig.org}'`,
+ missing: "the organization exists"
+ };
case GitHubSyncScope.RepositoryEnvironment:
- default: {
- path = `/repos/${encodeURIComponent(destinationConfig.owner)}/${encodeURIComponent(destinationConfig.repo)}/environments/${encodeURIComponent(destinationConfig.env)}/secrets/public-key`;
- break;
- }
+ return {
+ target: `environment '${destinationConfig.env}' in repository '${destinationConfig.owner}/${destinationConfig.repo}'`,
+ missing: "the repository and environment exist"
+ };
+ case GitHubSyncScope.Repository:
+ default:
+ return {
+ target: `repository '${destinationConfig.owner}/${destinationConfig.repo}'`,
+ missing: "the repository exists"
+ };
}
+};
+
+const isGitHubRateLimitError = (error: AxiosError) => {
+ const headers = error.response?.headers;
+ if (headers?.["x-ratelimit-remaining"] === "0" || headers?.["retry-after"]) return true;
+
+ const message = (error.response?.data as { message?: unknown } | undefined)?.message;
+ return typeof message === "string" && message.toLowerCase().includes("rate limit");
+};
+
+export const toGitHubSecretsError = (error: unknown, destinationConfig: TGitHubSyncDestinationConfig) => {
+ if (!isAxiosError(error) || !error.response) return error;
+
+ const { status } = error.response;
+ if (status !== 403 && status !== 404) return error;
+ if (status === 403 && isGitHubRateLimitError(error)) return error;
+
+ const { name } = GITHUB_SECRET_TYPES[getGitHubSyncSecretType(destinationConfig)];
+ const { target, missing } = describeGitHubSecretsTarget(destinationConfig);
+ const classicScope = destinationConfig.scope === GitHubSyncScope.Organization ? "admin:org" : "repo";
+
+ const message =
+ status === 403
+ ? `The GitHub connection lacks permissions to access ${target}. Grant read and write access on the GitHub App or fine-grained token, or use the '${classicScope}' scope for OAuth and classic tokens. An owner of a GitHub App installation must also approve newly requested permissions.`
+ : `GitHub could not find the ${name} secrets for ${target}. Check that ${missing} and that the GitHub connection has the permissions to access it.`;
+
+ return new SecretSyncError({ error, message, shouldRetry: false });
+};
+
+const requestGitHubSecretsApi = async <T>(
+ secretSync: TGitHubSyncWithCredentials,
+ { gatewayV2Service, gatewayPoolService }: TGitHubSyncDeps,
+ token: string,
+ { method, path = "", data }: { method: "GET" | "PUT" | "DELETE"; path?: string; data?: Record<string, unknown> }
+) => {
+ const { connection, destinationConfig } = secretSync;
const apiBaseUrl = await getGitHubInstanceApiUrl(connection);
const effectiveGatewayId = await gatewayPoolService.resolveEffectiveGatewayId({
@@ -90,135 +166,153 @@ const getPublicKey = async (
? await getGitHubGatewayConnectionDetails(effectiveGatewayId, apiBaseUrl, gatewayV2Service)
: undefined;
- const response = await requestWithGitHubGateway<TGitHubPublicKey>(
- { gatewayId: effectiveGatewayId },
- gatewayV2Service,
- {
- url: `https://${apiBaseUrl}${path}`,
- method: "GET",
- headers: {
- Accept: "application/vnd.github+json",
- Authorization: `Bearer ${token}`,
- "X-GitHub-Api-Version": "2022-11-28"
- }
- },
- gatewayConnectionDetails
- );
+ try {
+ const response = await requestWithGitHubGateway<T>(
+ { gatewayId: effectiveGatewayId },
+ gatewayV2Service,
+ {
+ url: `https://${apiBaseUrl}${getGitHubSecretsBasePath(destinationConfig)}${path}`,
+ method,
+ headers: {
+ Accept: "application/vnd.github+json",
+ Authorization: `Bearer ${token}`,
+ "X-GitHub-Api-Version": "2022-11-28"
+ },
+ ...(data && { data })
+ },
+ gatewayConnectionDetails
+ );
- return response.data;
+ return response.data;
+ } catch (error) {
+ throw toGitHubSecretsError(error, destinationConfig);
+ }
};
-const deleteSecret = async (
+const getEncryptedSecrets = async (
secretSync: TGitHubSyncWithCredentials,
- gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">,
- gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">,
- token: string,
- encryptedSecret: TGitHubSecret
+ { gatewayV2Service, gatewayPoolService }: TGitHubSyncDeps,
+ gitHubAppDeps: TGitHubAppCredentialResolverDeps
) => {
const { destinationConfig, connection } = secretSync;
- let path: string;
- switch (destinationConfig.scope) {
- case GitHubSyncScope.Organization: {
- path = `/orgs/${encodeURIComponent(destinationConfig.org)}/actions/secrets/${encodeURIComponent(encryptedSecret.name)}`;
- break;
- }
- case GitHubSyncScope.Repository: {
- path = `/repos/${encodeURIComponent(destinationConfig.owner)}/${encodeURIComponent(destinationConfig.repo)}/actions/secrets/${encodeURIComponent(encryptedSecret.name)}`;
- break;
- }
- case GitHubSyncScope.RepositoryEnvironment:
- default: {
- path = `/repos/${encodeURIComponent(destinationConfig.owner)}/${encodeURIComponent(destinationConfig.repo)}/environments/${encodeURIComponent(destinationConfig.env)}/secrets/${encodeURIComponent(encryptedSecret.name)}`;
- break;
- }
+ try {
+ return await makePaginatedGitHubRequest<TGitHubSecret, { secrets: TGitHubSecret[] }>(
+ connection,
+ gatewayV2Service,
+ gatewayPoolService,
+ getGitHubSecretsBasePath(destinationConfig),
+ gitHubAppDeps,
+ (data) => data.secrets
+ );
+ } catch (error) {
+ throw toGitHubSecretsError(error, destinationConfig);
}
+};
- const apiBaseUrl = await getGitHubInstanceApiUrl(connection);
- const effectiveGatewayId = await gatewayPoolService.resolveEffectiveGatewayId({
- gatewayId: connection.gatewayId,
- gatewayPoolId: connection.gatewayPoolId
+const getPublicKey = (secretSync: TGitHubSyncWithCredentials, deps: TGitHubSyncDeps, token: string) =>
+ requestGitHubSecretsApi<TGitHubPublicKey>(secretSync, deps, token, {
+ method: "GET",
+ path: "/public-key"
});
- const gatewayConnectionDetails = effectiveGatewayId
- ? await getGitHubGatewayConnectionDetails(effectiveGatewayId, apiBaseUrl, gatewayV2Service)
- : undefined;
- await requestWithGitHubGateway(
- { gatewayId: effectiveGatewayId },
- gatewayV2Service,
- {
- url: `https://${apiBaseUrl}${path}`,
- method: "DELETE",
- headers: {
- Accept: "application/vnd.github+json",
- Authorization: `Bearer ${token}`,
- "X-GitHub-Api-Version": "2022-11-28"
- }
- },
- gatewayConnectionDetails
- );
-};
+const deleteSecret = (
+ secretSync: TGitHubSyncWithCredentials,
+ deps: TGitHubSyncDeps,
+ token: string,
+ encryptedSecret: TGitHubSecret
+) =>
+ requestGitHubSecretsApi(secretSync, deps, token, {
+ method: "DELETE",
+ path: `/${encodeURIComponent(encryptedSecret.name)}`
+ });
-const putSecret = async (
+const putSecret = (
secretSync: TGitHubSyncWithCredentials,
- gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">,
- gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">,
+ deps: TGitHubSyncDeps,
token: string,
payload: TGitHubSecretPayload
) => {
- const { destinationConfig, connection } = secretSync;
+ const { destinationConfig } = secretSync;
+
+ let body: Record<string, string | number[] | undefined> = payload;
+
+ if (destinationConfig.scope === GitHubSyncScope.Organization) {
+ const { visibility, selectedRepositoryIds } = destinationConfig;
+ body = {
+ ...payload,
+ visibility,
+ ...(visibility === GitHubSyncVisibility.Selected && {
+ selected_repository_ids: selectedRepositoryIds
+ })
+ };
+ }
- let path: string;
- let body: Record<string, string | number[]> = payload;
+ return requestGitHubSecretsApi(secretSync, deps, token, {
+ method: "PUT",
+ path: `/${encodeURIComponent(payload.secret_name)}`,
+ data: body
+ });
+};
- switch (destinationConfig.scope) {
- case GitHubSyncScope.Organization: {
- const { visibility, selectedRepositoryIds } = destinationConfig;
- path = `/orgs/${encodeURIComponent(destinationConfig.org)}/actions/secrets/${encodeURIComponent(payload.secret_name)}`;
- body = {
- ...payload,
- visibility,
- ...(visibility === GitHubSyncVisibility.Selected && {
- selected_repository_ids: selectedRepositoryIds
- })
- };
- break;
- }
- case GitHubSyncScope.Repository: {
- path = `/repos/${encodeURIComponent(destinationConfig.owner)}/${encodeURIComponent(destinationConfig.repo)}/actions/secrets/${encodeURIComponent(payload.secret_name)}`;
- break;
- }
- case GitHubSyncScope.RepositoryEnvironment:
- default: {
- path = `/repos/${encodeURIComponent(destinationConfig.owner)}/${encodeURIComponent(destinationConfig.repo)}/environments/${encodeURIComponent(destinationConfig.env)}/secrets/${encodeURIComponent(payload.secret_name)}`;
- break;
- }
+const resolveGitHubSyncConnection = async (
+ secretSync: TGitHubSyncWithCredentials,
+ { gatewayV2Service, gatewayPoolService }: TGitHubSyncDeps,
+ gitHubAppDeps: TGitHubAppCredentialResolverDeps
+) => {
+ const { connection: rawConnection } = secretSync;
+
+ if (
+ getGitHubSyncSecretType(secretSync.destinationConfig) === GitHubSyncSecretType.Codespaces &&
+ isGitHubServerConnection(rawConnection.credentials)
+ ) {
+ throw new SecretSyncError({ message: CODESPACES_ON_GITHUB_SERVER_MESSAGE, shouldRetry: false });
}
- const apiBaseUrl = await getGitHubInstanceApiUrl(connection);
const effectiveGatewayId = await gatewayPoolService.resolveEffectiveGatewayId({
- gatewayId: connection.gatewayId,
- gatewayPoolId: connection.gatewayPoolId
+ gatewayId: rawConnection.gatewayId,
+ gatewayPoolId: rawConnection.gatewayPoolId
});
- const gatewayConnectionDetails = effectiveGatewayId
- ? await getGitHubGatewayConnectionDetails(effectiveGatewayId, apiBaseUrl, gatewayV2Service)
- : undefined;
+ const connection = { ...rawConnection, gatewayId: effectiveGatewayId, gatewayPoolId: null };
+ let token: string;
- await requestWithGitHubGateway(
- { gatewayId: effectiveGatewayId },
- gatewayV2Service,
- {
- url: `https://${apiBaseUrl}${path}`,
- method: "PUT",
- headers: {
- Accept: "application/vnd.github+json",
- Authorization: `Bearer ${token}`,
- "X-GitHub-Api-Version": "2022-11-28"
- },
- data: body
- },
- gatewayConnectionDetails
- );
+ switch (connection.method) {
+ case GitHubConnectionMethod.OAuth:
+ token = connection.credentials.accessToken;
+ break;
+ case GitHubConnectionMethod.Pat:
+ token = connection.credentials.personalAccessToken;
+ break;
+ default:
+ token = await getGitHubAppAuthToken(connection, gatewayV2Service, gatewayPoolService, gitHubAppDeps);
+ }
+
+ return { resolvedSync: { ...secretSync, connection }, token };
+};
+
+export const gitHubPreSaveTransformDestinationConfig: TPreSaveTransformDestinationConfigFn = async (
+ { destinationConfig, existingDestinationConfig, connectionId },
+ { appConnectionDAL, kmsService }
+) => {
+ // An update that only changes the connection still has to be checked against the stored config
+ const effectiveDestinationConfig = destinationConfig ?? existingDestinationConfig;
+ if (effectiveDestinationConfig?.secretType !== GitHubSyncSecretType.Codespaces) return destinationConfig;
+
+ const appConnection = await appConnectionDAL.findById(connectionId);
+ if (!appConnection) throw new NotFoundError({ message: `Connection with ID '${connectionId}' not found` });
+
+ const credentials = (await decryptAppConnectionCredentials({
+ orgId: appConnection.orgId,
+ encryptedCredentials: appConnection.encryptedCredentials,
+ kmsService,
+ projectId: appConnection.projectId
+ })) as TGitHubConnection["credentials"];
+
+ if (isGitHubServerConnection(credentials)) {
+ throw new BadRequestError({ message: CODESPACES_ON_GITHUB_SERVER_MESSAGE });
+ }
+
+ return destinationConfig;
};
export const GithubSyncFns = {
@@ -229,66 +323,29 @@ export const GithubSyncFns = {
gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">,
gitHubAppDeps: TGitHubAppCredentialResolverDeps
) => {
+ const deps = { gatewayV2Service, gatewayPoolService };
const ogSecretMap = payload.flatten();
const secretMap = Object.fromEntries(Object.entries(ogSecretMap).map(([i, v]) => [i.toUpperCase(), v]));
- switch (secretSync.destinationConfig.scope) {
- case GitHubSyncScope.Organization:
- if (Object.values(secretMap).length > 1000) {
- throw new SecretSyncError({
- message: "GitHub does not support storing more than 1,000 secrets at the organization level.",
- shouldRetry: false
- });
- }
- break;
- case GitHubSyncScope.Repository:
- case GitHubSyncScope.RepositoryEnvironment:
- if (Object.values(secretMap).length > 100) {
- throw new SecretSyncError({
- message: "GitHub does not support storing more than 100 secrets at the repository level.",
- shouldRetry: false
- });
- }
- break;
- default:
- throw new Error(
- `Unsupported GitHub Sync scope ${
- (secretSync.destinationConfig as TGitHubSyncWithCredentials["destinationConfig"]).scope
- }`
- );
- }
+ const { name: secretTypeName, limit } = GITHUB_SECRET_TYPES[getGitHubSyncSecretType(secretSync.destinationConfig)];
+ const level = secretSync.destinationConfig.scope === GitHubSyncScope.Organization ? "organization" : "repository";
- const { connection: rawConnection } = secretSync;
- const effectiveGatewayId = await gatewayPoolService.resolveEffectiveGatewayId({
- gatewayId: rawConnection.gatewayId,
- gatewayPoolId: rawConnection.gatewayPoolId
- });
- const connection = { ...rawConnection, gatewayId: effectiveGatewayId, gatewayPoolId: null };
- let token: string;
-
- switch (connection.method) {
- case GitHubConnectionMethod.OAuth:
- token = connection.credentials.accessToken;
- break;
- case GitHubConnectionMethod.Pat:
- token = connection.credentials.personalAccessToken;
- break;
- default:
- token = await getGitHubAppAuthToken(connection, gatewayV2Service, gatewayPoolService, gitHubAppDeps);
+ if (Object.values(secretMap).length > limit[level]) {
+ throw new SecretSyncError({
+ message: `GitHub does not support storing more than ${limit[level].toLocaleString("en-US")} ${secretTypeName} secrets at the ${level} level.`,
+ shouldRetry: false
+ });
}
- const resolvedSync = { ...secretSync, connection };
- const encryptedSecrets = await getEncryptedSecrets(
- resolvedSync,
- gatewayV2Service,
- gatewayPoolService,
- gitHubAppDeps
- );
- const publicKey = await getPublicKey(resolvedSync, gatewayV2Service, gatewayPoolService, token);
+ const { resolvedSync, token } = await resolveGitHubSyncConnection(secretSync, deps, gitHubAppDeps);
+
+ const encryptedSecrets = await getEncryptedSecrets(resolvedSync, deps, gitHubAppDeps);
+ const publicKey = await getPublicKey(resolvedSync, deps, token);
await sodium.ready;
+ const binaryKey = sodium.from_base64(publicKey.key, sodium.base64_variants.ORIGINAL);
+
for await (const key of Object.keys(secretMap)) {
- const binaryKey = sodium.from_base64(publicKey.key, sodium.base64_variants.ORIGINAL);
const binarySecretValue = sodium.from_string(secretMap[key].value);
const encryptedBytes = sodium.crypto_box_seal(binarySecretValue, binaryKey);
@@ -296,12 +353,14 @@ export const GithubSyncFns = {
const encryptedSecretValue = sodium.to_base64(encryptedBytes, sodium.base64_variants.ORIGINAL);
try {
- await putSecret(resolvedSync, gatewayV2Service, gatewayPoolService, token, {
+ await putSecret(resolvedSync, deps, token, {
secret_name: key,
encrypted_value: encryptedSecretValue,
key_id: publicKey.key_id
});
} catch (error) {
+ if (error instanceof SecretSyncError) throw error;
+
throw new SecretSyncError({
error,
secretKey: key
@@ -317,7 +376,7 @@ export const GithubSyncFns = {
continue;
if (!(encryptedSecret.name in secretMap)) {
- await deleteSecret(resolvedSync, gatewayV2Service, gatewayPoolService, token, encryptedSecret);
+ await deleteSecret(resolvedSync, deps, token, encryptedSecret);
}
}
},
@@ -331,39 +390,17 @@ export const GithubSyncFns = {
gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">,
gitHubAppDeps: TGitHubAppCredentialResolverDeps
) => {
+ const deps = { gatewayV2Service, gatewayPoolService };
const ogSecretMap = payload.flatten();
const secretMap = Object.fromEntries(Object.entries(ogSecretMap).map(([i, v]) => [i.toUpperCase(), v]));
- const { connection: rawConnection } = secretSync;
- const effectiveGatewayId = await gatewayPoolService.resolveEffectiveGatewayId({
- gatewayId: rawConnection.gatewayId,
- gatewayPoolId: rawConnection.gatewayPoolId
- });
- const connection = { ...rawConnection, gatewayId: effectiveGatewayId, gatewayPoolId: null };
- const resolvedSync = { ...secretSync, connection };
- let token: string;
-
- switch (connection.method) {
- case GitHubConnectionMethod.OAuth:
- token = connection.credentials.accessToken;
- break;
- case GitHubConnectionMethod.Pat:
- token = connection.credentials.personalAccessToken;
- break;
- default:
- token = await getGitHubAppAuthToken(connection, gatewayV2Service, gatewayPoolService, gitHubAppDeps);
- }
+ const { resolvedSync, token } = await resolveGitHubSyncConnection(secretSync, deps, gitHubAppDeps);
- const encryptedSecrets = await getEncryptedSecrets(
- resolvedSync,
- gatewayV2Service,
- gatewayPoolService,
- gitHubAppDeps
- );
+ const encryptedSecrets = await getEncryptedSecrets(resolvedSync, deps, gitHubAppDeps);
for await (const encryptedSecret of encryptedSecrets) {
if (encryptedSecret.name in secretMap) {
- await deleteSecret(resolvedSync, gatewayV2Service, gatewayPoolService, token, encryptedSecret);
+ await deleteSecret(resolvedSync, deps, token, encryptedSecret);
}
}
}
diff --git a/backend/src/services/secret-sync/github/github-sync-schemas.test.ts b/backend/src/services/secret-sync/github/github-sync-schemas.test.ts
new file mode 100644
index 0000000000..ecc6efd0fb
--- /dev/null
+++ b/backend/src/services/secret-sync/github/github-sync-schemas.test.ts
@@ -0,0 +1,75 @@
+import { GitHubSyncScope, GitHubSyncSecretType, GitHubSyncVisibility } from "./github-sync-enums";
+import { CreateGitHubSyncSchema, GitHubSyncSchema } from "./github-sync-schemas";
+
+const createConfigSchema = CreateGitHubSyncSchema.shape.destinationConfig;
+const responseConfigSchema = GitHubSyncSchema.shape.destinationConfig;
+
+describe("GitHub sync destination config secretType", () => {
+ test("defaults to Actions when omitted", () => {
+ const result = createConfigSchema.safeParse({ scope: GitHubSyncScope.Repository, owner: "acme", repo: "app" });
+
+ expect(result.success && result.data.secretType).toBe(GitHubSyncSecretType.Actions);
+ });
+
+ test("fills Actions into a stored config that predates the field", () => {
+ const result = responseConfigSchema.safeParse({
+ scope: GitHubSyncScope.RepositoryEnvironment,
+ owner: "acme",
+ repo: "app",
+ env: "prod"
+ });
+
+ expect(result.success && result.data.secretType).toBe(GitHubSyncSecretType.Actions);
+ });
+
+ test.each([GitHubSyncSecretType.Dependabot, GitHubSyncSecretType.Codespaces])(
+ "accepts %s at repository and organization scope",
+ (secretType) => {
+ expect(
+ createConfigSchema.safeParse({ scope: GitHubSyncScope.Repository, owner: "acme", repo: "app", secretType })
+ .success
+ ).toBe(true);
+ expect(
+ createConfigSchema.safeParse({
+ scope: GitHubSyncScope.Organization,
+ org: "acme",
+ visibility: GitHubSyncVisibility.Selected,
+ selectedRepositoryIds: [1],
+ secretType
+ }).success
+ ).toBe(true);
+ }
+ );
+
+ test.each([GitHubSyncSecretType.Dependabot, GitHubSyncSecretType.Codespaces])(
+ "rejects %s at repository environment scope on the secretType field",
+ (secretType) => {
+ const result = createConfigSchema.safeParse({
+ scope: GitHubSyncScope.RepositoryEnvironment,
+ owner: "acme",
+ repo: "app",
+ env: "prod",
+ secretType
+ });
+
+ expect(result.success).toBe(false);
+ expect(!result.success && result.error.issues).toEqual([
+ expect.objectContaining({
+ path: ["secretType"],
+ message: "Repository environment scope is only available for Actions secrets"
+ })
+ ]);
+ }
+ );
+
+ test("rejects an unknown secret type", () => {
+ expect(
+ createConfigSchema.safeParse({
+ scope: GitHubSyncScope.Repository,
+ owner: "acme",
+ repo: "app",
+ secretType: "user"
+ }).success
+ ).toBe(false);
+ });
+});
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 c4c2147055..0415cec581 100644
--- a/backend/src/services/secret-sync/github/github-sync-schemas.ts
+++ b/backend/src/services/secret-sync/github/github-sync-schemas.ts
@@ -2,7 +2,11 @@ import { z } from "zod";
import { SecretSyncs } from "@app/lib/api-docs";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
-import { GitHubSyncScope, GitHubSyncVisibility } from "@app/services/secret-sync/github/github-sync-enums";
+import {
+ GitHubSyncScope,
+ GitHubSyncSecretType,
+ GitHubSyncVisibility
+} from "@app/services/secret-sync/github/github-sync-enums";
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
import {
BaseSecretSyncSchema,
@@ -13,27 +17,46 @@ import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types"
import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
+const GitHubSyncSecretTypeSchema = z
+ .nativeEnum(GitHubSyncSecretType)
+ .default(GitHubSyncSecretType.Actions)
+ .describe(SecretSyncs.DESTINATION_CONFIG.GITHUB.secretType);
+
const GitHubSyncDestinationConfigSchema = z
.discriminatedUnion("scope", [
z.object({
scope: z.literal(GitHubSyncScope.Organization).describe(SecretSyncs.DESTINATION_CONFIG.GITHUB.scope),
+ secretType: GitHubSyncSecretTypeSchema,
org: z.string().min(1, "Organization name required").describe(SecretSyncs.DESTINATION_CONFIG.GITHUB.org),
visibility: z.nativeEnum(GitHubSyncVisibility),
selectedRepositoryIds: z.number().array().optional()
}),
z.object({
scope: z.literal(GitHubSyncScope.Repository).describe(SecretSyncs.DESTINATION_CONFIG.GITHUB.scope),
+ secretType: GitHubSyncSecretTypeSchema,
owner: z.string().min(1, "Repository owner name required").describe(SecretSyncs.DESTINATION_CONFIG.GITHUB.owner),
repo: z.string().min(1, "Repository name required").describe(SecretSyncs.DESTINATION_CONFIG.GITHUB.repo)
}),
z.object({
scope: z.literal(GitHubSyncScope.RepositoryEnvironment).describe(SecretSyncs.DESTINATION_CONFIG.GITHUB.scope),
+ secretType: GitHubSyncSecretTypeSchema,
owner: z.string().min(1, "Repository owner name required").describe(SecretSyncs.DESTINATION_CONFIG.GITHUB.owner),
repo: z.string().min(1, "Repository name required").describe(SecretSyncs.DESTINATION_CONFIG.GITHUB.repo),
env: z.string().min(1, "Environment name required").describe(SecretSyncs.DESTINATION_CONFIG.GITHUB.env)
})
])
.superRefine((options, ctx) => {
+ if (
+ options.scope === GitHubSyncScope.RepositoryEnvironment &&
+ options.secretType !== GitHubSyncSecretType.Actions
+ ) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Repository environment scope is only available for Actions secrets",
+ path: ["secretType"]
+ });
+ }
+
if (options.scope === GitHubSyncScope.Organization) {
if (options.visibility === GitHubSyncVisibility.Selected) {
if (!options.selectedRepositoryIds?.length)
diff --git a/backend/src/services/secret-sync/secret-sync-duplicate-check.test.ts b/backend/src/services/secret-sync/secret-sync-duplicate-check.test.ts
index a87650b117..2be14cd1e4 100644
--- a/backend/src/services/secret-sync/secret-sync-duplicate-check.test.ts
+++ b/backend/src/services/secret-sync/secret-sync-duplicate-check.test.ts
@@ -62,4 +62,19 @@ describe("secret sync destination comparison", () => {
)
).toBe(false);
});
+
+ test("treats a GitHub config saved before secretType existed as an Actions destination", () => {
+ const legacy = { scope: "repository", owner: "acme", repo: "app" };
+
+ expect(
+ areSecretSyncDestinationConfigsEqual(SecretSync.GitHub, legacy, { ...legacy, secretType: "actions" }, [])
+ ).toBe(true);
+ expect(
+ areSecretSyncDestinationConfigsEqual(SecretSync.GitHub, { ...legacy, secretType: "actions" }, legacy, [])
+ ).toBe(true);
+ expect(
+ areSecretSyncDestinationConfigsEqual(SecretSync.GitHub, legacy, { ...legacy, secretType: "dependabot" }, [])
+ ).toBe(false);
+ expect(legacy).not.toHaveProperty("secretType");
+ });
});
diff --git a/backend/src/services/secret-sync/secret-sync-duplicate-check.ts b/backend/src/services/secret-sync/secret-sync-duplicate-check.ts
index 4545ead597..b4191186ce 100644
--- a/backend/src/services/secret-sync/secret-sync-duplicate-check.ts
+++ b/backend/src/services/secret-sync/secret-sync-duplicate-check.ts
@@ -1,5 +1,6 @@
import { deepEqualSkipFields } from "@app/lib/fn/object";
+import { GitHubSyncSecretType } from "./github/github-sync-enums";
import { SecretSync } from "./secret-sync-enums";
// These optional scopes use the same provider destination when empty or omitted.
@@ -20,6 +21,25 @@ const normalizeOptionalScope = (destination: SecretSync, config: unknown) => {
);
};
+// Configs saved before one of these fields existed omit it, and behave as if they held the default.
+const DEFAULTED_FIELDS: Partial<Record<SecretSync, Record<string, unknown>>> = {
+ [SecretSync.GitHub]: { secretType: GitHubSyncSecretType.Actions }
+};
+
+const fillDefaultedFields = (destination: SecretSync, config: unknown) => {
+ const defaults = DEFAULTED_FIELDS[destination];
+ if (!defaults || !config || typeof config !== "object" || Array.isArray(config)) return config;
+
+ const filled: Record<string, unknown> = { ...config };
+ Object.entries(defaults).forEach(([key, value]) => {
+ if (filled[key] === undefined) filled[key] = value;
+ });
+ return filled;
+};
+
+const normalizeDestinationConfig = (destination: SecretSync, config: unknown) =>
+ normalizeOptionalScope(destination, fillDefaultedFields(destination, config));
+
export const areSecretSyncDestinationConfigsEqual = (
destination: SecretSync,
existingConfig: unknown,
@@ -27,7 +47,7 @@ export const areSecretSyncDestinationConfigsEqual = (
skipFields: string[]
) =>
deepEqualSkipFields(
- normalizeOptionalScope(destination, existingConfig),
- normalizeOptionalScope(destination, newConfig),
+ normalizeDestinationConfig(destination, existingConfig),
+ normalizeDestinationConfig(destination, newConfig),
skipFields
);
diff --git a/backend/src/services/secret-sync/secret-sync-fns.ts b/backend/src/services/secret-sync/secret-sync-fns.ts
index 6d19b89574..f6b9d96649 100644
--- a/backend/src/services/secret-sync/secret-sync-fns.ts
+++ b/backend/src/services/secret-sync/secret-sync-fns.ts
@@ -17,7 +17,11 @@ import {
AwsSecretsManagerSyncFns
} from "@app/services/secret-sync/aws-secrets-manager";
import { DATABRICKS_SYNC_LIST_OPTION, databricksSyncFactory } from "@app/services/secret-sync/databricks";
-import { GITHUB_SYNC_LIST_OPTION, GithubSyncFns } from "@app/services/secret-sync/github";
+import {
+ GITHUB_SYNC_LIST_OPTION,
+ gitHubPreSaveTransformDestinationConfig,
+ GithubSyncFns
+} from "@app/services/secret-sync/github";
import { SecretSync, SecretSyncPlanType } from "@app/services/secret-sync/secret-sync-enums";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
import {
@@ -165,7 +169,8 @@ const PRE_SAVE_TRANSFORM_SYNC_OPTIONS_MAP: Partial<Record<SecretSync, TPreSaveTr
const PRE_SAVE_TRANSFORM_DESTINATION_CONFIG_MAP: Partial<Record<SecretSync, TPreSaveTransformDestinationConfigFn>> = {
[SecretSync.AzureEntraIdScim]: azureEntraIdScimPreSaveTransformDestinationConfig,
[SecretSync.Chef]: chefPreSaveTransformDestinationConfig,
- [SecretSync.GCPSecretManager]: gcpPreSaveTransformDestinationConfig
+ [SecretSync.GCPSecretManager]: gcpPreSaveTransformDestinationConfig,
+ [SecretSync.GitHub]: gitHubPreSaveTransformDestinationConfig
};
export const preSaveTransformSyncOptions = async (
diff --git a/docs/.vale/styles/config/vocabularies/Infisical/any-case/accept.txt b/docs/.vale/styles/config/vocabularies/Infisical/any-case/accept.txt
index 8cac1748ed..32c1f9ef3a 100644
--- a/docs/.vale/styles/config/vocabularies/Infisical/any-case/accept.txt
+++ b/docs/.vale/styles/config/vocabularies/Infisical/any-case/accept.txt
@@ -409,3 +409,7 @@ sm
(?i)unscoped
(?i)rsync
(?i)zsh
+
+# GitHub product name that GitHub itself lowercases in permission labels, such as
+# "Organization dependabot secrets".
+(?i)Dependabot
diff --git a/docs/integrations/app-connections/github.mdx b/docs/integrations/app-connections/github.mdx
index 51f6f66547..bbcb07a7ae 100644
--- a/docs/integrations/app-connections/github.mdx
+++ b/docs/integrations/app-connections/github.mdx
@@ -30,10 +30,10 @@ Infisical supports three methods for connecting to GitHub.
Disable webhook by unchecking the Active checkbox.
![integrations github app webhook](/images/integrations/github/app/self-hosted-github-app-webhook.png)
- Set the repository permissions as follows: Metadata: Read-only, Secrets: Read and write, Environments: Read and write, Actions: Read.
+ Set the repository permissions as follows: Metadata: Read-only, Secrets: Read and write, Environments: Read and write, Actions: Read. To sync [Dependabot or Codespaces secrets](/integrations/secret-syncs/github#secret-types), also set Dependabot secrets or Codespaces secrets to Read and write.
![integrations github app repository](/images/integrations/github/app/self-hosted-github-app-repository.png)
- Similarly, set the organization permissions as follows: Secrets: Read and write.
+ Similarly, set the organization permissions as follows: Secrets: Read and write. To sync Dependabot or Codespaces secrets to an organization, also set Organization dependabot secrets or Organization codespaces secrets to Read and write.
![integrations github app organization](/images/integrations/github/app/self-hosted-github-app-organization.png)
Create the GitHub application.
@@ -224,6 +224,8 @@ Infisical supports three methods for connecting to GitHub.
- **Metadata**: Read-only
- **Environments**: Read and write
- **Secrets**: Read and write
+ - **Dependabot secrets**: Read and write (only to sync [Dependabot secrets](/integrations/secret-syncs/github#secret-types))
+ - **Codespaces secrets**: Read and write (only to sync [Codespaces secrets](/integrations/secret-syncs/github#secret-types))
![Personal Access Token Form](/images/app-connections/github/create-pat-form.png)
diff --git a/docs/integrations/secret-syncs/github.mdx b/docs/integrations/secret-syncs/github.mdx
index 65521e7484..102b513cc9 100644
--- a/docs/integrations/secret-syncs/github.mdx
+++ b/docs/integrations/secret-syncs/github.mdx
@@ -10,6 +10,28 @@ description: "Learn how to configure a GitHub Sync for Infisical."
- Create a [GitHub Connection](/integrations/app-connections/github)
- Ensure your network security policies allow incoming requests from Infisical to this secret sync provider, if network restrictions apply.
+## Secret types
+
+A GitHub sync writes to one type of GitHub secret. Each type is read by a different part of GitHub, supports different scopes, and needs its own permission on the [GitHub Connection](/integrations/app-connections/github):
+
+| Secret type | Read by | Scopes | Repository permission | Organization permission |
+| --- | --- | --- | --- | --- |
+| Actions | GitHub Actions workflows | Organization, Repository, Repository Environment | **Secrets** (and **Environments** for the Repository Environment scope) | **Secrets** |
+| Dependabot | Dependabot, for example to reach a private package registry | Organization, Repository | **Dependabot secrets** | **Organization dependabot secrets** |
+| Codespaces | GitHub Codespaces | Organization, Repository | **Codespaces secrets** | **Organization codespaces secrets** |
+
+How you grant those permissions depends on the connection:
+
+- If your connection uses a GitHub App or a fine-grained personal access token, give each permission read and write access
+- If your connection uses OAuth or a classic personal access token, the `repo` and `admin:org` scopes already cover every secret type
+- If your connection is to GitHub Enterprise Server, you can't sync Codespaces secrets, because GitHub Enterprise Server doesn't include Codespaces
+
+<Note>
+ If you add a permission to an existing GitHub App, an owner of each installation has to approve the new permission on GitHub before Infisical can use it.
+</Note>
+
+## Create a GitHub sync
+
<Tabs>
<Tab title="Infisical UI">
1. Navigate to **Project** > **Integrations** and select the **Secret Syncs** tab. Select the **Add Sync** button.
@@ -28,14 +50,18 @@ description: "Learn how to configure a GitHub Sync for Infisical."
If you need to sync secrets from multiple folder locations, check out [secret imports](/documentation/platform/secret-reference#secret-imports).
</Tip>
- 4. Configure the **Destination** to where secrets should be deployed, then click **Next**.
+ 4. Configure the **Destination** to where secrets should be deployed, then select **Next**.
![Configure Destination](/images/secret-syncs/github/github-destination.png)
- - **GitHub Connection**: The GitHub Connection to authenticate with.
- - **Scope**: The GitHub secret scope to sync secrets to.
- - **Organization**: Sync secrets to a specific organization.
- - **Repository**: Sync secrets to a specific repository.
- - **Repository Environment**: Sync secrets to a specific repository's environment.
+ - **GitHub Connection**: The GitHub Connection to authenticate with
+ - **Secret Type**: The [type of GitHub secret](#secret-types) to sync to (defaults to **Actions**)
+ - **Actions**: Secrets for GitHub Actions workflows
+ - **Dependabot**: Secrets for Dependabot
+ - **Codespaces**: Secrets for GitHub Codespaces
+ - **Scope**: The GitHub secret scope to sync secrets to
+ - **Organization**: Sync secrets to a specific organization
+ - **Repository**: Sync secrets to a specific repository
+ - **Repository Environment**: Sync secrets to a specific repository's environment (only for the **Actions** secret type)
<p class="height:1px" />
The remaining fields are determined by the selected **Scope**:
<AccordionGroup>
@@ -87,6 +113,8 @@ description: "Learn how to configure a GitHub Sync for Infisical."
<Tab title="API">
To create an **GitHub Sync**, make an API request to the [Create GitHub Sync](/api-reference/endpoints/secret-syncs/github/create) API endpoint.
+ Set `secretType` in `destinationConfig` to `actions`, `dependabot`, or `codespaces`. If you leave `secretType` out, Infisical syncs to Actions secrets.
+
### Sample request
```bash Request
@@ -106,6 +134,7 @@ description: "Learn how to configure a GitHub Sync for Infisical."
},
"destinationConfig": {
"scope": "repository",
+ "secretType": "dependabot",
"owner": "my-github",
"repo": "my-repository"
}
@@ -159,6 +188,7 @@ description: "Learn how to configure a GitHub Sync for Infisical."
"destination": "github",
"destinationConfig": {
"scope": "repository",
+ "secretType": "dependabot",
"owner": "my-github",
"repo": "my-repository"
}
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitHubSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitHubSyncFields.tsx
index 99be19a96b..e3f829f7b0 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitHubSyncFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitHubSyncFields.tsx
@@ -1,4 +1,5 @@
import { Controller, useFormContext, useWatch } from "react-hook-form";
+import { Info } from "lucide-react";
import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";
import {
@@ -12,8 +13,12 @@ import {
SelectContent,
SelectItem,
SelectTrigger,
- SelectValue
+ SelectValue,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
} from "@app/components/v3";
+import { GITHUB_SYNC_SECRET_TYPES } from "@app/helpers/secretSyncs";
import {
useGitHubConnectionListEnvironments,
useGitHubConnectionListOrganizations,
@@ -22,6 +27,7 @@ import {
import { SecretSync } from "@app/hooks/api/secretSyncs";
import {
GitHubSyncScope,
+ GitHubSyncSecretType,
GitHubSyncVisibility
} from "@app/hooks/api/secretSyncs/types/github-sync";
@@ -34,6 +40,10 @@ export const GitHubSyncFields = () => {
const connectionId = useWatch({ name: "connection.id", control });
const currentScope = watch("destinationConfig.scope");
+ const currentSecretType = watch("destinationConfig.secretType");
+ // Unset until the secret type field registers its default, which is Actions
+ const isActionsSecretType =
+ !currentSecretType || currentSecretType === GitHubSyncSecretType.Actions;
const currentVisibility = watch("destinationConfig.visibility");
const currentOrg = watch("destinationConfig.org");
const currentRepo = watch("destinationConfig.repo");
@@ -76,6 +86,65 @@ export const GitHubSyncFields = () => {
setValue("destinationConfig.selectedRepositoryIds", []);
}}
/>
+ <Controller
+ name="destinationConfig.secretType"
+ control={control}
+ defaultValue={GitHubSyncSecretType.Actions}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel>
+ Secret Type
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-lg">
+ <div className="flex flex-col gap-3">
+ <p>Choose which type of GitHub secret Infisical should sync to:</p>
+ <ul className="flex list-disc flex-col gap-3 pl-4">
+ {Object.values(GITHUB_SYNC_SECRET_TYPES).map(({ name, description }) => (
+ <li key={name}>
+ <p className="text-label">
+ <span className="font-medium text-foreground-soft">{name}</span>:{" "}
+ {description}
+ </p>
+ </li>
+ ))}
+ </ul>
+ </div>
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <FieldContent>
+ <Select
+ value={value}
+ onValueChange={(val) => {
+ onChange(val);
+ if (
+ val !== GitHubSyncSecretType.Actions &&
+ currentScope === GitHubSyncScope.RepositoryEnvironment
+ ) {
+ setValue("destinationConfig.scope", GitHubSyncScope.Repository);
+ setValue("destinationConfig.env", "");
+ }
+ }}
+ >
+ <SelectTrigger className="w-full" isError={Boolean(error)}>
+ <SelectValue placeholder="Select a secret type..." />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {Object.values(GitHubSyncSecretType).map((secretType) => (
+ <SelectItem value={secretType} key={secretType}>
+ {GITHUB_SYNC_SECRET_TYPES[secretType].name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
+ )}
+ />
<Controller
name="destinationConfig.scope"
control={control}
@@ -89,11 +158,16 @@ export const GitHubSyncFields = () => {
<SelectValue placeholder="Select a scope..." />
</SelectTrigger>
<SelectContent position="popper">
- {Object.values(GitHubSyncScope).map((scope) => (
- <SelectItem className="capitalize" value={scope} key={scope}>
- {scope.replace("-", " ")}
- </SelectItem>
- ))}
+ {Object.values(GitHubSyncScope)
+ .filter(
+ (scope) =>
+ scope !== GitHubSyncScope.RepositoryEnvironment || isActionsSecretType
+ )
+ .map((scope) => (
+ <SelectItem className="capitalize" value={scope} key={scope}>
+ {scope.replace("-", " ")}
+ </SelectItem>
+ ))}
</SelectContent>
</Select>
<FieldError errors={[error]} />
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/GitHubSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/GitHubSyncReviewFields.tsx
index 8454170ed0..601d7d5e70 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/GitHubSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/GitHubSyncReviewFields.tsx
@@ -3,6 +3,7 @@ import { useFormContext } from "react-hook-form";
import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
import { Detail, DetailLabel, DetailValue } from "@app/components/v3";
+import { getGitHubSyncSecretTypeName } from "@app/helpers/secretSyncs";
import { SecretSync } from "@app/hooks/api/secretSyncs";
import { GitHubSyncScope, TGitHubSync } from "@app/hooks/api/secretSyncs/types/github-sync";
@@ -63,6 +64,10 @@ export const GitHubSyncReviewFields = () => {
return (
<>
+ <Detail>
+ <DetailLabel>Secret Type</DetailLabel>
+ <DetailValue>{getGitHubSyncSecretTypeName(config.secretType)}</DetailValue>
+ </Detail>
<Detail>
<DetailLabel>Scope</DetailLabel>
<DetailValue className="capitalize">{config.scope.replace("-", " ")}</DetailValue>
diff --git a/frontend/src/components/secret-syncs/forms/schemas/github-sync-destination-schema.test.ts b/frontend/src/components/secret-syncs/forms/schemas/github-sync-destination-schema.test.ts
new file mode 100644
index 0000000000..79221f1568
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/schemas/github-sync-destination-schema.test.ts
@@ -0,0 +1,64 @@
+import assert from "node:assert/strict";
+import { describe, it } from "vitest";
+
+import {
+ GitHubSyncScope,
+ GitHubSyncSecretType,
+ GitHubSyncVisibility
+} from "@app/hooks/api/secretSyncs/types/github-sync";
+
+import { GitHubSyncDestinationSchema } from "./github-sync-destination-schema";
+
+const destinationConfigSchema = GitHubSyncDestinationSchema.shape.destinationConfig;
+
+const repositoryConfig = { scope: GitHubSyncScope.Repository, owner: "acme", repo: "app" };
+
+describe("GitHub sync destination form schema", () => {
+ it("defaults the secret type to Actions", () => {
+ const result = destinationConfigSchema.safeParse(repositoryConfig);
+
+ assert.equal(result.success, true);
+ assert.equal(result.data?.secretType, GitHubSyncSecretType.Actions);
+ });
+
+ it("keeps an existing repository environment sync valid when it predates the secret type", () => {
+ const result = destinationConfigSchema.safeParse({
+ ...repositoryConfig,
+ scope: GitHubSyncScope.RepositoryEnvironment,
+ env: "prod"
+ });
+
+ assert.equal(result.success, true);
+ assert.equal(result.data?.secretType, GitHubSyncSecretType.Actions);
+ });
+
+ it("accepts Dependabot and Codespaces at organization scope", () => {
+ [GitHubSyncSecretType.Dependabot, GitHubSyncSecretType.Codespaces].forEach((secretType) => {
+ const result = destinationConfigSchema.safeParse({
+ scope: GitHubSyncScope.Organization,
+ org: "acme",
+ visibility: GitHubSyncVisibility.All,
+ secretType
+ });
+
+ assert.equal(result.success, true);
+ });
+ });
+
+ it("rejects the repository environment scope for non-Actions secret types", () => {
+ [GitHubSyncSecretType.Dependabot, GitHubSyncSecretType.Codespaces].forEach((secretType) => {
+ const result = destinationConfigSchema.safeParse({
+ ...repositoryConfig,
+ scope: GitHubSyncScope.RepositoryEnvironment,
+ env: "prod",
+ secretType
+ });
+
+ assert.equal(result.success, false);
+ assert.deepEqual(
+ result.error?.issues.map(({ path }) => path.join(".")),
+ ["scope"]
+ );
+ });
+ });
+});
diff --git a/frontend/src/components/secret-syncs/forms/schemas/github-sync-destination-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/github-sync-destination-schema.ts
index cee2a84f11..7ab07a8750 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/github-sync-destination-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/github-sync-destination-schema.ts
@@ -4,9 +4,12 @@ import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas
import { SecretSync } from "@app/hooks/api/secretSyncs/enums";
import {
GitHubSyncScope,
+ GitHubSyncSecretType,
GitHubSyncVisibility
} from "@app/hooks/api/secretSyncs/types/github-sync";
+const SecretTypeSchema = z.nativeEnum(GitHubSyncSecretType).default(GitHubSyncSecretType.Actions);
+
export const GitHubSyncDestinationSchema = BaseSecretSyncSchema().merge(
z.object({
destination: z.literal(SecretSync.GitHub),
@@ -14,6 +17,7 @@ export const GitHubSyncDestinationSchema = BaseSecretSyncSchema().merge(
.discriminatedUnion("scope", [
z.object({
scope: z.literal(GitHubSyncScope.Organization),
+ secretType: SecretTypeSchema,
org: z.string().min(1, "Organization name required"),
visibility: z.nativeEnum(GitHubSyncVisibility),
selectedRepositoryIds: z
@@ -24,17 +28,30 @@ export const GitHubSyncDestinationSchema = BaseSecretSyncSchema().merge(
}),
z.object({
scope: z.literal(GitHubSyncScope.Repository),
+ secretType: SecretTypeSchema,
owner: z.string().min(1, "Repository owner name required"),
repo: z.string().min(1, "Repository name required")
}),
z.object({
scope: z.literal(GitHubSyncScope.RepositoryEnvironment),
+ secretType: SecretTypeSchema,
owner: z.string().min(1, "Repository owner name required"),
repo: z.string().min(1, "Repository name required"),
env: z.string().min(1, "Environment name required")
})
])
.superRefine((options, ctx) => {
+ if (
+ options.scope === GitHubSyncScope.RepositoryEnvironment &&
+ options.secretType !== GitHubSyncSecretType.Actions
+ ) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Repository Environment scope is only available for Actions secrets",
+ path: ["scope"]
+ });
+ }
+
if (options.scope === GitHubSyncScope.Organization) {
if (
options.visibility === GitHubSyncVisibility.Selected &&
diff --git a/frontend/src/helpers/secretSyncs.ts b/frontend/src/helpers/secretSyncs.ts
index 9e65886d9e..e38eb34fb8 100644
--- a/frontend/src/helpers/secretSyncs.ts
+++ b/frontend/src/helpers/secretSyncs.ts
@@ -6,6 +6,7 @@ import {
} from "@app/hooks/api/secretSyncs";
import { CloudflareSecretsStoreScope } from "@app/hooks/api/secretSyncs/types/cloudflare-secrets-store-sync";
import { GcpSyncScope } from "@app/hooks/api/secretSyncs/types/gcp-sync";
+import { GitHubSyncSecretType } from "@app/hooks/api/secretSyncs/types/github-sync";
import { HumanitecSyncScope } from "@app/hooks/api/secretSyncs/types/humanitec-sync";
import { RenderSyncScope } from "@app/hooks/api/secretSyncs/types/render-sync";
@@ -35,7 +36,7 @@ export const SECRET_SYNC_MAP: Record<
name: "GitHub",
image: "GitHub.png",
category: "CI/CD",
- description: "Repository or organization-level secrets."
+ description: "Actions, Dependabot, or Codespaces secrets for a repository or organization."
},
[SecretSync.GCPSecretManager]: {
name: "GCP Secret Manager",
@@ -456,6 +457,31 @@ export const HUMANITEC_SYNC_SCOPES: Record<
}
};
+export const GITHUB_SYNC_SECRET_TYPES: Record<
+ GitHubSyncSecretType,
+ { name: string; description: string }
+> = {
+ [GitHubSyncSecretType.Actions]: {
+ name: "Actions",
+ description:
+ "Secrets available to GitHub Actions workflows. Supports organization, repository, and repository environment scopes."
+ },
+ [GitHubSyncSecretType.Dependabot]: {
+ name: "Dependabot",
+ description:
+ "Secrets available to Dependabot, such as private registry credentials. Supports organization and repository scopes."
+ },
+ [GitHubSyncSecretType.Codespaces]: {
+ name: "Codespaces",
+ description:
+ "Secrets available in GitHub Codespaces. Supports organization and repository scopes. Not available on GitHub Enterprise Server."
+ }
+};
+
+// Responses from before secretType existed omit it, and those syncs are Actions syncs
+export const getGitHubSyncSecretTypeName = (secretType?: GitHubSyncSecretType) =>
+ GITHUB_SYNC_SECRET_TYPES[secretType ?? GitHubSyncSecretType.Actions].name;
+
export const GCP_SYNC_SCOPES: Record<GcpSyncScope, { name: string; description: string }> = {
[GcpSyncScope.Global]: {
name: "Global",
diff --git a/frontend/src/hooks/api/secretSyncs/types/github-sync.ts b/frontend/src/hooks/api/secretSyncs/types/github-sync.ts
index 8bb18be47d..832d739352 100644
--- a/frontend/src/hooks/api/secretSyncs/types/github-sync.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/github-sync.ts
@@ -8,6 +8,12 @@ export enum GitHubSyncScope {
RepositoryEnvironment = "repository-environment"
}
+export enum GitHubSyncSecretType {
+ Actions = "actions",
+ Dependabot = "dependabot",
+ Codespaces = "codespaces"
+}
+
export enum GitHubSyncVisibility {
All = "all",
Private = "private",
@@ -19,17 +25,20 @@ export type TGitHubSync = TRootSecretSync & {
destinationConfig:
| {
scope: GitHubSyncScope.Organization;
+ secretType: GitHubSyncSecretType;
org: string;
visibility: GitHubSyncVisibility;
selectedRepositoryIds?: number[];
}
| {
scope: GitHubSyncScope.Repository;
+ secretType: GitHubSyncSecretType;
owner: string;
repo: string;
}
| {
scope: GitHubSyncScope.RepositoryEnvironment;
+ secretType: GitHubSyncSecretType;
owner: string;
repo: string;
env: string;
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
index fc873b1dbd..b3e8c462c7 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
@@ -1,9 +1,11 @@
+import { getGitHubSyncSecretTypeName } from "@app/helpers/secretSyncs";
import { TerraformCloudSyncScope } from "@app/hooks/api/appConnections/terraform-cloud";
import { ZabbixSyncScope } from "@app/hooks/api/appConnections/zabbix";
import { SecretSync, TSecretSync } from "@app/hooks/api/secretSyncs";
import { GcpSyncScope } from "@app/hooks/api/secretSyncs/types/gcp-sync";
import {
GitHubSyncScope,
+ GitHubSyncSecretType,
GitHubSyncVisibility
} from "@app/hooks/api/secretSyncs/types/github-sync";
import { GitLabSyncScope } from "@app/hooks/api/secretSyncs/types/gitlab-sync";
@@ -50,6 +52,12 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
default:
throw new Error(`Unhandled GitHub Scope Destination Col Values ${destination}`);
}
+ if (
+ destinationConfig.secretType &&
+ destinationConfig.secretType !== GitHubSyncSecretType.Actions
+ ) {
+ secondaryText = `${getGitHubSyncSecretTypeName(destinationConfig.secretType)} - ${secondaryText}`;
+ }
break;
case SecretSync.GCPSecretManager:
primaryText = destinationConfig.projectId;
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/GitHubSyncDestinationSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/GitHubSyncDestinationSection.tsx
index 87af6b82c5..a1031c578b 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/GitHubSyncDestinationSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/GitHubSyncDestinationSection.tsx
@@ -10,6 +10,7 @@ import {
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
+import { getGitHubSyncSecretTypeName } from "@app/helpers/secretSyncs";
import {
GitHubSyncScope,
GitHubSyncVisibility,
@@ -89,6 +90,10 @@ export const GitHubSyncDestinationSection = ({ secretSync }: Props) => {
return (
<>
+ <Detail>
+ <DetailLabel>Secret Type</DetailLabel>
+ <DetailValue>{getGitHubSyncSecretTypeName(destinationConfig.secretType)}</DetailValue>
+ </Detail>
<Detail className="capitalize">
<DetailLabel>Scope</DetailLabel>
<DetailValue>{destinationConfig.scope.replace("-", " ")}</DetailValue>
diff --git a/tests/clients/api/api.gen.go b/tests/clients/api/api.gen.go
index efc3ed730f..adbd1ca8d4 100644
--- a/tests/clients/api/api.gen.go
+++ b/tests/clients/api/api.gen.go
@@ -7239,6 +7239,27 @@ func (e CreateGitHubSecretSyncJSONBodyDestinationConfig0Scope) Valid() bool {
}
}
+// Defines values for CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretType.
+const (
+ CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretTypeActions CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretType = "actions"
+ CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretTypeCodespaces CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretType = "codespaces"
+ CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretTypeDependabot CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretType enum.
+func (e CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretType) Valid() bool {
+ switch e {
+ case CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretTypeActions:
+ return true
+ case CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretTypeCodespaces:
+ return true
+ case CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for CreateGitHubSecretSyncJSONBodyDestinationConfig0Visibility.
const (
CreateGitHubSecretSyncJSONBodyDestinationConfig0VisibilityAll CreateGitHubSecretSyncJSONBodyDestinationConfig0Visibility = "all"
@@ -7275,6 +7296,27 @@ func (e CreateGitHubSecretSyncJSONBodyDestinationConfig1Scope) Valid() bool {
}
}
+// Defines values for CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretType.
+const (
+ CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretTypeActions CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretType = "actions"
+ CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretTypeCodespaces CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretType = "codespaces"
+ CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretTypeDependabot CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretType enum.
+func (e CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretType) Valid() bool {
+ switch e {
+ case CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretTypeActions:
+ return true
+ case CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretTypeCodespaces:
+ return true
+ case CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for CreateGitHubSecretSyncJSONBodyDestinationConfig2Scope.
const (
CreateGitHubSecretSyncJSONBodyDestinationConfig2ScopeRepositoryEnvironment CreateGitHubSecretSyncJSONBodyDestinationConfig2Scope = "repository-environment"
@@ -7290,6 +7332,27 @@ func (e CreateGitHubSecretSyncJSONBodyDestinationConfig2Scope) Valid() bool {
}
}
+// Defines values for CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretType.
+const (
+ CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretTypeActions CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretType = "actions"
+ CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretTypeCodespaces CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretType = "codespaces"
+ CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretTypeDependabot CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretType enum.
+func (e CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretType) Valid() bool {
+ switch e {
+ case CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretTypeActions:
+ return true
+ case CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretTypeCodespaces:
+ return true
+ case CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for CreateGitHubSecretSyncJSONBodySyncOptionsInitialSyncBehavior.
const (
CreateGitHubSecretSyncJSONBodySyncOptionsInitialSyncBehaviorOverwriteDestination CreateGitHubSecretSyncJSONBodySyncOptionsInitialSyncBehavior = "overwrite-destination"
@@ -7350,6 +7413,27 @@ func (e CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Sco
}
}
+// Defines values for CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType.
+const (
+ CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeActions CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "actions"
+ CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeCodespaces CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "codespaces"
+ CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeDependabot CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType enum.
+func (e CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType) Valid() bool {
+ switch e {
+ case CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeActions:
+ return true
+ case CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeCodespaces:
+ return true
+ case CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility.
const (
CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0VisibilityAll CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility = "all"
@@ -7386,6 +7470,27 @@ func (e CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Sco
}
}
+// Defines values for CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType.
+const (
+ CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeActions CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "actions"
+ CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeCodespaces CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "codespaces"
+ CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeDependabot CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType enum.
+func (e CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType) Valid() bool {
+ switch e {
+ case CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeActions:
+ return true
+ case CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeCodespaces:
+ return true
+ case CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope.
const (
CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2ScopeRepositoryEnvironment CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope = "repository-environment"
@@ -7401,6 +7506,27 @@ func (e CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Sco
}
}
+// Defines values for CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType.
+const (
+ CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeActions CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "actions"
+ CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeCodespaces CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "codespaces"
+ CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeDependabot CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType enum.
+func (e CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType) Valid() bool {
+ switch e {
+ case CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeActions:
+ return true
+ case CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeCodespaces:
+ return true
+ case CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for CreateGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehavior.
const (
CreateGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehaviorOverwriteDestination CreateGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehavior = "overwrite-destination"
@@ -7569,6 +7695,27 @@ func (e DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Sco
}
}
+// Defines values for DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType.
+const (
+ DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeActions DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "actions"
+ DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeCodespaces DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "codespaces"
+ DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeDependabot DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType enum.
+func (e DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType) Valid() bool {
+ switch e {
+ case DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeActions:
+ return true
+ case DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeCodespaces:
+ return true
+ case DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility.
const (
DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0VisibilityAll DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility = "all"
@@ -7605,6 +7752,27 @@ func (e DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Sco
}
}
+// Defines values for DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType.
+const (
+ DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeActions DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "actions"
+ DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeCodespaces DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "codespaces"
+ DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeDependabot DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType enum.
+func (e DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType) Valid() bool {
+ switch e {
+ case DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeActions:
+ return true
+ case DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeCodespaces:
+ return true
+ case DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope.
const (
DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2ScopeRepositoryEnvironment DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope = "repository-environment"
@@ -7620,6 +7788,27 @@ func (e DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Sco
}
}
+// Defines values for DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType.
+const (
+ DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeActions DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "actions"
+ DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeCodespaces DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "codespaces"
+ DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeDependabot DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType enum.
+func (e DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType) Valid() bool {
+ switch e {
+ case DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeActions:
+ return true
+ case DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeCodespaces:
+ return true
+ case DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for DeleteGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehavior.
const (
DeleteGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehaviorOverwriteDestination DeleteGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehavior = "overwrite-destination"
@@ -7770,6 +7959,27 @@ func (e GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope)
}
}
+// Defines values for GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType.
+const (
+ GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeActions GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "actions"
+ GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeCodespaces GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "codespaces"
+ GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeDependabot GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType enum.
+func (e GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType) Valid() bool {
+ switch e {
+ case GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeActions:
+ return true
+ case GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeCodespaces:
+ return true
+ case GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility.
const (
GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0VisibilityAll GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility = "all"
@@ -7806,6 +8016,27 @@ func (e GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope)
}
}
+// Defines values for GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType.
+const (
+ GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeActions GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "actions"
+ GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeCodespaces GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "codespaces"
+ GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeDependabot GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType enum.
+func (e GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType) Valid() bool {
+ switch e {
+ case GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeActions:
+ return true
+ case GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeCodespaces:
+ return true
+ case GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope.
const (
GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2ScopeRepositoryEnvironment GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope = "repository-environment"
@@ -7821,6 +8052,27 @@ func (e GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope)
}
}
+// Defines values for GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType.
+const (
+ GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeActions GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "actions"
+ GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeCodespaces GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "codespaces"
+ GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeDependabot GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType enum.
+func (e GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType) Valid() bool {
+ switch e {
+ case GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeActions:
+ return true
+ case GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeCodespaces:
+ return true
+ case GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for GetGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehavior.
const (
GetGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehaviorOverwriteDestination GetGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehavior = "overwrite-destination"
@@ -7971,6 +8223,27 @@ func (e RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationCon
}
}
+// Defines values for RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretType.
+const (
+ RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretTypeActions RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretType = "actions"
+ RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretTypeCodespaces RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretType = "codespaces"
+ RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretTypeDependabot RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretType enum.
+func (e RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretType) Valid() bool {
+ switch e {
+ case RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretTypeActions:
+ return true
+ case RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretTypeCodespaces:
+ return true
+ case RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0Visibility.
const (
RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0VisibilityAll RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0Visibility = "all"
@@ -8007,6 +8280,27 @@ func (e RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationCon
}
}
+// Defines values for RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretType.
+const (
+ RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretTypeActions RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretType = "actions"
+ RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretTypeCodespaces RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretType = "codespaces"
+ RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretTypeDependabot RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretType enum.
+func (e RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretType) Valid() bool {
+ switch e {
+ case RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretTypeActions:
+ return true
+ case RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretTypeCodespaces:
+ return true
+ case RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2Scope.
const (
RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2ScopeRepositoryEnvironment RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2Scope = "repository-environment"
@@ -8022,6 +8316,27 @@ func (e RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationCon
}
}
+// Defines values for RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretType.
+const (
+ RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretTypeActions RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretType = "actions"
+ RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretTypeCodespaces RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretType = "codespaces"
+ RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretTypeDependabot RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretType enum.
+func (e RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretType) Valid() bool {
+ switch e {
+ case RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretTypeActions:
+ return true
+ case RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretTypeCodespaces:
+ return true
+ case RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehavior.
const (
RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehaviorOverwriteDestination RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehavior = "overwrite-destination"
@@ -8172,6 +8487,27 @@ func (e SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope
}
}
+// Defines values for SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType.
+const (
+ SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeActions SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "actions"
+ SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeCodespaces SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "codespaces"
+ SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeDependabot SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType enum.
+func (e SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType) Valid() bool {
+ switch e {
+ case SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeActions:
+ return true
+ case SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeCodespaces:
+ return true
+ case SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility.
const (
SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0VisibilityAll SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility = "all"
@@ -8208,6 +8544,27 @@ func (e SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope
}
}
+// Defines values for SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType.
+const (
+ SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeActions SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "actions"
+ SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeCodespaces SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "codespaces"
+ SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeDependabot SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType enum.
+func (e SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType) Valid() bool {
+ switch e {
+ case SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeActions:
+ return true
+ case SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeCodespaces:
+ return true
+ case SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope.
const (
SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2ScopeRepositoryEnvironment SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope = "repository-environment"
@@ -8223,6 +8580,27 @@ func (e SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope
}
}
+// Defines values for SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType.
+const (
+ SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeActions SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "actions"
+ SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeCodespaces SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "codespaces"
+ SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeDependabot SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType = "dependabot"
+)
+
+// Valid indicates whether the value is a known member of the SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType enum.
+func (e SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType) Valid() bool {
+ switch e {
+ case SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeActions:
+ return true
+ case SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeCodespaces:
+ return true
+ case SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretTypeDependabot:
+ return true
+ default:
+ return false
+ }
+}
+
// Defines values for SyncGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehavior.
const (
SyncGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehaviorOverwriteDestination SyncGitHubSecretSync200JSONResponseBodySecretSyncSyncOptionsInitialSyncBehavior = "overwrite-destination"
@@ -17068,14 +17446,20 @@ type CreateGitHubSecretSyncJSONBodyDestinationConfig0 struct {
Org string `json:"org"`
// Scope The GitHub scope that secrets should be synced to
- Scope CreateGitHubSecretSyncJSONBodyDestinationConfig0Scope `json:"scope"`
- SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
- Visibility CreateGitHubSecretSyncJSONBodyDestinationConfig0Visibility `json:"visibility"`
+ Scope CreateGitHubSecretSyncJSONBodyDestinationConfig0Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretType `json:"secretType,omitempty"`
+ SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
+ Visibility CreateGitHubSecretSyncJSONBodyDestinationConfig0Visibility `json:"visibility"`
}
// CreateGitHubSecretSyncJSONBodyDestinationConfig0Scope defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSyncJSONBodyDestinationConfig0Scope string
+// CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretType defines parameters for CreateGitHubSecretSync.
+type CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretType string
+
// CreateGitHubSecretSyncJSONBodyDestinationConfig0Visibility defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSyncJSONBodyDestinationConfig0Visibility string
@@ -17089,11 +17473,17 @@ type CreateGitHubSecretSyncJSONBodyDestinationConfig1 struct {
// Scope The GitHub scope that secrets should be synced to
Scope CreateGitHubSecretSyncJSONBodyDestinationConfig1Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretType `json:"secretType,omitempty"`
}
// CreateGitHubSecretSyncJSONBodyDestinationConfig1Scope defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSyncJSONBodyDestinationConfig1Scope string
+// CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretType defines parameters for CreateGitHubSecretSync.
+type CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretType string
+
// CreateGitHubSecretSyncJSONBodyDestinationConfig2 defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSyncJSONBodyDestinationConfig2 struct {
// Env The name of the GitHub environment.
@@ -17107,11 +17497,17 @@ type CreateGitHubSecretSyncJSONBodyDestinationConfig2 struct {
// Scope The GitHub scope that secrets should be synced to
Scope CreateGitHubSecretSyncJSONBodyDestinationConfig2Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretType `json:"secretType,omitempty"`
}
// CreateGitHubSecretSyncJSONBodyDestinationConfig2Scope defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSyncJSONBodyDestinationConfig2Scope string
+// CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretType defines parameters for CreateGitHubSecretSync.
+type CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretType string
+
// CreateGitHubSecretSyncJSONBody_DestinationConfig defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSyncJSONBody_DestinationConfig struct {
union json.RawMessage
@@ -17132,14 +17528,20 @@ type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0 struc
Org string `json:"org"`
// Scope The GitHub scope that secrets should be synced to
- Scope CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope `json:"scope"`
- SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
- Visibility CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility `json:"visibility"`
+ Scope CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType `json:"secretType,omitempty"`
+ SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
+ Visibility CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility `json:"visibility"`
}
// CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope string
+// CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType defines parameters for CreateGitHubSecretSync.
+type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType string
+
// CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility string
@@ -17153,11 +17555,17 @@ type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1 struc
// Scope The GitHub scope that secrets should be synced to
Scope CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType `json:"secretType,omitempty"`
}
// CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope string
+// CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType defines parameters for CreateGitHubSecretSync.
+type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType string
+
// CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 struct {
// Env The name of the GitHub environment.
@@ -17171,11 +17579,17 @@ type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 struc
// Scope The GitHub scope that secrets should be synced to
Scope CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType `json:"secretType,omitempty"`
}
// CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope string
+// CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType defines parameters for CreateGitHubSecretSync.
+type CreateGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType string
+
// CreateGitHubSecretSync200JSONResponseBody_SecretSync_DestinationConfig defines parameters for CreateGitHubSecretSync.
type CreateGitHubSecretSync200JSONResponseBody_SecretSync_DestinationConfig struct {
union json.RawMessage
@@ -17223,14 +17637,20 @@ type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0 struc
Org string `json:"org"`
// Scope The GitHub scope that secrets should be synced to
- Scope DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope `json:"scope"`
- SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
- Visibility DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility `json:"visibility"`
+ Scope DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType `json:"secretType,omitempty"`
+ SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
+ Visibility DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility `json:"visibility"`
}
// DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope defines parameters for DeleteGitHubSecretSync.
type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope string
+// DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType defines parameters for DeleteGitHubSecretSync.
+type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType string
+
// DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility defines parameters for DeleteGitHubSecretSync.
type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility string
@@ -17244,11 +17664,17 @@ type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1 struc
// Scope The GitHub scope that secrets should be synced to
Scope DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType `json:"secretType,omitempty"`
}
// DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope defines parameters for DeleteGitHubSecretSync.
type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope string
+// DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType defines parameters for DeleteGitHubSecretSync.
+type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType string
+
// DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 defines parameters for DeleteGitHubSecretSync.
type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 struct {
// Env The name of the GitHub environment.
@@ -17262,11 +17688,17 @@ type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 struc
// Scope The GitHub scope that secrets should be synced to
Scope DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType `json:"secretType,omitempty"`
}
// DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope defines parameters for DeleteGitHubSecretSync.
type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope string
+// DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType defines parameters for DeleteGitHubSecretSync.
+type DeleteGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType string
+
// DeleteGitHubSecretSync200JSONResponseBody_SecretSync_DestinationConfig defines parameters for DeleteGitHubSecretSync.
type DeleteGitHubSecretSync200JSONResponseBody_SecretSync_DestinationConfig struct {
union json.RawMessage
@@ -17305,14 +17737,20 @@ type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0 struct {
Org string `json:"org"`
// Scope The GitHub scope that secrets should be synced to
- Scope GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope `json:"scope"`
- SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
- Visibility GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility `json:"visibility"`
+ Scope GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType `json:"secretType,omitempty"`
+ SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
+ Visibility GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility `json:"visibility"`
}
// GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope defines parameters for GetGitHubSecretSync.
type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope string
+// GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType defines parameters for GetGitHubSecretSync.
+type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType string
+
// GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility defines parameters for GetGitHubSecretSync.
type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility string
@@ -17326,11 +17764,17 @@ type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1 struct {
// Scope The GitHub scope that secrets should be synced to
Scope GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType `json:"secretType,omitempty"`
}
// GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope defines parameters for GetGitHubSecretSync.
type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope string
+// GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType defines parameters for GetGitHubSecretSync.
+type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType string
+
// GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 defines parameters for GetGitHubSecretSync.
type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 struct {
// Env The name of the GitHub environment.
@@ -17344,11 +17788,17 @@ type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 struct {
// Scope The GitHub scope that secrets should be synced to
Scope GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType `json:"secretType,omitempty"`
}
// GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope defines parameters for GetGitHubSecretSync.
type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope string
+// GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType defines parameters for GetGitHubSecretSync.
+type GetGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType string
+
// GetGitHubSecretSync200JSONResponseBody_SecretSync_DestinationConfig defines parameters for GetGitHubSecretSync.
type GetGitHubSecretSync200JSONResponseBody_SecretSync_DestinationConfig struct {
union json.RawMessage
@@ -17387,14 +17837,20 @@ type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig
Org string `json:"org"`
// Scope The GitHub scope that secrets should be synced to
- Scope RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0Scope `json:"scope"`
- SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
- Visibility RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0Visibility `json:"visibility"`
+ Scope RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretType `json:"secretType,omitempty"`
+ SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
+ Visibility RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0Visibility `json:"visibility"`
}
// RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0Scope defines parameters for RemoveGitHubSecretSyncSecrets.
type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0Scope string
+// RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretType defines parameters for RemoveGitHubSecretSyncSecrets.
+type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0SecretType string
+
// RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0Visibility defines parameters for RemoveGitHubSecretSyncSecrets.
type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig0Visibility string
@@ -17408,11 +17864,17 @@ type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig
// Scope The GitHub scope that secrets should be synced to
Scope RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretType `json:"secretType,omitempty"`
}
// RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1Scope defines parameters for RemoveGitHubSecretSyncSecrets.
type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1Scope string
+// RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretType defines parameters for RemoveGitHubSecretSyncSecrets.
+type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig1SecretType string
+
// RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2 defines parameters for RemoveGitHubSecretSyncSecrets.
type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2 struct {
// Env The name of the GitHub environment.
@@ -17426,11 +17888,17 @@ type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig
// Scope The GitHub scope that secrets should be synced to
Scope RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretType `json:"secretType,omitempty"`
}
// RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2Scope defines parameters for RemoveGitHubSecretSyncSecrets.
type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2Scope string
+// RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretType defines parameters for RemoveGitHubSecretSyncSecrets.
+type RemoveGitHubSecretSyncSecrets200JSONResponseBodySecretSyncDestinationConfig2SecretType string
+
// RemoveGitHubSecretSyncSecrets200JSONResponseBody_SecretSync_DestinationConfig defines parameters for RemoveGitHubSecretSyncSecrets.
type RemoveGitHubSecretSyncSecrets200JSONResponseBody_SecretSync_DestinationConfig struct {
union json.RawMessage
@@ -17469,14 +17937,20 @@ type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0 struct
Org string `json:"org"`
// Scope The GitHub scope that secrets should be synced to
- Scope SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope `json:"scope"`
- SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
- Visibility SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility `json:"visibility"`
+ Scope SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType `json:"secretType,omitempty"`
+ SelectedRepositoryIds *[]float32 `json:"selectedRepositoryIds,omitempty"`
+ Visibility SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility `json:"visibility"`
}
// SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope defines parameters for SyncGitHubSecretSync.
type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Scope string
+// SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType defines parameters for SyncGitHubSecretSync.
+type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0SecretType string
+
// SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility defines parameters for SyncGitHubSecretSync.
type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig0Visibility string
@@ -17490,11 +17964,17 @@ type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1 struct
// Scope The GitHub scope that secrets should be synced to
Scope SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType `json:"secretType,omitempty"`
}
// SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope defines parameters for SyncGitHubSecretSync.
type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1Scope string
+// SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType defines parameters for SyncGitHubSecretSync.
+type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig1SecretType string
+
// SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 defines parameters for SyncGitHubSecretSync.
type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 struct {
// Env The name of the GitHub environment.
@@ -17508,11 +17988,17 @@ type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2 struct
// Scope The GitHub scope that secrets should be synced to
Scope SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope `json:"scope"`
+
+ // SecretType The type of GitHub secret to sync to: actions, dependabot, or codespaces. Defaults to actions. The repository-environment scope only supports actions, and codespaces is not available on GitHub Enterprise Server.
+ SecretType *SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType `json:"secretType,omitempty"`
}
// SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope defines parameters for SyncGitHubSecretSync.
type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2Scope string
+// SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType defines parameters for SyncGitHubSecretSync.
+type SyncGitHubSecretSync200JSONResponseBodySecretSyncDestinationConfig2SecretType string
+
// SyncGitHubSecretSync200JSONResponseBody_SecretSync_DestinationConfig defines parameters for SyncGitHubSecretSync.
type SyncGitHubSecretSync200JSONResponseBody_SecretSync_DestinationConfig struct {
union json.RawMessage
diff --git a/tests/fakes/github/controlplane.go b/tests/fakes/github/controlplane.go
index 0c2bbed96e..cc99aa14ed 100644
--- a/tests/fakes/github/controlplane.go
+++ b/tests/fakes/github/controlplane.go
@@ -36,6 +36,20 @@ func (cp *ControlPlane) OrgSecrets(tt *testing.T, org string) *Store {
return cp.State(tt).Stores["orgs/"+org]
}
+// RepoOfType is a repository's secrets of a type GitHub keeps apart from Actions
+// secrets, such as Dependabot.
+func (cp *ControlPlane) RepoOfType(tt *testing.T, full, secretType string) *Store {
+ tt.Helper()
+ return cp.State(tt).Stores["repos/"+full+"/"+secretType]
+}
+
+// OrgSecretsOfType is an organization's secrets of a type GitHub keeps apart from
+// Actions secrets, such as Codespaces.
+func (cp *ControlPlane) OrgSecretsOfType(tt *testing.T, org, secretType string) *Store {
+ tt.Helper()
+ return cp.State(tt).Stores["orgs/"+org+"/"+secretType]
+}
+
// Env is a repository environment's secrets.
func (cp *ControlPlane) Env(tt *testing.T, full, env string) *Store {
tt.Helper()
diff --git a/tests/fakes/github/fake.go b/tests/fakes/github/fake.go
index 77e5b4ddf8..32b238b6d0 100644
--- a/tests/fakes/github/fake.go
+++ b/tests/fakes/github/fake.go
@@ -47,11 +47,16 @@ func (a *Account) routes() *http.ServeMux {
// test registered anything.
mux.HandleFunc("GET /user", a.user)
- // One group per GitHubSyncScope. They differ only in the path they address, which
- // is why storeKey can fold all three into one address.
+ // One group per GitHubSyncScope, plus one per secret type GitHub keeps apart from
+ // Actions secrets. They differ only in the path they address, which is why
+ // storeKey can fold them all into one address.
a.secretRoutes(mux, "/orgs/{org}/actions/secrets")
a.secretRoutes(mux, "/repos/{owner}/{repo}/actions/secrets")
a.secretRoutes(mux, "/repos/{owner}/{repo}/environments/{env}/secrets")
+ for _, secretType := range secretTypes {
+ a.secretRoutes(mux, "/orgs/{org}/"+secretType+"/secrets")
+ a.secretRoutes(mux, "/repos/{owner}/{repo}/"+secretType+"/secrets")
+ }
return mux
}
@@ -126,13 +131,21 @@ func (a *Account) put(w http.ResponseWriter, r *http.Request) {
st, name := a.store(storeKey(r)), r.PathValue("name")
var body struct {
- EncryptedValue string `json:"encrypted_value"`
- KeyID string `json:"key_id"`
+ EncryptedValue string `json:"encrypted_value"`
+ KeyID string `json:"key_id"`
+ Visibility string `json:"visibility"`
+ SelectedRepositoryIDs []int `json:"selected_repository_ids"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
writeErr(w, http.StatusBadRequest, "Problems parsing JSON")
return
}
+ // GitHub requires a visibility on every organization secret, whatever its type.
+ if r.PathValue("org") != "" && !slices.Contains([]string{"all", "private", "selected"}, body.Visibility) {
+ writeErr(w, http.StatusUnprocessableEntity,
+ fmt.Sprintf("visibility %q is not one of all, private, selected", body.Visibility))
+ return
+ }
if body.KeyID != st.KeyID {
writeErr(w, http.StatusUnprocessableEntity,
fmt.Sprintf("key_id %q is not the public key for this scope", body.KeyID))
@@ -153,7 +166,12 @@ func (a *Account) put(w http.ResponseWriter, r *http.Request) {
}
_, existed := st.Secrets[name]
- st.Secrets[name] = Secret{Value: string(plain), UpdatedAt: time.Now().UTC()}
+ st.Secrets[name] = Secret{
+ Value: string(plain),
+ Visibility: body.Visibility,
+ SelectedRepositoryIDs: body.SelectedRepositoryIDs,
+ UpdatedAt: time.Now().UTC(),
+ }
detail := SecretDetail{Scope: storeKey(r), SecretName: name}
if existed {
a.events.Publish(SecretUpdated{detail})
@@ -236,12 +254,22 @@ func (a *Account) store(key string) *Store {
// storeKey folds whichever route matched into one address.
func storeKey(r *http.Request) string {
+ var key string
if org := r.PathValue("org"); org != "" {
- return "orgs/" + org
+ key = "orgs/" + org
+ } else {
+ key = "repos/" + r.PathValue("owner") + "/" + r.PathValue("repo")
+ if env := r.PathValue("env"); env != "" {
+ key += "/envs/" + env
+ }
}
- key := "repos/" + r.PathValue("owner") + "/" + r.PathValue("repo")
- if env := r.PathValue("env"); env != "" {
- key += "/envs/" + env
+
+ // Read from the matched pattern rather than the path, so an organization or
+ // repository named after a secret type cannot be mistaken for one.
+ for _, secretType := range secretTypes {
+ if strings.Contains(r.Pattern, "/"+secretType+"/secrets") {
+ return key + "/" + secretType
+ }
}
return key
}
diff --git a/tests/fakes/github/fake_test.go b/tests/fakes/github/fake_test.go
index 9561c99d6d..b7e681fd32 100644
--- a/tests/fakes/github/fake_test.go
+++ b/tests/fakes/github/fake_test.go
@@ -168,6 +168,40 @@ func TestGitHubFake_Secrets(t *testing.T) {
require.Contains(t, first.Header.Get("Link"), `rel="last"`, "the client parses rel=last for a page count")
require.Len(t, seen, 150)
})
+
+ t.Run("should keep Dependabot secrets apart when Actions uses the same repository", func(t *testing.T) {
+ // Setup
+ ts := newServer(t)
+ const dependabot = "/repos/acme/app/dependabot/secrets"
+ enc, keyID := seal(t, ts, "ghp_a", dependabot, "registry-token")
+
+ // Action
+ code, body := do(t, ts, http.MethodPut, "ghp_a", dependabot+"/NPM_TOKEN",
+ map[string]string{"encrypted_value": enc, "key_id": keyID})
+
+ // Assert
+ require.Equalf(t, http.StatusCreated, code, "PUT: %s", body)
+ _, own := do(t, ts, http.MethodGet, "ghp_a", dependabot, nil)
+ require.Contains(t, string(own), "NPM_TOKEN")
+ _, actions := do(t, ts, http.MethodGet, "ghp_a", repo, nil)
+ require.NotContains(t, string(actions), "NPM_TOKEN", "a Dependabot secret leaked into Actions secrets")
+ })
+
+ t.Run("should refuse an organization secret when it has no visibility", func(t *testing.T) {
+ // Setup
+ ts := newServer(t)
+ const org = "/orgs/acme/codespaces/secrets"
+ enc, keyID := seal(t, ts, "ghp_a", org, "v")
+
+ // Action
+ code, body := do(t, ts, http.MethodPut, "ghp_a", org+"/TOKEN",
+ map[string]string{"encrypted_value": enc, "key_id": keyID})
+
+ // Assert
+ require.Equalf(t, http.StatusUnprocessableEntity, code, "PUT without visibility: %s", body)
+ _, list := do(t, ts, http.MethodGet, "ghp_a", org, nil)
+ require.NotContains(t, string(list), "TOKEN")
+ })
}
func TestFakenet_Dispatch(t *testing.T) {
diff --git a/tests/fakes/github/state.go b/tests/fakes/github/state.go
index 2c26488e57..4576fe0022 100644
--- a/tests/fakes/github/state.go
+++ b/tests/fakes/github/state.go
@@ -23,14 +23,25 @@ type Account struct {
events fakenet.Emitter
}
-// Store is a bag of Actions secrets.
+// Dependabot and Codespaces name the secret types GitHub stores apart from Actions
+// secrets, at the same organizations and repositories.
+const (
+ Dependabot = "dependabot"
+ Codespaces = "codespaces"
+)
+
+var secretTypes = []string{Dependabot, Codespaces}
+
+// Store is a bag of secrets.
//
-// GitHubSyncScope has three values and they differ only in the path they address, so
-// one type covers all of them:
+// GitHubSyncScope has three values and the secret types differ only in the path they
+// address, so one type covers all of them:
//
-// orgs/acme organization secrets
-// repos/acme/app repository secrets
-// repos/acme/app/envs/prod repository environment secrets
+// orgs/acme organization Actions secrets
+// repos/acme/app repository Actions secrets
+// repos/acme/app/envs/prod repository environment Actions secrets
+// orgs/acme/dependabot organization Dependabot secrets
+// repos/acme/app/codespaces repository Codespaces secrets
type Store struct {
KeyID string `json:"keyId"`
Secrets map[string]Secret `json:"secrets"`
@@ -43,6 +54,9 @@ type Store struct {
}
type Secret struct {
- Value string `json:"value"`
- UpdatedAt time.Time `json:"updatedAt"`
+ Value string `json:"value"`
+ // Organization secrets only: which of the organization's repositories can read it.
+ Visibility string `json:"visibility,omitempty"`
+ SelectedRepositoryIDs []int `json:"selectedRepositoryIds,omitempty"`
+ UpdatedAt time.Time `json:"updatedAt"`
}
diff --git a/tests/suites/secretmanager/syncs/github_test.go b/tests/suites/secretmanager/syncs/github_test.go
index 382d530580..152caf4e4b 100644
--- a/tests/suites/secretmanager/syncs/github_test.go
+++ b/tests/suites/secretmanager/syncs/github_test.go
@@ -2,13 +2,16 @@ package syncs_test
import (
"fmt"
+ "net/http"
"testing"
+ "github.com/Infisical/infisical/tests/clients/api"
"github.com/Infisical/infisical/tests/fakes/github"
"github.com/Infisical/infisical/tests/fixture"
"github.com/Infisical/infisical/tests/fixture/secretmanager"
"github.com/Infisical/infisical/tests/harness"
"github.com/Infisical/infisical/tests/infra/fakenet"
+ "github.com/Infisical/infisical/tests/internal/apierr"
"github.com/Infisical/infisical/tests/internal/spec"
"github.com/stretchr/testify/require"
)
@@ -140,6 +143,61 @@ func TestGitHubSync_SyncSecrets(t *testing.T) {
require.Len(t, gh.OrgSecrets(t, "acme").Secrets, n)
})
+ t.Run("should deliver to Dependabot secrets and leave Actions secrets alone when the type is Dependabot", func(t *testing.T) {
+ t.Parallel()
+
+ // Setup
+ proj, conn, gh := setup(t)
+ dependabot := api.CreateGitHubSecretSyncJSONBodyDestinationConfig1SecretTypeDependabot
+ s := newSync(t, proj, conn, func(tt *testing.T) api.CreateGitHubSecretSyncJSONBody_DestinationConfig {
+ var d api.CreateGitHubSecretSyncJSONBody_DestinationConfig
+ require.NoError(tt, d.FromCreateGitHubSecretSyncJSONBodyDestinationConfig1(
+ api.CreateGitHubSecretSyncJSONBodyDestinationConfig1{
+ Owner: "acme", Repo: "app", Scope: "repository", SecretType: &dependabot,
+ }))
+ return d
+ })
+ secretmanager.CreateSecret(t, proj, "dev", "NPM_TOKEN", "npm_abc")
+
+ // Action
+ s.trigger(t)
+
+ // Assert
+ require.Equal(t, "npm_abc", gh.RepoOfType(t, "acme/app", github.Dependabot).Secrets["NPM_TOKEN"].Value)
+ require.Nil(t, gh.Repo(t, "acme/app"), "a Dependabot sync touched the repository's Actions secrets")
+ })
+
+ t.Run("should share a Codespaces secret with only the selected repositories when visibility is selected", func(t *testing.T) {
+ t.Parallel()
+
+ // Setup
+ proj, conn, gh := setup(t)
+ codespaces := api.CreateGitHubSecretSyncJSONBodyDestinationConfig0SecretTypeCodespaces
+ s := newSync(t, proj, conn, func(tt *testing.T) api.CreateGitHubSecretSyncJSONBody_DestinationConfig {
+ var d api.CreateGitHubSecretSyncJSONBody_DestinationConfig
+ require.NoError(tt, d.FromCreateGitHubSecretSyncJSONBodyDestinationConfig0(
+ api.CreateGitHubSecretSyncJSONBodyDestinationConfig0{
+ Org: "acme",
+ Scope: "organization",
+ Visibility: api.CreateGitHubSecretSyncJSONBodyDestinationConfig0VisibilitySelected,
+ SelectedRepositoryIds: &[]float32{42},
+ SecretType: &codespaces,
+ }))
+ return d
+ })
+ secretmanager.CreateSecret(t, proj, "dev", "DEV_DB_URL", "postgres://dev")
+
+ // Action
+ s.trigger(t)
+
+ // Assert
+ got := gh.OrgSecretsOfType(t, "acme", github.Codespaces).Secrets["DEV_DB_URL"]
+ require.Equal(t, "postgres://dev", got.Value)
+ require.Equal(t, "selected", got.Visibility)
+ require.Equal(t, []int{42}, got.SelectedRepositoryIDs)
+ require.Nil(t, gh.OrgSecrets(t, "acme"), "a Codespaces sync touched the organization's Actions secrets")
+ })
+
t.Run("should fail naming the limit when more than 100 go to a repository", func(t *testing.T) {
t.Parallel()
spec.Why(t, `Infisical checks before sending, so the sync fails rather than writing
@@ -194,4 +252,30 @@ func TestGitHubSync_Create(t *testing.T) {
// Assert
gh.ExpectNoEvent[github.SecretCreated](t, nil)
})
+
+ t.Run("should refuse a Dependabot sync to a repository environment and write nothing", func(t *testing.T) {
+ t.Parallel()
+
+ // Setup
+ proj, conn, gh := setup(t)
+ secretmanager.CreateSecret(t, proj, "dev", "PRESENT", "1")
+ dependabot := api.CreateGitHubSecretSyncJSONBodyDestinationConfig2SecretTypeDependabot
+ body := syncBody(t, proj, conn, func(tt *testing.T) api.CreateGitHubSecretSyncJSONBody_DestinationConfig {
+ var d api.CreateGitHubSecretSyncJSONBody_DestinationConfig
+ require.NoError(tt, d.FromCreateGitHubSecretSyncJSONBodyDestinationConfig2(
+ api.CreateGitHubSecretSyncJSONBodyDestinationConfig2{
+ Owner: "acme", Repo: "app", Env: "prod", Scope: "repository-environment", SecretType: &dependabot,
+ }))
+ return d
+ }, autoSync(true))
+
+ // Action
+ res, err := proj.Tenant().Admin.API.CreateGitHubSecretSyncWithResponse(t.Context(), body)
+
+ // Assert
+ require.NoError(t, err)
+ require.Equalf(t, http.StatusBadRequest, res.StatusCode(), "%s", apierr.Body(res.Body))
+ require.Contains(t, string(res.Body), "Repository environment scope is only available for Actions secrets")
+ gh.ExpectNoEvent[github.SecretCreated](t, nil)
+ })
}
diff --git a/tests/suites/secretmanager/syncs/helpers_test.go b/tests/suites/secretmanager/syncs/helpers_test.go
index e8649d8fb6..3216e138f3 100644
--- a/tests/suites/secretmanager/syncs/helpers_test.go
+++ b/tests/suites/secretmanager/syncs/helpers_test.go
@@ -66,6 +66,17 @@ func newSync(tt *testing.T, p *fixture.Project, conn *fixture.AppConnection,
dest destination, opts ...syncOption) *sync {
tt.Helper()
+ res, err := p.Tenant().Admin.API.CreateGitHubSecretSyncWithResponse(tt.Context(), syncBody(tt, p, conn, dest, opts...))
+ require.NoError(tt, err, "creating a sync")
+ require.NotNilf(tt, res.JSON200, "creating a sync returned %d: %s", res.StatusCode(), apierr.Body(res.Body))
+ return &sync{ID: res.JSON200.SecretSync.Id, proj: p}
+}
+
+// syncBody is the create request newSync sends, for a test that expects it refused.
+func syncBody(tt *testing.T, p *fixture.Project, conn *fixture.AppConnection,
+ dest destination, opts ...syncOption) api.CreateGitHubSecretSyncJSONRequestBody {
+ tt.Helper()
+
cfg := syncConfig{autoSync: false, environment: "dev", secretPath: "/"}
for _, o := range opts {
o(&cfg)
@@ -88,11 +99,7 @@ func newSync(tt *testing.T, p *fixture.Project, conn *fixture.AppConnection,
if cfg.disableSecretDeletion {
body.SyncOptions.DisableSecretDeletion = &cfg.disableSecretDeletion
}
-
- res, err := p.Tenant().Admin.API.CreateGitHubSecretSyncWithResponse(tt.Context(), body)
- require.NoError(tt, err, "creating a sync")
- require.NotNilf(tt, res.JSON200, "creating a sync returned %d: %s", res.StatusCode(), apierr.Body(res.Body))
- return &sync{ID: res.JSON200.SecretSync.Id, proj: p}
+ return body
}
// trigger runs the sync and waits on its status rather than the destination, so a