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 Frankc2be6674b1d7
diff --cc backend/src/integrations/apps.tsindex 64fba3367d,dea45ac992..8202a9d025--- a/backend/src/integrations/apps.ts+++ b/backend/src/integrations/apps.ts@@@ -145,13 -149,19 +151,24 @@@ const getApps = async (apps = await getAppsCloudflarePages({accessToken,accountId: accessId- })+ });+ break;+ case INTEGRATION_NORTHFLANK:+ apps = await getAppsNorthflank({+ accessToken,+ });break;+ case INTEGRATION_BITBUCKET:+ apps = await getAppsBitBucket({+ accessToken,+ workspaceSlug+ });+ break;+ case INTEGRATION_CODEFRESH:+ apps = await getAppsCodefresh({+ accessToken,+ });+ break;}return apps;@@@ -719,71 -790,56 +797,114 @@@ const getAppsBitBucket = async (});- const apps = data.result.map((a: any) => {- return {- name: a.name,- appId: a.id,- };- });- return apps;+ if (data?.values.length > 0) {+ data.values.forEach((repository) => {+ repositories.push(repository)+ })+ }++ if (data.next) {+ repositoriesUrl = data.next+ } else {+ hasNextPage = false+ }+ }++ const apps = repositories.map((repository) => {+ return {+ name: repository.name,+ appId: repository.uuid,+ };+ });+ return apps;}+ /* Return list of projects for Northflank integration+ * @param {Object} obj+ * @param {String} obj.accessToken - access token for Northflank API+ * @returns {Object[]} apps - names of Northflank apps+ * @returns {String} apps.name - name of Northflank app+ */+const getAppsNorthflank = async ({ accessToken }: { accessToken: string }) => {+ const {+ data: {+ data: {+ projects+ }+ }+ } = await standardRequest.get(+ `${INTEGRATION_NORTHFLANK_API_URL}/v1/projects`,+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Accept-Encoding": "application/json",+ },+ }+ );++ const apps = projects.map((a: any) => {+ return {+ name: a.name,+ appId: a.id,+ secretGroups: []+ };+ });++ for (let i = 0; i < apps.length; i++) {+ const appName = apps[i].name;+ const {+ data: {+ data: {+ secrets+ }+ }+ } = await standardRequest.get(+ `${INTEGRATION_NORTHFLANK_API_URL}/v1/projects/${appName}/secrets`,+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Accept-Encoding": "application/json",+ },+ }+ );++ const secretGroups = secrets.map((a: any) => {+ return a.id+ });++ apps[i].secretGroups = secretGroups+ }++ return apps;+};+ /**+ * Return list of projects for Supabase integration+ * @param {Object} obj+ * @param {String} obj.accessToken - access token for Supabase API+ * @returns {Object[]} apps - names of Supabase apps+ * @returns {String} apps.name - name of Supabase app+ */++ const getAppsCodefresh = async ({+ accessToken,+ }: {+ accessToken: string;+ }) => {+ const res = (+ await standardRequest.get(`${INTEGRATION_CODEFRESH_API_URL}/projects`, {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Accept-Encoding": "application/json",+ },+ })+ ).data;++ const apps = res.projects.map((a: any) => ({+ name: a.projectName,+ appId: a.id,+ }));++ return apps;++ };export { getApps };diff --cc backend/src/integrations/sync.tsindex 6f2d8a8187,2c2ed8d1ff..2ba9ab60fa--- a/backend/src/integrations/sync.ts+++ b/backend/src/integrations/sync.ts@@@ -198,20 -200,27 +202,34 @@@ const syncSecrets = async (break;case INTEGRATION_CLOUDFLARE_PAGES:await syncSecretsCloudflarePages({- integration,- secrets,- accessId,- accessToken+ integration,+ secrets,+ accessId,+ accessToken+ });+ break;+ case INTEGRATION_CODEFRESH:+ await syncSecretsCodefresh({+ integration,+ secrets,+ accessToken,+ });+ break;+ case INTEGRATION_BITBUCKET:+ await syncSecretsBitBucket({+ integration,+ secrets,+ accessToken,});break;+ case INTEGRATION_NORTHFLANK:+ await syncSecretsNorthflank({+ integration,+ secrets,+ accessToken+ });+ break;- }+ }};/**@@@ -1935,48 -1942,163 +1951,196 @@@ const syncSecretsCloudflarePages = asyn};await standardRequest.patch(- `${INTEGRATION_CLOUDFLARE_PAGES_API_URL}/client/v4/accounts/${accessId}/pages/projects/${integration.app}`,- data,- {- headers: {- Authorization: `Bearer ${accessToken}`,- "Accept": "application/json",- },- }+ `${INTEGRATION_CLOUDFLARE_PAGES_API_URL}/client/v4/accounts/${accessId}/pages/projects/${integration.app}`,+ data,+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Accept": "application/json",+ },+ });}++ /**+ * Sync/push [secrets] to BitBucket repo 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 BitBucket integration+ */+ const syncSecretsBitBucket = async ({+ integration,+ secrets,+ accessToken,+ }: {+ integration: IIntegration;+ secrets: any;+ accessToken: string;+ }) => {+ interface VariablesResponse {+ size: number;+ page: number;+ pageLen: number;+ next: string;+ previous: string;+ values: Array<BitbucketVariable>;+ }++ interface BitbucketVariable {+ type: string;+ uuid: string;+ key: string;+ value: string;+ secured: boolean;+ }++ const res: { [key: string]: BitbucketVariable } = {};++ let hasNextPage = true;+ let variablesUrl = `${INTEGRATION_BITBUCKET_API_URL}/2.0/repositories/${integration.targetEnvironmentId}/${integration.appId}/pipelines_config/variables`++ while (hasNextPage) {+ const { data }: { data: VariablesResponse } = await standardRequest.get(+ variablesUrl,+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Accept": "application/json",+ },+ }+ );++ if (data?.values.length > 0) {+ data.values.forEach((variable) => {+ res[variable.key] = variable;+ });+ }++ if (data.next) {+ variablesUrl = data.next+ } else {+ hasNextPage = false+ }+ }++ for await (const key of Object.keys(secrets)) {+ if (key in res) {+ // update existing secret+ await standardRequest.put(+ `${variablesUrl}/${res[key].uuid}`,+ {+ key,+ value: secrets[key],+ secured: true+ },+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Accept": "application/json",+ },+ }+ );+ } else {+ // create new secret+ await standardRequest.post(+ variablesUrl,+ {+ key,+ value: secrets[key],+ secured: true+ },+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Accept": "application/json",+ },+ }+ );+ }+ }++ for await (const key of Object.keys(res)) {+ if (!(key in secrets)) {+ // delete secret+ await standardRequest.delete(+ `${variablesUrl}/${res[key].uuid}`,+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Accept": "application/json",+ }+ }+ );+ }+ }+ }++ /*+ * Sync/push [secrets] to Codefresh with name [integration.app]+ * @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 Codefresh integration+ */+ const syncSecretsCodefresh = async ({+ integration,+ secrets,+ accessToken,+ }: {+ integration: IIntegration;+ secrets: any;+ accessToken: string;+ }) => {+ await standardRequest.patch(+ `${INTEGRATION_CODEFRESH_API_URL}/projects/${integration.appId}`,+ {+ variables: Object.keys(secrets).map((key) => ({+ key,+ value: secrets[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 a11fe688c5,05e089f373..6e3e82694f--- a/backend/src/models/integration.ts+++ b/backend/src/models/integration.ts@@@ -57,7 -57,8 +59,9 @@@ export interface IIntegration| "checkly"| "hashicorp-vault"| "cloudflare-pages"- | "northflank";+ | "bitbucket"+ | "codefresh"++ | "northflank"integrationAuth: Types.ObjectId;}@@@ -147,7 -148,8 +151,9 @@@ const integrationSchema = new Schema<IIINTEGRATION_CHECKLY,INTEGRATION_HASHICORP_VAULT,INTEGRATION_CLOUDFLARE_PAGES,+ INTEGRATION_BITBUCKET,- INTEGRATION_CODEFRESH++ INTEGRATION_CODEFRESH,+ INTEGRATION_NORTHFLANK],required: true,},diff --cc backend/src/models/integrationAuth.tsindex 4cf9817b39,409249bf36..d36eee47fe--- a/backend/src/models/integrationAuth.ts+++ b/backend/src/models/integrationAuth.ts@@@ -26,7 -27,26 +28,27 @@@ importexport interface IIntegrationAuth extends Document {_id: Types.ObjectId;workspace: Types.ObjectId;- integration: "heroku" | "vercel" | "netlify" | "github" | "gitlab" | "render" | "railway" | "flyio" | "azure-key-vault" | "laravel-forge" | "circleci" | "travisci" | "supabase" | "aws-parameter-store" | "aws-secret-manager" | "checkly" | "cloudflare-pages" | "northflank";+ integration:+ | "heroku"+ | "vercel"+ | "netlify"+ | "github"+ | "gitlab"+ | "render"+ | "railway"+ | "flyio"+ | "azure-key-vault"+ | "laravel-forge"+ | "circleci"+ | "travisci"+ | "supabase"+ | "aws-parameter-store"+ | "aws-secret-manager"+ | "checkly"+ | "cloudflare-pages"+ | "codefresh"- | "bitbucket";++ | "bitbucket"++ | "northflank";teamId: string;accountId: string;url: string;@@@ -72,7 -92,8 +94,9 @@@ const integrationAuthSchema = new SchemINTEGRATION_SUPABASE,INTEGRATION_HASHICORP_VAULT,INTEGRATION_CLOUDFLARE_PAGES,+ INTEGRATION_BITBUCKET,- INTEGRATION_CODEFRESH++ INTEGRATION_CODEFRESH,+ INTEGRATION_NORTHFLANK],required: true,},diff --cc backend/src/variables/integration.tsindex 109e33620c,e99b5a3bf8..b9595cbcfd--- a/backend/src/variables/integration.ts+++ b/backend/src/variables/integration.ts@@@ -26,7 -27,8 +27,9 @@@ export const INTEGRATION_SUPABASE = "suexport const INTEGRATION_CHECKLY = "checkly";export const INTEGRATION_HASHICORP_VAULT = "hashicorp-vault";export const INTEGRATION_CLOUDFLARE_PAGES = "cloudflare-pages";+ export const INTEGRATION_BITBUCKET = "bitbucket";+ export const INTEGRATION_CODEFRESH = "codefresh";+export const INTEGRATION_NORTHFLANK = "northflank";export const INTEGRATION_SET = new Set([INTEGRATION_AZURE_KEY_VAULT,INTEGRATION_HEROKU,@@@ -43,7 -45,8 +46,9 @@@INTEGRATION_CHECKLY,INTEGRATION_HASHICORP_VAULT,INTEGRATION_CLOUDFLARE_PAGES,+ INTEGRATION_BITBUCKET,- INTEGRATION_CODEFRESH++ INTEGRATION_CODEFRESH,+ INTEGRATION_NORTHFLANK]);// integration types@@@ -73,7 -77,8 +79,9 @@@ export const INTEGRATION_SUPABASE_API_Uexport const INTEGRATION_LARAVELFORGE_API_URL = "https://forge.laravel.com";export const INTEGRATION_CHECKLY_API_URL = "https://api.checklyhq.com";export 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_NORTHFLANK_API_URL = "https://api.northflank.com";export const getIntegrationOptions = async () => {const INTEGRATION_OPTIONS = [@@@ -249,14 -254,23 +257,32 @@@clientId: "",docsLink: ""},+ {+ name: "BitBucket",+ slug: "bitbucket",+ image: "BitBucket.png",+ isAvailable: true,+ type: "oauth",+ clientId: await getClientIdBitBucket(),+ docsLink: ""+ },+ {+ name: "Codefresh",+ slug: "codefresh",+ image: "Codefresh.png",+ isAvailable: true,+ type: "pat",+ clientId: "",+ docsLink: "",++ },+ {+ name: "Northflank",+ slug: "northflank",+ image: "Northflank.png",+ isAvailable: true,+ type: "pat",+ clientId: "",+ docsLink: ""}]diff --cc frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsxindex 883ecd6c9f,a5be325021..3355026ea6--- a/frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsx+++ b/frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsx@@@ -92,9 -92,12 +92,15 @@@ export const redirectForProviderAuth =case "cloudflare-pages":link = `${window.location.origin}/integrations/cloudflare-pages/authorize`;break;+ case "bitbucket":+ link = `https://bitbucket.org/site/oauth2/authorize?client_id=${integrationOption.clientId}&response_type=code&redirect_uri=${window.location.origin}/integrations/bitbucket/oauth2/callback&state=${state}`;+ break;+ case "codefresh":+ link = `${window.location.origin}/integrations/codefresh/authorize`;+ break;+ case "northflank":+ link = `${window.location.origin}/integrations/northflank/authorize`;+ break;default:break;}