Fix merge conflicts
@@ -1,6 +1,7 @@
|
|||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import { MembershipOrg, Organization, User } from "../../models";
|
import { MembershipOrg, Organization, User } from "../../models";
|
||||||
|
import { SSOConfig } from "../../ee/models";
|
||||||
import { deleteMembershipOrg as deleteMemberFromOrg } from "../../helpers/membershipOrg";
|
import { deleteMembershipOrg as deleteMemberFromOrg } from "../../helpers/membershipOrg";
|
||||||
import { createToken } from "../../helpers/auth";
|
import { createToken } from "../../helpers/auth";
|
||||||
import { updateSubscriptionOrgQuantity } from "../../helpers/organization";
|
import { updateSubscriptionOrgQuantity } from "../../helpers/organization";
|
||||||
@@ -111,6 +112,18 @@ export const inviteUserToOrganization = async (req: Request, res: Response) => {
|
|||||||
|
|
||||||
const plan = await EELicenseService.getPlan(organizationId);
|
const plan = await EELicenseService.getPlan(organizationId);
|
||||||
|
|
||||||
|
const ssoConfig = await SSOConfig.findOne({
|
||||||
|
organization: new Types.ObjectId(organizationId)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ssoConfig && ssoConfig.isActive) {
|
||||||
|
// case: SAML SSO is enabled for the organization
|
||||||
|
return res.status(400).send({
|
||||||
|
message:
|
||||||
|
"Failed to invite member due to SAML SSO configured for organization"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (plan.memberLimit !== null) {
|
if (plan.memberLimit !== null) {
|
||||||
// case: limit imposed on number of members allowed
|
// case: limit imposed on number of members allowed
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import crypto from "crypto";
|
|||||||
import bcrypt from "bcrypt";
|
import bcrypt from "bcrypt";
|
||||||
import {
|
import {
|
||||||
APIKeyData,
|
APIKeyData,
|
||||||
|
AuthProvider,
|
||||||
MembershipOrg,
|
MembershipOrg,
|
||||||
TokenVersion,
|
TokenVersion,
|
||||||
User
|
User
|
||||||
@@ -122,6 +123,10 @@ export const updateAuthProvider = async (req: Request, res: Response) => {
|
|||||||
authProvider
|
authProvider
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
|
||||||
|
if (req.user?.authProvider === AuthProvider.OKTA_SAML) return res.status(400).send({
|
||||||
|
message: "Failed to update user authentication method because SAML SSO is enforced"
|
||||||
|
});
|
||||||
|
|
||||||
const user = await User.findByIdAndUpdate(
|
const user = await User.findByIdAndUpdate(
|
||||||
req.user._id.toString(),
|
req.user._id.toString(),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { getSSOConfigHelper } from "../../helpers/organizations";
|
|||||||
import { client } from "../../../config";
|
import { client } from "../../../config";
|
||||||
import { ResourceNotFoundError } from "../../../utils/errors";
|
import { ResourceNotFoundError } from "../../../utils/errors";
|
||||||
import { getSiteURL } from "../../../config";
|
import { getSiteURL } from "../../../config";
|
||||||
|
import { EELicenseService } from "../../services";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect user to appropriate SSO endpoint after successful authentication
|
* Redirect user to appropriate SSO endpoint after successful authentication
|
||||||
@@ -59,6 +60,12 @@ export const updateSSOConfig = async (req: Request, res: Response) => {
|
|||||||
audience
|
audience
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
|
||||||
|
const plan = await EELicenseService.getPlan(organizationId);
|
||||||
|
|
||||||
|
if (!plan.samlSSO) return res.status(400).send({
|
||||||
|
message: "Failed to update SAML SSO configuration due to plan restriction. Upgrade plan to update SSO configuration."
|
||||||
|
});
|
||||||
|
|
||||||
interface PatchUpdate {
|
interface PatchUpdate {
|
||||||
authProvider?: string;
|
authProvider?: string;
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
@@ -204,6 +211,12 @@ export const createSSOConfig = async (req: Request, res: Response) => {
|
|||||||
audience
|
audience
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
|
||||||
|
const plan = await EELicenseService.getPlan(organizationId);
|
||||||
|
|
||||||
|
if (!plan.samlSSO) return res.status(400).send({
|
||||||
|
message: "Failed to create SAML SSO configuration due to plan restriction. Upgrade plan to add SSO configuration."
|
||||||
|
});
|
||||||
|
|
||||||
const key = await BotOrgService.getSymmetricKey(
|
const key = await BotOrgService.getSymmetricKey(
|
||||||
new Types.ObjectId(organizationId)
|
new Types.ObjectId(organizationId)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,12 +3,100 @@ import { client, getEncryptionKey, getRootEncryptionKey } from "../config";
|
|||||||
import { BotOrg } from "../models";
|
import { BotOrg } from "../models";
|
||||||
import { decryptSymmetric128BitHexKeyUTF8 } from "../utils/crypto";
|
import { decryptSymmetric128BitHexKeyUTF8 } from "../utils/crypto";
|
||||||
import {
|
import {
|
||||||
|
ALGORITHM_AES_256_GCM,
|
||||||
ENCODING_SCHEME_BASE64,
|
ENCODING_SCHEME_BASE64,
|
||||||
ENCODING_SCHEME_UTF8
|
ENCODING_SCHEME_UTF8
|
||||||
} from "../variables";
|
} from "../variables";
|
||||||
import { InternalServerError } from "../utils/errors";
|
import { InternalServerError } from "../utils/errors";
|
||||||
|
import { encryptSymmetric128BitHexKeyUTF8, generateKeyPair } from "../utils/crypto";
|
||||||
|
|
||||||
// TODO: DOCstrings
|
/**
|
||||||
|
* Create a bot with name [name] for organization with id [organizationId]
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {String} obj.name - name of bot
|
||||||
|
* @param {String} obj.organizationId - id of organization that bot belongs to
|
||||||
|
*/
|
||||||
|
export const createBotOrg = async ({
|
||||||
|
name,
|
||||||
|
organizationId,
|
||||||
|
}: {
|
||||||
|
name: string;
|
||||||
|
organizationId: Types.ObjectId;
|
||||||
|
}) => {
|
||||||
|
const encryptionKey = await getEncryptionKey();
|
||||||
|
const rootEncryptionKey = await getRootEncryptionKey();
|
||||||
|
|
||||||
|
const { publicKey, privateKey } = generateKeyPair();
|
||||||
|
const key = client.createSymmetricKey();
|
||||||
|
|
||||||
|
if (rootEncryptionKey) {
|
||||||
|
const {
|
||||||
|
ciphertext: encryptedPrivateKey,
|
||||||
|
iv: privateKeyIV,
|
||||||
|
tag: privateKeyTag
|
||||||
|
} = client.encryptSymmetric(privateKey, rootEncryptionKey);
|
||||||
|
|
||||||
|
const {
|
||||||
|
ciphertext: encryptedSymmetricKey,
|
||||||
|
iv: symmetricKeyIV,
|
||||||
|
tag: symmetricKeyTag
|
||||||
|
} = client.encryptSymmetric(key, rootEncryptionKey);
|
||||||
|
|
||||||
|
return await new BotOrg({
|
||||||
|
name,
|
||||||
|
organization: organizationId,
|
||||||
|
publicKey,
|
||||||
|
encryptedSymmetricKey,
|
||||||
|
symmetricKeyIV,
|
||||||
|
symmetricKeyTag,
|
||||||
|
symmetricKeyAlgorithm: ALGORITHM_AES_256_GCM,
|
||||||
|
symmetricKeyKeyEncoding: ENCODING_SCHEME_BASE64,
|
||||||
|
encryptedPrivateKey,
|
||||||
|
privateKeyIV,
|
||||||
|
privateKeyTag,
|
||||||
|
privateKeyAlgorithm: ALGORITHM_AES_256_GCM,
|
||||||
|
privateKeyKeyEncoding: ENCODING_SCHEME_BASE64
|
||||||
|
}).save();
|
||||||
|
} else if (encryptionKey) {
|
||||||
|
const {
|
||||||
|
ciphertext: encryptedPrivateKey,
|
||||||
|
iv: privateKeyIV,
|
||||||
|
tag: privateKeyTag
|
||||||
|
} = encryptSymmetric128BitHexKeyUTF8({
|
||||||
|
plaintext: privateKey,
|
||||||
|
key: encryptionKey
|
||||||
|
});
|
||||||
|
|
||||||
|
const {
|
||||||
|
ciphertext: encryptedSymmetricKey,
|
||||||
|
iv: symmetricKeyIV,
|
||||||
|
tag: symmetricKeyTag
|
||||||
|
} = encryptSymmetric128BitHexKeyUTF8({
|
||||||
|
plaintext: key,
|
||||||
|
key: encryptionKey
|
||||||
|
});
|
||||||
|
|
||||||
|
return await new BotOrg({
|
||||||
|
name,
|
||||||
|
organization: organizationId,
|
||||||
|
publicKey,
|
||||||
|
encryptedSymmetricKey,
|
||||||
|
symmetricKeyIV,
|
||||||
|
symmetricKeyTag,
|
||||||
|
symmetricKeyAlgorithm: ALGORITHM_AES_256_GCM,
|
||||||
|
symmetricKeyKeyEncoding: ENCODING_SCHEME_UTF8,
|
||||||
|
encryptedPrivateKey,
|
||||||
|
privateKeyIV,
|
||||||
|
privateKeyTag,
|
||||||
|
privateKeyAlgorithm: ALGORITHM_AES_256_GCM,
|
||||||
|
privateKeyKeyEncoding: ENCODING_SCHEME_UTF8
|
||||||
|
}).save();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw InternalServerError({
|
||||||
|
message: "Failed to create new organization bot due to missing encryption key",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const getSymmetricKeyHelper = async (organizationId: Types.ObjectId) => {
|
export const getSymmetricKeyHelper = async (organizationId: Types.ObjectId) => {
|
||||||
const rootEncryptionKey = await getRootEncryptionKey();
|
const rootEncryptionKey = await getRootEncryptionKey();
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ import {
|
|||||||
licenseKeyRequest,
|
licenseKeyRequest,
|
||||||
licenseServerKeyRequest,
|
licenseServerKeyRequest,
|
||||||
} from "../config/request";
|
} from "../config/request";
|
||||||
|
import {
|
||||||
|
createBotOrg
|
||||||
|
} from "./botOrg";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an organization with name [name]
|
* Create an organization with name [name]
|
||||||
@@ -29,6 +32,7 @@ export const createOrganization = async ({
|
|||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
const licenseServerKey = await getLicenseServerKey();
|
const licenseServerKey = await getLicenseServerKey();
|
||||||
let organization;
|
let organization;
|
||||||
|
|
||||||
@@ -52,6 +56,12 @@ export const createOrganization = async ({
|
|||||||
}).save();
|
}).save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initialize bot for organization
|
||||||
|
await createBotOrg({
|
||||||
|
name,
|
||||||
|
organizationId: organization._id
|
||||||
|
});
|
||||||
|
|
||||||
return organization;
|
return organization;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
import { Octokit } from "@octokit/rest";
|
|
||||||
import { IIntegrationAuth } from "../models";
|
|
||||||
import { standardRequest } from "../config/request";
|
|
||||||
import {
|
import {
|
||||||
INTEGRATION_AWS_PARAMETER_STORE,
|
INTEGRATION_AWS_PARAMETER_STORE,
|
||||||
INTEGRATION_AWS_SECRET_MANAGER,
|
INTEGRATION_AWS_SECRET_MANAGER,
|
||||||
@@ -13,6 +10,8 @@ import {
|
|||||||
INTEGRATION_CIRCLECI_API_URL,
|
INTEGRATION_CIRCLECI_API_URL,
|
||||||
INTEGRATION_CLOUDFLARE_PAGES,
|
INTEGRATION_CLOUDFLARE_PAGES,
|
||||||
INTEGRATION_CLOUDFLARE_PAGES_API_URL,
|
INTEGRATION_CLOUDFLARE_PAGES_API_URL,
|
||||||
|
INTEGRATION_CLOUD_66,
|
||||||
|
INTEGRATION_CLOUD_66_API_URL,
|
||||||
INTEGRATION_CODEFRESH,
|
INTEGRATION_CODEFRESH,
|
||||||
INTEGRATION_CODEFRESH_API_URL,
|
INTEGRATION_CODEFRESH_API_URL,
|
||||||
INTEGRATION_DIGITAL_OCEAN_API_URL,
|
INTEGRATION_DIGITAL_OCEAN_API_URL,
|
||||||
@@ -39,6 +38,9 @@ import {
|
|||||||
INTEGRATION_VERCEL,
|
INTEGRATION_VERCEL,
|
||||||
INTEGRATION_VERCEL_API_URL
|
INTEGRATION_VERCEL_API_URL
|
||||||
} from "../variables";
|
} from "../variables";
|
||||||
|
import { IIntegrationAuth } from "../models";
|
||||||
|
import { Octokit } from "@octokit/rest";
|
||||||
|
import { standardRequest } from "../config/request";
|
||||||
|
|
||||||
interface App {
|
interface App {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -165,7 +167,14 @@ const getApps = async ({
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM:
|
case INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM:
|
||||||
apps = await getAppsDigitalOceanAppPlatform({ accessToken });
|
apps = await getAppsDigitalOceanAppPlatform({
|
||||||
|
accessToken
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case INTEGRATION_CLOUD_66:
|
||||||
|
apps = await getAppsCloud66({
|
||||||
|
accessToken,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -824,7 +833,6 @@ const getAppsBitBucket = async ({
|
|||||||
* @returns {Object[]} apps - names of Supabase apps
|
* @returns {Object[]} apps - names of Supabase apps
|
||||||
* @returns {String} apps.name - name of Supabase app
|
* @returns {String} apps.name - name of Supabase app
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const getAppsCodefresh = async ({
|
const getAppsCodefresh = async ({
|
||||||
accessToken,
|
accessToken,
|
||||||
}: {
|
}: {
|
||||||
@@ -849,9 +857,13 @@ const getAppsCodefresh = async ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of projects for Digital Ocean App Platform integration
|
* Return list of applications for DigitalOcean App Platform integration
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {String} obj.accessToken - personal access token for DigitalOcean
|
||||||
|
* @returns {Object[]} apps - names of DigitalOcean apps
|
||||||
|
* @returns {String} apps.name - name of DigitalOcean app
|
||||||
|
* @returns {String} apps.appId - id of DigitalOcean app
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const getAppsDigitalOceanAppPlatform = async ({ accessToken }: { accessToken: string }) => {
|
const getAppsDigitalOceanAppPlatform = async ({ accessToken }: { accessToken: string }) => {
|
||||||
interface DigitalOceanApp {
|
interface DigitalOceanApp {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -884,7 +896,65 @@ const getAppsDigitalOceanAppPlatform = async ({ accessToken }: { accessToken: st
|
|||||||
name: a.spec.name,
|
name: a.spec.name,
|
||||||
appId: a.id
|
appId: a.id
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of applications for Cloud66 integration
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {String} obj.accessToken - personal access token for Cloud66 API
|
||||||
|
* @returns {Object[]} apps - Cloud66 apps
|
||||||
|
* @returns {String} apps.name - name of Cloud66 app
|
||||||
|
* @returns {String} apps.appId - uid of Cloud66 app
|
||||||
|
*/
|
||||||
|
const getAppsCloud66 = async ({ accessToken }: { accessToken: string }) => {
|
||||||
|
interface Cloud66Apps {
|
||||||
|
uid: string;
|
||||||
|
name: string;
|
||||||
|
account_id: number;
|
||||||
|
git: string;
|
||||||
|
git_branch: string;
|
||||||
|
environment: string;
|
||||||
|
cloud: string;
|
||||||
|
fqdn: string;
|
||||||
|
language: string;
|
||||||
|
framework: string;
|
||||||
|
status: number;
|
||||||
|
health: number;
|
||||||
|
last_activity: string;
|
||||||
|
last_activity_iso: string;
|
||||||
|
maintenance_mode: boolean;
|
||||||
|
has_loadbalancer: boolean;
|
||||||
|
created_at: string;
|
||||||
|
updated_at: string;
|
||||||
|
deploy_directory: string;
|
||||||
|
cloud_status: string;
|
||||||
|
backend: string;
|
||||||
|
version: string;
|
||||||
|
revision: string;
|
||||||
|
is_busy: boolean;
|
||||||
|
account_name: string;
|
||||||
|
is_cluster: boolean;
|
||||||
|
is_inside_cluster: boolean;
|
||||||
|
cluster_name: any;
|
||||||
|
application_address: string;
|
||||||
|
configstore_namespace: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const stacks = (
|
||||||
|
await standardRequest.get(`${INTEGRATION_CLOUD_66_API_URL}/3/stacks`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${accessToken}`,
|
||||||
|
"Accept-Encoding": "application/json"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
).data.response as Cloud66Apps[]
|
||||||
|
|
||||||
|
const apps = stacks.map((app) => ({
|
||||||
|
name: app.name,
|
||||||
|
appId: app.uid
|
||||||
|
}));
|
||||||
|
|
||||||
|
return apps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export { getApps };
|
export { getApps };
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
import _ from "lodash";
|
|
||||||
import AWS from "aws-sdk";
|
|
||||||
import {
|
import {
|
||||||
CreateSecretCommand,
|
CreateSecretCommand,
|
||||||
GetSecretValueCommand,
|
GetSecretValueCommand,
|
||||||
ResourceNotFoundException,
|
ResourceNotFoundException,
|
||||||
SecretsManagerClient,
|
SecretsManagerClient,
|
||||||
UpdateSecretCommand,
|
UpdateSecretCommand
|
||||||
} from "@aws-sdk/client-secrets-manager";
|
} from "@aws-sdk/client-secrets-manager";
|
||||||
import { Octokit } from "@octokit/rest";
|
|
||||||
import sodium from "libsodium-wrappers";
|
|
||||||
import { IIntegration, IIntegrationAuth } from "../models";
|
import { IIntegration, IIntegrationAuth } from "../models";
|
||||||
import {
|
import {
|
||||||
INTEGRATION_AWS_PARAMETER_STORE,
|
INTEGRATION_AWS_PARAMETER_STORE,
|
||||||
@@ -22,6 +18,8 @@ import {
|
|||||||
INTEGRATION_CIRCLECI_API_URL,
|
INTEGRATION_CIRCLECI_API_URL,
|
||||||
INTEGRATION_CLOUDFLARE_PAGES,
|
INTEGRATION_CLOUDFLARE_PAGES,
|
||||||
INTEGRATION_CLOUDFLARE_PAGES_API_URL,
|
INTEGRATION_CLOUDFLARE_PAGES_API_URL,
|
||||||
|
INTEGRATION_CLOUD_66,
|
||||||
|
INTEGRATION_CLOUD_66_API_URL,
|
||||||
INTEGRATION_CODEFRESH,
|
INTEGRATION_CODEFRESH,
|
||||||
INTEGRATION_CODEFRESH_API_URL,
|
INTEGRATION_CODEFRESH_API_URL,
|
||||||
INTEGRATION_DIGITAL_OCEAN_API_URL,
|
INTEGRATION_DIGITAL_OCEAN_API_URL,
|
||||||
@@ -49,6 +47,10 @@ import {
|
|||||||
INTEGRATION_VERCEL,
|
INTEGRATION_VERCEL,
|
||||||
INTEGRATION_VERCEL_API_URL
|
INTEGRATION_VERCEL_API_URL
|
||||||
} from "../variables";
|
} from "../variables";
|
||||||
|
import AWS from "aws-sdk";
|
||||||
|
import { Octokit } from "@octokit/rest";
|
||||||
|
import _ from "lodash";
|
||||||
|
import sodium from "libsodium-wrappers";
|
||||||
import { standardRequest } from "../config/request";
|
import { standardRequest } from "../config/request";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -229,6 +231,13 @@ const syncSecrets = async ({
|
|||||||
accessToken,
|
accessToken,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case INTEGRATION_CLOUD_66:
|
||||||
|
await syncSecretsCloud66({
|
||||||
|
integration,
|
||||||
|
secrets,
|
||||||
|
accessToken
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2077,10 +2086,11 @@ const syncSecretsBitBucket = async ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Sync/push [secrets] to Codefresh with name [integration.app]
|
* Sync/push [secrets] to Codefresh project with name [integration.app]
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
* @param {IIntegration} obj.integration - integration details
|
* @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 {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
|
* @param {String} obj.accessToken - access token for Codefresh integration
|
||||||
*/
|
*/
|
||||||
@@ -2110,6 +2120,14 @@ 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 ({
|
const syncSecretsDigitalOceanAppPlatform = async ({
|
||||||
integration,
|
integration,
|
||||||
secrets,
|
secrets,
|
||||||
@@ -2134,6 +2152,109 @@ const syncSecretsDigitalOceanAppPlatform = async ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export { syncSecrets };
|
export { syncSecrets };
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { Schema, Types, model } from "mongoose";
|
|
||||||
import {
|
import {
|
||||||
INTEGRATION_AWS_PARAMETER_STORE,
|
INTEGRATION_AWS_PARAMETER_STORE,
|
||||||
INTEGRATION_AWS_SECRET_MANAGER,
|
INTEGRATION_AWS_SECRET_MANAGER,
|
||||||
@@ -7,6 +6,7 @@ import {
|
|||||||
INTEGRATION_CHECKLY,
|
INTEGRATION_CHECKLY,
|
||||||
INTEGRATION_CIRCLECI,
|
INTEGRATION_CIRCLECI,
|
||||||
INTEGRATION_CLOUDFLARE_PAGES,
|
INTEGRATION_CLOUDFLARE_PAGES,
|
||||||
|
INTEGRATION_CLOUD_66,
|
||||||
INTEGRATION_CODEFRESH,
|
INTEGRATION_CODEFRESH,
|
||||||
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
||||||
INTEGRATION_FLYIO,
|
INTEGRATION_FLYIO,
|
||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
INTEGRATION_VERCEL
|
INTEGRATION_VERCEL
|
||||||
} from "../variables";
|
} from "../variables";
|
||||||
|
import { Schema, Types, model } from "mongoose";
|
||||||
|
|
||||||
export interface IIntegration {
|
export interface IIntegration {
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
@@ -61,6 +62,7 @@ export interface IIntegration {
|
|||||||
| "bitbucket"
|
| "bitbucket"
|
||||||
| "codefresh"
|
| "codefresh"
|
||||||
| "digital-ocean-app-platform"
|
| "digital-ocean-app-platform"
|
||||||
|
| "cloud-66"
|
||||||
integrationAuth: Types.ObjectId;
|
integrationAuth: Types.ObjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +154,8 @@ const integrationSchema = new Schema<IIntegration>(
|
|||||||
INTEGRATION_CLOUDFLARE_PAGES,
|
INTEGRATION_CLOUDFLARE_PAGES,
|
||||||
INTEGRATION_BITBUCKET,
|
INTEGRATION_BITBUCKET,
|
||||||
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
||||||
INTEGRATION_CODEFRESH
|
INTEGRATION_CODEFRESH,
|
||||||
|
INTEGRATION_CLOUD_66,
|
||||||
],
|
],
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { Document, Schema, Types, model } from "mongoose";
|
|
||||||
import {
|
import {
|
||||||
ALGORITHM_AES_256_GCM,
|
ALGORITHM_AES_256_GCM,
|
||||||
ENCODING_SCHEME_BASE64,
|
ENCODING_SCHEME_BASE64,
|
||||||
@@ -9,6 +8,7 @@ import {
|
|||||||
INTEGRATION_BITBUCKET,
|
INTEGRATION_BITBUCKET,
|
||||||
INTEGRATION_CIRCLECI,
|
INTEGRATION_CIRCLECI,
|
||||||
INTEGRATION_CLOUDFLARE_PAGES,
|
INTEGRATION_CLOUDFLARE_PAGES,
|
||||||
|
INTEGRATION_CLOUD_66,
|
||||||
INTEGRATION_CODEFRESH,
|
INTEGRATION_CODEFRESH,
|
||||||
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
||||||
INTEGRATION_FLYIO,
|
INTEGRATION_FLYIO,
|
||||||
@@ -24,6 +24,7 @@ import {
|
|||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
INTEGRATION_VERCEL
|
INTEGRATION_VERCEL
|
||||||
} from "../variables";
|
} from "../variables";
|
||||||
|
import { Document, Schema, Types, model } from "mongoose";
|
||||||
|
|
||||||
export interface IIntegrationAuth extends Document {
|
export interface IIntegrationAuth extends Document {
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
@@ -48,7 +49,8 @@ export interface IIntegrationAuth extends Document {
|
|||||||
| "cloudflare-pages"
|
| "cloudflare-pages"
|
||||||
| "codefresh"
|
| "codefresh"
|
||||||
| "digital-ocean-app-platform"
|
| "digital-ocean-app-platform"
|
||||||
| "bitbucket";
|
| "bitbucket"
|
||||||
|
| "cloud-66";
|
||||||
teamId: string;
|
teamId: string;
|
||||||
accountId: string;
|
accountId: string;
|
||||||
url: string;
|
url: string;
|
||||||
@@ -96,7 +98,8 @@ const integrationAuthSchema = new Schema<IIntegrationAuth>(
|
|||||||
INTEGRATION_CLOUDFLARE_PAGES,
|
INTEGRATION_CLOUDFLARE_PAGES,
|
||||||
INTEGRATION_BITBUCKET,
|
INTEGRATION_BITBUCKET,
|
||||||
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
||||||
INTEGRATION_CODEFRESH
|
INTEGRATION_CODEFRESH,
|
||||||
|
INTEGRATION_CLOUD_66,
|
||||||
],
|
],
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -177,7 +177,6 @@ export const backfillBotOrgs = async () => {
|
|||||||
return new BotOrg({
|
return new BotOrg({
|
||||||
name: "Infisical Bot",
|
name: "Infisical Bot",
|
||||||
organization: organizationToAddBot,
|
organization: organizationToAddBot,
|
||||||
isActive: false,
|
|
||||||
publicKey,
|
publicKey,
|
||||||
encryptedSymmetricKey,
|
encryptedSymmetricKey,
|
||||||
symmetricKeyIV,
|
symmetricKeyIV,
|
||||||
@@ -212,7 +211,6 @@ export const backfillBotOrgs = async () => {
|
|||||||
return new BotOrg({
|
return new BotOrg({
|
||||||
name: "Infisical Bot",
|
name: "Infisical Bot",
|
||||||
organization: organizationToAddBot,
|
organization: organizationToAddBot,
|
||||||
isActive: false,
|
|
||||||
publicKey,
|
publicKey,
|
||||||
encryptedSymmetricKey,
|
encryptedSymmetricKey,
|
||||||
symmetricKeyIV,
|
symmetricKeyIV,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export const INTEGRATION_CLOUDFLARE_PAGES = "cloudflare-pages";
|
|||||||
export const INTEGRATION_BITBUCKET = "bitbucket";
|
export const INTEGRATION_BITBUCKET = "bitbucket";
|
||||||
export const INTEGRATION_CODEFRESH = "codefresh";
|
export const INTEGRATION_CODEFRESH = "codefresh";
|
||||||
export const INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM = "digital-ocean-app-platform";
|
export const INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM = "digital-ocean-app-platform";
|
||||||
|
export const INTEGRATION_CLOUD_66 = "cloud-66";
|
||||||
export const INTEGRATION_SET = new Set([
|
export const INTEGRATION_SET = new Set([
|
||||||
INTEGRATION_AZURE_KEY_VAULT,
|
INTEGRATION_AZURE_KEY_VAULT,
|
||||||
INTEGRATION_HEROKU,
|
INTEGRATION_HEROKU,
|
||||||
@@ -48,7 +49,8 @@ export const INTEGRATION_SET = new Set([
|
|||||||
INTEGRATION_CLOUDFLARE_PAGES,
|
INTEGRATION_CLOUDFLARE_PAGES,
|
||||||
INTEGRATION_BITBUCKET,
|
INTEGRATION_BITBUCKET,
|
||||||
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
||||||
INTEGRATION_CODEFRESH
|
INTEGRATION_CODEFRESH,
|
||||||
|
INTEGRATION_CLOUD_66
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// integration types
|
// integration types
|
||||||
@@ -82,6 +84,7 @@ export const INTEGRATION_CLOUDFLARE_PAGES_API_URL = "https://api.cloudflare.com"
|
|||||||
export const INTEGRATION_BITBUCKET_API_URL = "https://api.bitbucket.org";
|
export const INTEGRATION_BITBUCKET_API_URL = "https://api.bitbucket.org";
|
||||||
export const INTEGRATION_CODEFRESH_API_URL = "https://g.codefresh.io/api";
|
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_DIGITAL_OCEAN_API_URL = "https://api.digitalocean.com";
|
||||||
|
export const INTEGRATION_CLOUD_66_API_URL = "https://app.cloud66.com/api";
|
||||||
|
|
||||||
export const getIntegrationOptions = async () => {
|
export const getIntegrationOptions = async () => {
|
||||||
const INTEGRATION_OPTIONS = [
|
const INTEGRATION_OPTIONS = [
|
||||||
@@ -284,6 +287,15 @@ export const getIntegrationOptions = async () => {
|
|||||||
clientId: "",
|
clientId: "",
|
||||||
docsLink: "",
|
docsLink: "",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Cloud 66",
|
||||||
|
slug: "cloud-66",
|
||||||
|
image: "Cloud 66.png",
|
||||||
|
isAvailable: true,
|
||||||
|
type: "pat",
|
||||||
|
clientId: "",
|
||||||
|
docsLink: "",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
return INTEGRATION_OPTIONS;
|
return INTEGRATION_OPTIONS;
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
---
|
||||||
|
title: "SSO"
|
||||||
|
description: "Log in to Infisical via SSO protocols"
|
||||||
|
---
|
||||||
|
|
||||||
|
<Warning>
|
||||||
|
Infisical currently only supports SAML SSO authentication with [Okta as the
|
||||||
|
identity provider (IDP)](https://www.okta.com/). We're expanding support for
|
||||||
|
other IDPs in the coming months, so stay tuned with this issue
|
||||||
|
[here](https://github.com/Infisical/infisical/issues/442).
|
||||||
|
</Warning>
|
||||||
|
|
||||||
|
You can configure your organization in Infisical to have members authenticate with the platform via protocols like [SAML 2.0](https://en.wikipedia.org/wiki/SAML_2.0).
|
||||||
|
|
||||||
|
To note, configuring SSO retains the end-to-end encrypted architecture of Infisical because we decouple the **authentication** and **decryption** steps. In all login with SSO implementations,
|
||||||
|
your IDP cannot and will not have access to the decryption key needed to decrypt your secrets.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Head over to your organization Settings > Authentication > SAML SSO Configuration.
|
||||||
|
|
||||||
|
Next, press "Set up SAML SSO" in the SAML SSO and follow the instructions
|
||||||
|
below to configure SSO for your identity provider:
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
Note that only members with the `owner` or `admin` roles in an organization
|
||||||
|
can configure SSO for it.
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
<AccordionGroup>
|
||||||
|
<Accordion title="Okta SAML 2.0">
|
||||||
|
1. In the Okta Admin Portal, select Applications > Applications from the
|
||||||
|
navigation. On the Applications screen, select the Create App Integration
|
||||||
|
button.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
2. In the Create a New Application Integration dialog, select the SAML 2.0 radio button:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
3. On the General Settings screen, give the application a unique, Infisical-specific name and select Next.
|
||||||
|
|
||||||
|
4. On the Configure SAML screen, configure the following fields:
|
||||||
|
|
||||||
|
- Single sign on URL: `https://app.infisical.com/api/v1/sso/saml2/:identifier`; we'll update the `:identifier` part later in step 6.
|
||||||
|
- Audience URI (SP Entity ID): `https://app.infisical.com`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
<Note>
|
||||||
|
If you're self-hosting Infisical, then you will want to replace `https://app.infisical.com` with your own domain.
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
4. Also on the Configure SAML screen, configure the Attribute Statements to map:
|
||||||
|
|
||||||
|
- `id -> user.id`,
|
||||||
|
- `email -> user.email`,
|
||||||
|
- `firstName -> user.firstName`
|
||||||
|
- `lastName -> user.lastName`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Once configured, select the Next button to proceed to the Feedback screen and select Finish.
|
||||||
|
|
||||||
|
5. Get IDP values
|
||||||
|
|
||||||
|
Once your application is created, select the Sign On tab for the app and select the View Setup Instructions button located on the right side of the screen:
|
||||||
|
|
||||||
|
Copy the Identity Provider Single Sign-On URL, the Identity Provider Issuer, and the X.509 Certificate to be pasted into your Infisical SAML SSO configuration details with the following map:
|
||||||
|
|
||||||
|
- `Audience -> Okta Audience URI (SP Entity ID)`
|
||||||
|
- `Entrypoint -> Okta Identity Provider Single Sign-On URL`
|
||||||
|
- `Issuer -> Identity Provider Issuer`
|
||||||
|
- `Certificate -> X.509 Certificate`.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
6. Create the SSO configuration and copy your SSO identifier in Infisical; update `:identifier` from step 4 earlier to be this value.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
7. Assignments
|
||||||
|
|
||||||
|
Finally, Navigate to the Assignments tab and select the Assign button:
|
||||||
|
|
||||||
|
You can assign access to the application on a user-by-user basis using the Assign to People option, or in-bulk using the Assign to Groups option.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
At this point, you have configured everything you need within the context of the Okta Admin Portal.
|
||||||
|
|
||||||
|
8. Return to Infisical and enable SAML SSO.
|
||||||
|
|
||||||
|
Enabling SAML SSO enforces all members in your organization to only be able to log into Infisical via Okta.
|
||||||
|
|
||||||
|
</Accordion>
|
||||||
|
</AccordionGroup>
|
||||||
|
After Width: | Height: | Size: 890 KiB |
|
After Width: | Height: | Size: 814 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 742 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 969 KiB |
|
After Width: | Height: | Size: 812 KiB |
|
After Width: | Height: | Size: 264 KiB |
|
After Width: | Height: | Size: 381 KiB |
|
After Width: | Height: | Size: 423 KiB |
|
After Width: | Height: | Size: 316 KiB |
|
After Width: | Height: | Size: 598 KiB |
|
After Width: | Height: | Size: 443 KiB |
|
After Width: | Height: | Size: 563 KiB |
|
After Width: | Height: | Size: 386 KiB |
@@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
title: "Cloud 66"
|
||||||
|
description: "How to sync secrets from Infisical to Cloud 66"
|
||||||
|
---
|
||||||
|
|
||||||
|
Prerequisites:
|
||||||
|
|
||||||
|
- Set up and add envars to [Infisical Cloud](https://app.infisical.com)
|
||||||
|
|
||||||
|
## Navigate to your project's integrations tab
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Enter your Cloud 66 Access Token
|
||||||
|
|
||||||
|
In Cloud 66 Dashboard, click on the top right icon > Account Settings > Access Token
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
Create new Personal Access Token.
|
||||||
|

|
||||||
|
|
||||||
|
Name it **infisical** and check **Public** and **Admin**. Then click "Create Token"
|
||||||
|

|
||||||
|
|
||||||
|
Copy and save your token.
|
||||||
|

|
||||||
|
|
||||||
|
### Go to Infisical Integration Page
|
||||||
|
|
||||||
|
Click on the Cloud 66 tile and enter your API token to grant Infisical access to your Cloud 66 account.
|
||||||
|

|
||||||
|
|
||||||
|
<Info>
|
||||||
|
If this is your project's first cloud integration, then you'll have to grant
|
||||||
|
Infisical access to your project's environment variables. Although this step
|
||||||
|
breaks E2EE, it's necessary for Infisical to sync the environment variables to
|
||||||
|
the cloud platform.
|
||||||
|
</Info>
|
||||||
|
|
||||||
|
Enter your Cloud 66 Personal Access Token here. Then click "Connect to Cloud 66".
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Start integration
|
||||||
|
|
||||||
|
Select which Infisical environment secrets you want to sync to which Cloud 66 stacks and press create integration to start syncing secrets to Cloud 66.
|
||||||
|

|
||||||
|
|
||||||
|
<Warning>
|
||||||
|
Any existing environment variables in Cloud 66 will be deleted when you start syncing. Make sure to add all the secrets into the Infisical dashboard first before doing any integrations.
|
||||||
|
</Warning>
|
||||||
|
|
||||||
|
Done!
|
||||||
|

|
||||||
@@ -118,8 +118,9 @@
|
|||||||
"documentation/platform/pit-recovery",
|
"documentation/platform/pit-recovery",
|
||||||
"documentation/platform/secret-versioning",
|
"documentation/platform/secret-versioning",
|
||||||
"documentation/platform/audit-logs",
|
"documentation/platform/audit-logs",
|
||||||
|
"documentation/platform/token",
|
||||||
"documentation/platform/mfa",
|
"documentation/platform/mfa",
|
||||||
"documentation/platform/token"
|
"documentation/platform/saml"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -225,6 +226,7 @@
|
|||||||
"integrations/cloud/checkly",
|
"integrations/cloud/checkly",
|
||||||
"integrations/cloud/hashicorp-vault",
|
"integrations/cloud/hashicorp-vault",
|
||||||
"integrations/cloud/azure-key-vault",
|
"integrations/cloud/azure-key-vault",
|
||||||
|
"integrations/cloud/cloud-66",
|
||||||
"integrations/cicd/githubactions",
|
"integrations/cicd/githubactions",
|
||||||
"integrations/cicd/gitlab",
|
"integrations/cicd/gitlab",
|
||||||
"integrations/cicd/circleci",
|
"integrations/cicd/circleci",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ However, the following functionality will be disabled.
|
|||||||
- Sending invite links via email for projects to teammates
|
- Sending invite links via email for projects to teammates
|
||||||
- Sending alerts such as suspicious login attempts
|
- Sending alerts such as suspicious login attempts
|
||||||
|
|
||||||
## General configuration
|
## Configuration
|
||||||
|
|
||||||
If you choose to setup email service, you need to configure the following SMTP [environment variables](https://infisical.com/docs/self-hosting/configuration/envars):
|
If you choose to setup email service, you need to configure the following SMTP [environment variables](https://infisical.com/docs/self-hosting/configuration/envars):
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ const integrationSlugNameMapping: Mapping = {
|
|||||||
"cloudflare-pages": "Cloudflare Pages",
|
"cloudflare-pages": "Cloudflare Pages",
|
||||||
"codefresh": "Codefresh",
|
"codefresh": "Codefresh",
|
||||||
"digital-ocean-app-platform": "Digital Ocean App Platform",
|
"digital-ocean-app-platform": "Digital Ocean App Platform",
|
||||||
bitbucket: "BitBucket"
|
bitbucket: "BitBucket",
|
||||||
|
"cloud-66": "Cloud 66"
|
||||||
};
|
};
|
||||||
|
|
||||||
const envMapping: Mapping = {
|
const envMapping: Mapping = {
|
||||||
|
|||||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,64 @@
|
|||||||
|
import { useState } from "react";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
|
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
||||||
|
|
||||||
|
export default function Cloud66CreateIntegrationPage() {
|
||||||
|
const router = useRouter();
|
||||||
|
const [apiKey, setApiKey] = useState("");
|
||||||
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
|
const handleButtonClick = async () => {
|
||||||
|
try {
|
||||||
|
setApiKeyErrorText("");
|
||||||
|
if (apiKey.length === 0) {
|
||||||
|
setApiKeyErrorText("Access token cannot be blank");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
|
||||||
|
const integrationAuth = await saveIntegrationAccessToken({
|
||||||
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
|
integration: "cloud-66",
|
||||||
|
accessId: null,
|
||||||
|
accessToken: apiKey,
|
||||||
|
url: null,
|
||||||
|
namespace: null
|
||||||
|
});
|
||||||
|
|
||||||
|
setIsLoading(false);
|
||||||
|
|
||||||
|
router.push(`/integrations/cloud-66/create?integrationAuthId=${integrationAuth._id}`);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex h-full w-full items-center justify-center">
|
||||||
|
<Card className="max-w-md rounded-md p-8">
|
||||||
|
<CardTitle className="text-center">Cloud 66 Integration</CardTitle>
|
||||||
|
<FormControl
|
||||||
|
label="Cloud 66 Personal Access Token"
|
||||||
|
errorText={apiKeyErrorText}
|
||||||
|
isError={apiKeyErrorText !== "" ?? false}
|
||||||
|
>
|
||||||
|
<Input placeholder="" value={apiKey} onChange={(e) => setApiKey(e.target.value)} />
|
||||||
|
</FormControl>
|
||||||
|
<Button
|
||||||
|
onClick={handleButtonClick}
|
||||||
|
color="mineshaft"
|
||||||
|
className="mt-4"
|
||||||
|
isLoading={isLoading}
|
||||||
|
>
|
||||||
|
Connect to Cloud 66
|
||||||
|
</Button>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Cloud66CreateIntegrationPage.requireAuth = true;
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
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 Cloud66CreateIntegrationPage() {
|
||||||
|
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 [targetApp, setTargetApp] = useState("");
|
||||||
|
const [secretPath, setSecretPath] = 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]);
|
||||||
|
|
||||||
|
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
|
||||||
|
});
|
||||||
|
|
||||||
|
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">Cloud 66 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="Cloud 66 Application" 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-app-${integrationAuthApp.name}`}
|
||||||
|
>
|
||||||
|
{integrationAuthApp.name}
|
||||||
|
</SelectItem>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<SelectItem value="none" key="target-app-none">
|
||||||
|
No applications found
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
<Button
|
||||||
|
onClick={handleButtonClick}
|
||||||
|
color="mineshaft"
|
||||||
|
className="mt-4"
|
||||||
|
isLoading={isLoading}
|
||||||
|
isDisabled={integrationAuthApps.length === 0}
|
||||||
|
>
|
||||||
|
Create Integration
|
||||||
|
</Button>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Cloud66CreateIntegrationPage.requireAuth = true;
|
||||||
@@ -183,7 +183,9 @@ export default function Users() {
|
|||||||
<div className="ml-2 flex min-w-max flex-row items-start justify-start">
|
<div className="ml-2 flex min-w-max flex-row items-start justify-start">
|
||||||
<Button
|
<Button
|
||||||
text={String(t("section.members.add-member"))}
|
text={String(t("section.members.add-member"))}
|
||||||
onButtonPressed={openAddModal}
|
onButtonPressed={() => {
|
||||||
|
openAddModal();
|
||||||
|
}}
|
||||||
color="mineshaft"
|
color="mineshaft"
|
||||||
size="md"
|
size="md"
|
||||||
icon={faPlus}
|
icon={faPlus}
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ export const redirectForProviderAuth = (integrationOption: TCloudIntegration) =>
|
|||||||
case "digital-ocean-app-platform":
|
case "digital-ocean-app-platform":
|
||||||
link = `${window.location.origin}/integrations/digital-ocean-app-platform/authorize`;
|
link = `${window.location.origin}/integrations/digital-ocean-app-platform/authorize`;
|
||||||
break;
|
break;
|
||||||
|
case "cloud-66":
|
||||||
|
link = `${window.location.origin}/integrations/cloud-66/authorize`;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import * as yup from "yup";
|
import * as yup from "yup";
|
||||||
|
|
||||||
|
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
DeleteActionModal,
|
DeleteActionModal,
|
||||||
@@ -26,9 +27,11 @@ import {
|
|||||||
Th,
|
Th,
|
||||||
THead,
|
THead,
|
||||||
Tr,
|
Tr,
|
||||||
UpgradePlanModal} from "@app/components/v2";
|
UpgradePlanModal
|
||||||
import { useWorkspace } from "@app/context";
|
} from "@app/components/v2";
|
||||||
|
import { useOrganization , useWorkspace } from "@app/context";
|
||||||
import { usePopUp, useToggle } from "@app/hooks";
|
import { usePopUp, useToggle } from "@app/hooks";
|
||||||
|
import { useGetSSOConfig } from "@app/hooks/api";
|
||||||
import { useFetchServerStatus } from "@app/hooks/api/serverDetails";
|
import { useFetchServerStatus } from "@app/hooks/api/serverDetails";
|
||||||
import { OrgUser, Workspace } from "@app/hooks/api/types";
|
import { OrgUser, Workspace } from "@app/hooks/api/types";
|
||||||
|
|
||||||
@@ -69,6 +72,9 @@ export const OrgMembersTable = ({
|
|||||||
setCompleteInviteLink
|
setCompleteInviteLink
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { createNotification } = useNotificationContext();
|
||||||
|
const { currentOrg } = useOrganization();
|
||||||
|
const { data: ssoConfig, isLoading: isLoadingSSOConfig } = useGetSSOConfig(currentOrg?._id ?? "");
|
||||||
const [searchMemberFilter, setSearchMemberFilter] = useState("");
|
const [searchMemberFilter, setSearchMemberFilter] = useState("");
|
||||||
const {data: serverDetails } = useFetchServerStatus()
|
const {data: serverDetails } = useFetchServerStatus()
|
||||||
const { workspaces } = useWorkspace();
|
const { workspaces } = useWorkspace();
|
||||||
@@ -152,6 +158,15 @@ export const OrgMembersTable = ({
|
|||||||
<Button
|
<Button
|
||||||
leftIcon={<FontAwesomeIcon icon={faPlus} />}
|
leftIcon={<FontAwesomeIcon icon={faPlus} />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (!isLoadingSSOConfig && ssoConfig && ssoConfig.isActive) {
|
||||||
|
createNotification({
|
||||||
|
text: "You cannot invite users when SAML SSO is configured for your organization",
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isMoreUserNotAllowed) {
|
if (isMoreUserNotAllowed) {
|
||||||
handlePopUpOpen("upgradePlan");
|
handlePopUpOpen("upgradePlan");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -69,13 +69,13 @@ export const UserInfoSSOStep = ({
|
|||||||
const [nameError, setNameError] = useState(false);
|
const [nameError, setNameError] = useState(false);
|
||||||
const [organizationName, setOrganizationName] = useState("");
|
const [organizationName, setOrganizationName] = useState("");
|
||||||
const [organizationNameError, setOrganizationNameError] = useState(false);
|
const [organizationNameError, setOrganizationNameError] = useState(false);
|
||||||
|
const [attributionSource, setAttributionSource] = useState("");
|
||||||
const [errors, setErrors] = useState<Errors>({});
|
const [errors, setErrors] = useState<Errors>({});
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("providerOrganizationName: ", providerOrganizationName);
|
if (providerOrganizationName !== undefined) {
|
||||||
if (providerOrganizationName) {
|
|
||||||
setOrganizationName(providerOrganizationName);
|
setOrganizationName(providerOrganizationName);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
@@ -113,10 +113,6 @@ export const UserInfoSSOStep = ({
|
|||||||
const publicKey = encodeBase64(publicKeyUint8Array);
|
const publicKey = encodeBase64(publicKeyUint8Array);
|
||||||
localStorage.setItem("PRIVATE_KEY", privateKey);
|
localStorage.setItem("PRIVATE_KEY", privateKey);
|
||||||
|
|
||||||
console.log("make");
|
|
||||||
console.log("email: ", email);
|
|
||||||
console.log("password: ", password);
|
|
||||||
|
|
||||||
client.init(
|
client.init(
|
||||||
{
|
{
|
||||||
username: email,
|
username: email,
|
||||||
@@ -175,7 +171,8 @@ export const UserInfoSSOStep = ({
|
|||||||
providerAuthToken,
|
providerAuthToken,
|
||||||
salt: result.salt,
|
salt: result.salt,
|
||||||
verifier: result.verifier,
|
verifier: result.verifier,
|
||||||
organizationName
|
organizationName,
|
||||||
|
attributionSource
|
||||||
});
|
});
|
||||||
|
|
||||||
// unset signup JWT token and set JWT token
|
// unset signup JWT token and set JWT token
|
||||||
@@ -232,6 +229,7 @@ export const UserInfoSSOStep = ({
|
|||||||
/>
|
/>
|
||||||
{nameError && <p className='text-left w-full text-xs text-red-600 mt-1 ml-1'>Please, specify your name</p>}
|
{nameError && <p className='text-left w-full text-xs text-red-600 mt-1 ml-1'>Please, specify your name</p>}
|
||||||
</div>
|
</div>
|
||||||
|
{providerOrganizationName === undefined && (
|
||||||
<div className="relative z-0 lg:w-1/6 w-1/4 min-w-[20rem] flex flex-col items-center justify-end w-full py-2 rounded-lg">
|
<div className="relative z-0 lg:w-1/6 w-1/4 min-w-[20rem] flex flex-col items-center justify-end w-full py-2 rounded-lg">
|
||||||
<p className='text-left w-full text-sm text-bunker-300 mb-1 ml-1 font-medium'>Organization Name</p>
|
<p className='text-left w-full text-sm text-bunker-300 mb-1 ml-1 font-medium'>Organization Name</p>
|
||||||
<Input
|
<Input
|
||||||
@@ -244,6 +242,18 @@ export const UserInfoSSOStep = ({
|
|||||||
/>
|
/>
|
||||||
{organizationNameError && <p className='text-left w-full text-xs text-red-600 mt-1 ml-1'>Please, specify your organization name</p>}
|
{organizationNameError && <p className='text-left w-full text-xs text-red-600 mt-1 ml-1'>Please, specify your organization name</p>}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
{providerOrganizationName === undefined && (
|
||||||
|
<div className="relative z-0 lg:w-1/6 w-1/4 min-w-[20rem] flex flex-col items-center justify-end w-full py-2 rounded-lg">
|
||||||
|
<p className='text-left w-full text-sm text-bunker-300 mb-1 ml-1 font-medium'>Where did you hear about us? <span className="font-light">(optional)</span></p>
|
||||||
|
<Input
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => setAttributionSource(e.target.value)}
|
||||||
|
value={attributionSource}
|
||||||
|
className="h-12"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div className="mt-2 flex lg:w-1/6 w-1/4 min-w-[20rem] max-h-60 w-full flex-col items-center justify-center rounded-lg py-2">
|
<div className="mt-2 flex lg:w-1/6 w-1/4 min-w-[20rem] max-h-60 w-full flex-col items-center justify-center rounded-lg py-2">
|
||||||
<InputField
|
<InputField
|
||||||
label={t("section.password.password")}
|
label={t("section.password.password")}
|
||||||
|
|||||||