Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
chore: resolve merge conflicts
Chukwunonso Franka5b37c80ad83
diff --cc backend/src/integrations/sync.tsindex 0d9a5cbd7b,8faac12576..715e310250--- a/backend/src/integrations/sync.ts+++ b/backend/src/integrations/sync.ts@@@ -222,13 -233,20 +235,27 @@@ const syncSecrets = async (accessToken,});break;+ case INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM:+ await syncSecretsDigitalOceanAppPlatform({+ integration,+ secrets,+ accessToken,+ });+ break;+ case INTEGRATION_CLOUD_66:+ await syncSecretsCloud66({+ integration,+ secrets,+ accessToken+ });+ break;+ case INTEGRATION_NORTHFLANK:+ await syncSecretsNorthflank({+ integration,+ secrets,+ accessToken+ });+ break;}};@@@ -2110,38 -2229,141 +2238,175 @@@ const syncSecretsCodefresh = async ();};+ /**+ * Sync/push [secrets] to DigitalOcean App Platform application with name [integration.app]+ * @param {Object} obj+ * @param {IIntegration} obj.integration - integration details+ * @param {IIntegrationAuth} obj.integrationAuth - integration auth details+ * @param {Object} obj.secrets - secrets to push to integration (object where keys are secret keys and values are secret values)+ * @param {String} obj.accessToken - personal access token for DigitalOcean+ */+ const syncSecretsDigitalOceanAppPlatform = async ({+ integration,+ secrets,+ accessToken+ }: {+ integration: IIntegration;+ secrets: any;+ accessToken: string;+ }) => {+ await standardRequest.put(+ `${INTEGRATION_DIGITAL_OCEAN_API_URL}/v2/apps/${integration.appId}`,+ {+ spec: {+ name: integration.app,+ envs: Object.entries(secrets).map(([key, value]) => ({ key, value }))+ }+ },+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ Accept: "application/json"+ }+ }+ );+ }++ /**+ * Sync/push [secrets] to Cloud66 application with name [integration.app]+ * @param {Object} obj+ * @param {IIntegration} obj.integration - integration details+ * @param {IIntegrationAuth} obj.integrationAuth - integration auth details+ * @param {Object} obj.secrets - secrets to push to integration (object where keys are secret keys and values are secret values)+ * @param {String} obj.accessToken - access token for Cloud66 integration+ */+ const syncSecretsCloud66 = async ({+ integration,+ secrets,+ accessToken+ }: {+ integration: IIntegration;+ secrets: any;+ accessToken: string;+ }) => {++ interface Cloud66Secret {+ id: number;+ key: string;+ value: string;+ readonly: boolean;+ created_at: string;+ updated_at: string;+ is_password: boolean;+ is_generated: boolean;+ history: any[];+ }++ // get all current secrets+ const res = (+ await standardRequest.get(+ `${INTEGRATION_CLOUD_66_API_URL}/3/stacks/${integration.appId}/environments`,+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ Accept: "application/json"+ }+ }+ )+ )+ .data+ .response+ .filter((secret: Cloud66Secret) => !secret.readonly || !secret.is_generated)+ .reduce(+ (obj: any, secret: any) => ({+ ...obj,+ [secret.key]: secret+ }),+ {}+ );++ for await (const key of Object.keys(secrets)) {+ if (key in res) {+ // update existing secret+ await standardRequest.put(+ `${INTEGRATION_CLOUD_66_API_URL}/3/stacks/${integration.appId}/environments/${key}`,+ {+ key,+ value: secrets[key]+ },+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ Accept: "application/json"+ }+ }+ );+ } else {+ // create new secret+ await standardRequest.post(+ `${INTEGRATION_CLOUD_66_API_URL}/3/stacks/${integration.appId}/environments`,+ {+ key,+ value: secrets[key]+ },+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ Accept: "application/json"+ }+ }+ );+ }+ }++ for await (const key of Object.keys(res)) {+ if (!(key in secrets)) {+ // delete secret+ await standardRequest.delete(+ `${INTEGRATION_CLOUD_66_API_URL}/3/stacks/${integration.appId}/environments/${key}`,+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ Accept: "application/json"+ }+ }+ );+ }+ }+ };++ /* Sync/push [secrets] to Northflank+ * @param {Object} obj+ * @param {IIntegration} obj.integration - integration details+ * @param {Object} obj.secrets - secrets to push to integration (object where keys are secret keys and values are secret values)+ * @param {String} obj.accessToken - access token for Northflank integration+ */+const syncSecretsNorthflank = async ({+ integration,+ secrets,+ accessToken+}: {+ integration: IIntegration;+ secrets: any;+ accessToken: string;+}) => {++ const modifiedFormatForSecretInjection = {+ secrets: {+ variables: secrets+ }+ }++ await standardRequest.post(+ `${INTEGRATION_NORTHFLANK_API_URL}/v1/projects/${integration.appId}/secrets/${integration.secretGroup}`,+ modifiedFormatForSecretInjection,+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Accept-Encoding": "application/json"+ }+ }+ );+};+export { syncSecrets };diff --cc backend/src/models/integration.tsindex 8400ab819a,34dba6cfc8..8608aa964d--- a/backend/src/models/integration.ts+++ b/backend/src/models/integration.ts@@@ -61,7 -63,8 +65,9 @@@ export interface IIntegration| "cloudflare-pages"| "bitbucket"| "codefresh"+ | "digital-ocean-app-platform"+ | "cloud-66"+ | "northflank"integrationAuth: Types.ObjectId;}@@@ -152,8 -156,9 +159,10 @@@ const integrationSchema = new Schema<IIINTEGRATION_HASHICORP_VAULT,INTEGRATION_CLOUDFLARE_PAGES,INTEGRATION_BITBUCKET,+ INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,INTEGRATION_CODEFRESH,+ INTEGRATION_CLOUD_66,+ INTEGRATION_NORTHFLANK],required: true,},diff --cc backend/src/models/integrationAuth.tsindex d36eee47fe,100fe0db4d..dd8d0cd194--- a/backend/src/models/integrationAuth.ts+++ b/backend/src/models/integrationAuth.ts@@@ -47,8 -49,10 +50,11 @@@ export interface IIntegrationAuth exten| "checkly"| "cloudflare-pages"| "codefresh"+ | "digital-ocean-app-platform"| "bitbucket"+ | "cloud-66"- | "terraform-cloud";++ | "terraform-cloud"+ | "northflank";teamId: string;accountId: string;url: string;@@@ -95,8 -100,9 +102,10 @@@ const integrationAuthSchema = new SchemINTEGRATION_HASHICORP_VAULT,INTEGRATION_CLOUDFLARE_PAGES,INTEGRATION_BITBUCKET,+ INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,INTEGRATION_CODEFRESH,+ INTEGRATION_CLOUD_66,+ INTEGRATION_NORTHFLANK],required: true,},diff --cc backend/src/variables/integration.tsindex b9595cbcfd,21d8e36c05..42066e3e59--- a/backend/src/variables/integration.ts+++ b/backend/src/variables/integration.ts@@@ -29,7 -30,8 +30,9 @@@ export const INTEGRATION_HASHICORP_VAULexport const INTEGRATION_CLOUDFLARE_PAGES = "cloudflare-pages";export const INTEGRATION_BITBUCKET = "bitbucket";export const INTEGRATION_CODEFRESH = "codefresh";+ export const INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM = "digital-ocean-app-platform";+ export const INTEGRATION_CLOUD_66 = "cloud-66";+export const INTEGRATION_NORTHFLANK = "northflank";export const INTEGRATION_SET = new Set([INTEGRATION_AZURE_KEY_VAULT,INTEGRATION_HEROKU,@@@ -47,8 -50,9 +51,10 @@@INTEGRATION_HASHICORP_VAULT,INTEGRATION_CLOUDFLARE_PAGES,INTEGRATION_BITBUCKET,+ INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,INTEGRATION_CODEFRESH,- INTEGRATION_CLOUD_66++ INTEGRATION_CLOUD_66,+ INTEGRATION_NORTHFLANK]);// integration types@@@ -81,7 -86,8 +88,9 @@@ export const INTEGRATION_TERRAFORM_CLOUexport const INTEGRATION_CLOUDFLARE_PAGES_API_URL = "https://api.cloudflare.com";export const INTEGRATION_BITBUCKET_API_URL = "https://api.bitbucket.org";export const INTEGRATION_CODEFRESH_API_URL = "https://g.codefresh.io/api";+ export const INTEGRATION_DIGITAL_OCEAN_API_URL = "https://api.digitalocean.com";+ export const INTEGRATION_CLOUD_66_API_URL = "https://app.cloud66.com/api";+export const INTEGRATION_NORTHFLANK_API_URL = "https://api.northflank.com";export const getIntegrationOptions = async () => {const INTEGRATION_OPTIONS = [@@@ -275,15 -290,24 +293,33 @@@clientId: "",docsLink: "",},+ {+ name: "Digital Ocean App Platform",+ slug: "digital-ocean-app-platform",+ image: "Digital Ocean.png",+ isAvailable: true,+ type: "pat",+ clientId: "",+ docsLink: "",+ },+ {+ name: "Cloud 66",+ slug: "cloud-66",+ image: "Cloud 66.png",+ isAvailable: true,+ type: "pat",+ clientId: "",+ docsLink: "",+ },+ {+ name: "Northflank",+ slug: "northflank",+ image: "Northflank.png",+ isAvailable: true,+ type: "pat",+ clientId: "",+ docsLink: ""- }++ },]return INTEGRATION_OPTIONS;diff --cc frontend/public/data/frequentConstants.tsindex c2c9e5c9a0,b504a53c56..f05c2ade0e--- a/frontend/public/data/frequentConstants.ts+++ b/frontend/public/data/frequentConstants.ts@@@ -22,8 -23,9 +23,10 @@@ const integrationSlugNameMapping: Mappi"hashicorp-vault": "Vault","cloudflare-pages": "Cloudflare Pages","codefresh": "Codefresh",+ "digital-ocean-app-platform": "Digital Ocean App Platform",bitbucket: "BitBucket",- "cloud-66": "Cloud 66"++ "cloud-66": "Cloud 66",+ northflank: "Northflank"};const envMapping: Mapping = {diff --cc frontend/src/pages/integrations/northflank/create.tsxindex 7ffd7151a4,0000000000..adead79fe3mode 100644,000000..100644--- a/frontend/src/pages/integrations/northflank/create.tsx+++ b/frontend/src/pages/integrations/northflank/create.tsx@@@ -1,197 -1,0 +1,197 @@@+import { useEffect, useState } from "react";+import { useRouter } from "next/router";+import queryString from "query-string";++import {+ Button,+ Card,+ CardTitle,+ FormControl,+ Input,+ Select,+ SelectItem+} from "../../../components/v2";+import {+ useGetIntegrationAuthApps,+ useGetIntegrationAuthById+} from "../../../hooks/api/integrationAuth";+import { useGetWorkspaceById } from "../../../hooks/api/workspace";+import createIntegration from "../../api/integrations/createIntegration";++export default function NorthflankCreateIntegrationPage() {+ const router = useRouter();++ const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);++ const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");+ const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");+ const { data: integrationAuthApps } = useGetIntegrationAuthApps({+ integrationAuthId: (integrationAuthId as string) ?? ""+ });++ const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");+ const [secretPath, setSecretPath] = useState("/");+ const [targetApp, setTargetApp] = useState("");+ const [secretGroupList, setSecretGroupList] = useState<any>([]);+ const [targetSecretGroup, setTargetSecretGroup] = useState("");++ const [isLoading, setIsLoading] = useState(false);++ useEffect(() => {+ if (workspace) {+ setSelectedSourceEnvironment(workspace.environments[0].slug);+ }+ }, [workspace]);++ useEffect(() => {+ if (integrationAuthApps) {+ if (integrationAuthApps.length > 0) {+ setTargetApp(integrationAuthApps[0].name);+ } else {+ setTargetApp("none");+ }+ }+ }, [integrationAuthApps]);++ useEffect(() => {+ if (integrationAuthApps) {+ if (integrationAuthApps.length > 0) {+ const selectedApp = integrationAuthApps?.filter((integrationAuthApp) => integrationAuthApp.name === targetApp);- if (selectedApp.length > 0) {++ if (selectedApp.length > 0 && selectedApp[0].secretGroups) {+ setSecretGroupList(selectedApp[0].secretGroups);+ setTargetSecretGroup(selectedApp[0]?.secretGroups[0]);+ } else {+ setSecretGroupList([]);+ setTargetSecretGroup("none");+ }+ }+ }+ }, [targetApp])++ const handleButtonClick = async () => {+ try {+ if (!integrationAuth?._id) return;++ setIsLoading(true);++ await createIntegration({+ integrationAuthId: integrationAuth?._id,+ isActive: true,+ app: targetApp,+ appId:+ integrationAuthApps?.find((integrationAuthApp) => integrationAuthApp.name === targetApp)+ ?.appId ?? null,+ sourceEnvironment: selectedSourceEnvironment,+ targetEnvironment: null,+ targetEnvironmentId: null,+ targetService: null,+ targetServiceId: null,+ owner: null,+ path: null,+ region: null,+ secretPath,+ secretGroup: targetSecretGroup+ });++ setIsLoading(false);++ router.push(`/integrations/${localStorage.getItem("projectData.id")}`);+ } catch (err) {+ console.error(err);+ }+ };++ return integrationAuth &&+ workspace &&+ selectedSourceEnvironment &&+ integrationAuthApps &&+ targetApp ? (+ <div className="flex h-full w-full items-center justify-center">+ <Card className="max-w-md rounded-md p-8">+ <CardTitle className="text-center">Northflank Integration</CardTitle>+ <FormControl label="Project Environment" className="mt-4">+ <Select+ value={selectedSourceEnvironment}+ onValueChange={(val) => setSelectedSourceEnvironment(val)}+ className="w-full border border-mineshaft-500"+ >+ {workspace?.environments.map((sourceEnvironment) => (+ <SelectItem+ value={sourceEnvironment.slug}+ key={`source-environment-${sourceEnvironment.slug}`}+ >+ {sourceEnvironment.name}+ </SelectItem>+ ))}+ </Select>+ </FormControl>+ <FormControl label="Secrets Path">+ <Input+ value={secretPath}+ onChange={(evt) => setSecretPath(evt.target.value)}+ placeholder="Provide a path, default is /"+ />+ </FormControl>+ <FormControl label="Northflank Project" className="mt-4">+ <Select+ value={targetApp}+ onValueChange={(val) => setTargetApp(val)}+ className="w-full border border-mineshaft-500"+ isDisabled={integrationAuthApps.length === 0}+ >+ {integrationAuthApps.length > 0 ? (+ integrationAuthApps.map((integrationAuthApp) => (+ <SelectItem+ value={integrationAuthApp.name}+ key={`target-environment-${integrationAuthApp.name}`}+ >+ {integrationAuthApp.name}+ </SelectItem>+ ))+ ) : (+ <SelectItem value="none" key="target-app-none">+ No projects found+ </SelectItem>+ )}+ </Select>+ </FormControl>+ <FormControl label="Secret Group" className="mt-4">+ <Select+ value={targetSecretGroup}+ onValueChange={(val) => setTargetSecretGroup(val)}+ className="w-full border border-mineshaft-500"+ isDisabled={secretGroupList.length === 0}+ >+ {secretGroupList.length > 0 ? (+ secretGroupList.map((group: any) => (+ <SelectItem+ value={group}+ key={`target-secret-group-${group}`}+ >+ {group}+ </SelectItem>+ ))+ ) : (- <SelectItem value="No secret groups found" key="target-app-none">++ <SelectItem value="none" key="target-secret-group-none">+ No secret groups found+ </SelectItem>+ )}+ </Select>+ </FormControl>+ <Button+ onClick={handleButtonClick}+ color="mineshaft"+ className="mt-4"+ isLoading={isLoading}- isDisabled={integrationAuthApps.length === 0 && secretGroupList === 0}++ isDisabled={secretGroupList === 0}+ >+ Create Integration+ </Button>+ </Card>+ </div>+ ) : (+ <div />+ );+}++NorthflankCreateIntegrationPage.requireAuth = true;diff --cc frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsxindex 3355026ea6,5d551b0b6d..c453cdf377--- a/frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsx+++ b/frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsx@@@ -98,9 -101,12 +101,15 @@@ export const redirectForProviderAuth =case "codefresh":link = `${window.location.origin}/integrations/codefresh/authorize`;break;+ case "digital-ocean-app-platform":+ link = `${window.location.origin}/integrations/digital-ocean-app-platform/authorize`;+ break;+ case "cloud-66":+ link = `${window.location.origin}/integrations/cloud-66/authorize`;+ break;+ case "northflank":+ link = `${window.location.origin}/integrations/northflank/authorize`;+ break;default:break;}