mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 08:27:36 +00:00
Merge pull request #912 from Infisical/integration-suffixes
Added suffixes to the Checkly integration
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { Integration } from "../../models";
|
import { Folder, Integration } from "../../models";
|
||||||
import { EventService } from "../../services";
|
import { EventService } from "../../services";
|
||||||
import { eventStartIntegration } from "../../events";
|
import { eventStartIntegration } from "../../events";
|
||||||
import Folder from "../../models/folder";
|
|
||||||
import { getFolderByPath } from "../../services/FolderService";
|
import { getFolderByPath } from "../../services/FolderService";
|
||||||
import { BadRequestError } from "../../utils/errors";
|
import { BadRequestError } from "../../utils/errors";
|
||||||
import { EEAuditLogService } from "../../ee/services";
|
import { EEAuditLogService } from "../../ee/services";
|
||||||
@@ -30,7 +29,8 @@ export const createIntegration = async (req: Request, res: Response) => {
|
|||||||
owner,
|
owner,
|
||||||
path,
|
path,
|
||||||
region,
|
region,
|
||||||
secretPath
|
secretPath,
|
||||||
|
metadata
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
|
||||||
const folders = await Folder.findOne({
|
const folders = await Folder.findOne({
|
||||||
@@ -65,7 +65,8 @@ export const createIntegration = async (req: Request, res: Response) => {
|
|||||||
region,
|
region,
|
||||||
secretPath,
|
secretPath,
|
||||||
integration: req.integrationAuth.integration,
|
integration: req.integrationAuth.integration,
|
||||||
integrationAuth: new Types.ObjectId(integrationAuthId)
|
integrationAuth: new Types.ObjectId(integrationAuthId),
|
||||||
|
metadata
|
||||||
}).save();
|
}).save();
|
||||||
|
|
||||||
if (integration) {
|
if (integration) {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import { isValidScope, validateMembership } from "../../helpers";
|
import { isValidScope, validateMembership } from "../../helpers";
|
||||||
import { ServiceTokenData } from "../../models";
|
import { Folder, SecretImport, ServiceTokenData } from "../../models";
|
||||||
import Folder from "../../models/folder";
|
|
||||||
import SecretImport from "../../models/secretImports";
|
|
||||||
import { getAllImportedSecrets } from "../../services/SecretImportService";
|
import { getAllImportedSecrets } from "../../services/SecretImportService";
|
||||||
import { getFolderWithPathFromId } from "../../services/FolderService";
|
import { getFolderWithPathFromId } from "../../services/FolderService";
|
||||||
import { BadRequestError, ResourceNotFoundError,UnauthorizedRequestError } from "../../utils/errors";
|
import { BadRequestError, ResourceNotFoundError,UnauthorizedRequestError } from "../../utils/errors";
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import { EventType, FolderVersion } from "../../ee/models";
|
|||||||
import { EEAuditLogService, EESecretService } from "../../ee/services";
|
import { EEAuditLogService, EESecretService } from "../../ee/services";
|
||||||
import { validateMembership } from "../../helpers/membership";
|
import { validateMembership } from "../../helpers/membership";
|
||||||
import { isValidScope } from "../../helpers/secrets";
|
import { isValidScope } from "../../helpers/secrets";
|
||||||
import { Secret, ServiceTokenData } from "../../models";
|
import { Folder, Secret, ServiceTokenData } from "../../models";
|
||||||
import Folder from "../../models/folder";
|
|
||||||
import {
|
import {
|
||||||
appendFolder,
|
appendFolder,
|
||||||
deleteFolderById,
|
deleteFolderById,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Request, Response } from "express";
|
|||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { client, getRootEncryptionKey } from "../../config";
|
import { client, getRootEncryptionKey } from "../../config";
|
||||||
import { validateMembership } from "../../helpers";
|
import { validateMembership } from "../../helpers";
|
||||||
import Webhook from "../../models/webhooks";
|
import { Webhook } from "../../models";
|
||||||
import { getWebhookPayload, triggerWebhookRequest } from "../../services/WebhookService";
|
import { getWebhookPayload, triggerWebhookRequest } from "../../services/WebhookService";
|
||||||
import { BadRequestError, ResourceNotFoundError } from "../../utils/errors";
|
import { BadRequestError, ResourceNotFoundError } from "../../utils/errors";
|
||||||
import { EEAuditLogService } from "../../ee/services";
|
import { EEAuditLogService } from "../../ee/services";
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import mongoose, { Types } from "mongoose";
|
import mongoose, { Types } from "mongoose";
|
||||||
import Secret, { ISecret } from "../../models/secret";
|
|
||||||
import {
|
import {
|
||||||
CreateSecretRequestBody,
|
CreateSecretRequestBody,
|
||||||
ModifySecretRequestBody,
|
ModifySecretRequestBody,
|
||||||
@@ -20,7 +19,7 @@ import {
|
|||||||
SECRET_SHARED
|
SECRET_SHARED
|
||||||
} from "../../variables";
|
} from "../../variables";
|
||||||
import { TelemetryService } from "../../services";
|
import { TelemetryService } from "../../services";
|
||||||
import { User } from "../../models";
|
import { ISecret, Secret, User } from "../../models";
|
||||||
import { AccountNotFoundError } from "../../utils/errors";
|
import { AccountNotFoundError } from "../../utils/errors";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import { ISecret, Secret, ServiceTokenData } from "../../models";
|
import { Folder, ISecret, Secret, ServiceTokenData, Tag } from "../../models";
|
||||||
import { AuditLog, EventType, IAction, SecretVersion } from "../../ee/models";
|
import { AuditLog, EventType, IAction, SecretVersion } from "../../ee/models";
|
||||||
import {
|
import {
|
||||||
ACTION_ADD_SECRETS,
|
ACTION_ADD_SECRETS,
|
||||||
@@ -24,10 +24,8 @@ import {
|
|||||||
userHasWorkspaceAccess,
|
userHasWorkspaceAccess,
|
||||||
userHasWriteOnlyAbility
|
userHasWriteOnlyAbility
|
||||||
} from "../../ee/helpers/checkMembershipPermissions";
|
} from "../../ee/helpers/checkMembershipPermissions";
|
||||||
import Tag from "../../models/tag";
|
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { BatchSecret, BatchSecretRequest } from "../../types/secret";
|
import { BatchSecret, BatchSecretRequest } from "../../types/secret";
|
||||||
import Folder from "../../models/folder";
|
|
||||||
import {
|
import {
|
||||||
getFolderByPath,
|
getFolderByPath,
|
||||||
getFolderIdFromServiceToken,
|
getFolderIdFromServiceToken,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { Membership, Secret } from "../../models";
|
import { Membership, Secret, Tag } from "../../models";
|
||||||
import Tag from "../../models/tag";
|
|
||||||
import { BadRequestError, UnauthorizedRequestError } from "../../utils/errors";
|
import { BadRequestError, UnauthorizedRequestError } from "../../utils/errors";
|
||||||
|
|
||||||
export const createWorkspaceTag = async (req: Request, res: Response) => {
|
export const createWorkspaceTag = async (req: Request, res: Response) => {
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ import { BotService } from "../../services";
|
|||||||
import { containsGlobPatterns, repackageSecretToRaw } from "../../helpers/secrets";
|
import { containsGlobPatterns, repackageSecretToRaw } from "../../helpers/secrets";
|
||||||
import { encryptSymmetric128BitHexKeyUTF8 } from "../../utils/crypto";
|
import { encryptSymmetric128BitHexKeyUTF8 } from "../../utils/crypto";
|
||||||
import { getAllImportedSecrets } from "../../services/SecretImportService";
|
import { getAllImportedSecrets } from "../../services/SecretImportService";
|
||||||
import Folder from "../../models/folder";
|
import { Folder, IServiceTokenData } from "../../models";
|
||||||
import { getFolderByPath } from "../../services/FolderService";
|
import { getFolderByPath } from "../../services/FolderService";
|
||||||
import { BadRequestError } from "../../utils/errors";
|
import { BadRequestError } from "../../utils/errors";
|
||||||
import { IServiceTokenData } from "../../models";
|
|
||||||
import { requireWorkspaceAuth } from "../../middleware";
|
import { requireWorkspaceAuth } from "../../middleware";
|
||||||
import { ADMIN, MEMBER, PERMISSION_READ_SECRETS } from "../../variables";
|
import { ADMIN, MEMBER, PERMISSION_READ_SECRETS } from "../../variables";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import { PipelineStage, Types } from "mongoose";
|
import { PipelineStage, Types } from "mongoose";
|
||||||
import { Membership, Secret, ServiceTokenData, User } from "../../../models";
|
import { Folder, Membership, Secret, ServiceTokenData, TFolderSchema, User } from "../../../models";
|
||||||
import {
|
import {
|
||||||
ActorType,
|
ActorType,
|
||||||
AuditLog,
|
AuditLog,
|
||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
} from "../../models";
|
} from "../../models";
|
||||||
import { EESecretService } from "../../services";
|
import { EESecretService } from "../../services";
|
||||||
import { getLatestSecretVersionIds } from "../../helpers/secretVersion";
|
import { getLatestSecretVersionIds } from "../../helpers/secretVersion";
|
||||||
import Folder, { TFolderSchema } from "../../../models/folder";
|
// import Folder, { TFolderSchema } from "../../../models/folder";
|
||||||
import { searchByFolderId } from "../../../services/FolderService";
|
import { searchByFolderId } from "../../../services/FolderService";
|
||||||
import { EEAuditLogService, EELicenseService } from "../../services";
|
import { EEAuditLogService, EELicenseService } from "../../services";
|
||||||
import { extractIPDetails, isValidIpOrCidr } from "../../../utils/ip";
|
import { extractIPDetails, isValidIpOrCidr } from "../../../utils/ip";
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
} from "../variables";
|
} from "../variables";
|
||||||
import { client, getEncryptionKey, getRootEncryptionKey } from "../config";
|
import { client, getEncryptionKey, getRootEncryptionKey } from "../config";
|
||||||
import { InternalServerError } from "../utils/errors";
|
import { InternalServerError } from "../utils/errors";
|
||||||
import Folder from "../models/folder";
|
import { Folder } from "../models";
|
||||||
import { getFolderByPath } from "../services/FolderService";
|
import { getFolderByPath } from "../services/FolderService";
|
||||||
import { getAllImportedSecrets } from "../services/SecretImportService";
|
import { getAllImportedSecrets } from "../services/SecretImportService";
|
||||||
import { expandSecrets } from "./secrets";
|
import { expandSecrets } from "./secrets";
|
||||||
|
|||||||
@@ -7,11 +7,13 @@ import {
|
|||||||
UpdateSecretParams
|
UpdateSecretParams
|
||||||
} from "../interfaces/services/SecretService";
|
} from "../interfaces/services/SecretService";
|
||||||
import {
|
import {
|
||||||
|
Folder,
|
||||||
ISecret,
|
ISecret,
|
||||||
IServiceTokenData,
|
IServiceTokenData,
|
||||||
Secret,
|
Secret,
|
||||||
SecretBlindIndexData,
|
SecretBlindIndexData,
|
||||||
ServiceTokenData
|
ServiceTokenData,
|
||||||
|
TFolderRootSchema
|
||||||
} from "../models";
|
} from "../models";
|
||||||
import { EventType, SecretVersion } from "../ee/models";
|
import { EventType, SecretVersion } from "../ee/models";
|
||||||
import {
|
import {
|
||||||
@@ -46,7 +48,6 @@ import { getAuthDataPayloadIdObj, getAuthDataPayloadUserObj } from "../utils/aut
|
|||||||
import { getFolderByPath, getFolderIdFromServiceToken } from "../services/FolderService";
|
import { getFolderByPath, getFolderIdFromServiceToken } from "../services/FolderService";
|
||||||
import picomatch from "picomatch";
|
import picomatch from "picomatch";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import Folder, { TFolderRootSchema } from "../models/folder";
|
|
||||||
|
|
||||||
export const isValidScope = (
|
export const isValidScope = (
|
||||||
authPayload: IServiceTokenData,
|
authPayload: IServiceTokenData,
|
||||||
|
|||||||
@@ -2004,7 +2004,7 @@ const syncSecretsCheckly = async ({
|
|||||||
secrets: Record<string, { value: string; comment?: string }>;
|
secrets: Record<string, { value: string; comment?: string }>;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
}) => {
|
}) => {
|
||||||
// get secrets from travis-ci
|
|
||||||
const getSecretsRes = (
|
const getSecretsRes = (
|
||||||
await standardRequest.get(`${INTEGRATION_CHECKLY_API_URL}/v1/variables`, {
|
await standardRequest.get(`${INTEGRATION_CHECKLY_API_URL}/v1/variables`, {
|
||||||
headers: {
|
headers: {
|
||||||
@@ -2026,7 +2026,6 @@ const syncSecretsCheckly = async ({
|
|||||||
if (!(key in getSecretsRes)) {
|
if (!(key in getSecretsRes)) {
|
||||||
// case: secret does not exist in checkly
|
// case: secret does not exist in checkly
|
||||||
// -> add secret
|
// -> add secret
|
||||||
|
|
||||||
await standardRequest.post(
|
await standardRequest.post(
|
||||||
`${INTEGRATION_CHECKLY_API_URL}/v1/variables`,
|
`${INTEGRATION_CHECKLY_API_URL}/v1/variables`,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,6 +36,4 @@ const apiKeyDataSchema = new Schema<IAPIKeyData>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const APIKeyData = model<IAPIKeyData>("APIKeyData", apiKeyDataSchema);
|
export const APIKeyData = model<IAPIKeyData>("APIKeyData", apiKeyDataSchema);
|
||||||
|
|
||||||
export default APIKeyData;
|
|
||||||
@@ -68,9 +68,7 @@ const backupPrivateKeySchema = new Schema<IBackupPrivateKey>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const BackupPrivateKey = model<IBackupPrivateKey>(
|
export const BackupPrivateKey = model<IBackupPrivateKey>(
|
||||||
"BackupPrivateKey",
|
"BackupPrivateKey",
|
||||||
backupPrivateKeySchema
|
backupPrivateKeySchema
|
||||||
);
|
);
|
||||||
|
|
||||||
export default BackupPrivateKey;
|
|
||||||
|
|||||||
@@ -74,6 +74,4 @@ const botSchema = new Schema<IBot>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const Bot = model<IBot>("Bot", botSchema);
|
export const Bot = model<IBot>("Bot", botSchema);
|
||||||
|
|
||||||
export default Bot;
|
|
||||||
@@ -40,6 +40,4 @@ const botKeySchema = new Schema<IBotKey>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const BotKey = model<IBotKey>("BotKey", botKeySchema);
|
export const BotKey = model<IBotKey>("BotKey", botKeySchema);
|
||||||
|
|
||||||
export default BotKey;
|
|
||||||
@@ -93,6 +93,4 @@ const botOrgSchema = new Schema<IBotOrg>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const BotOrg = model<IBotOrg>("BotOrg", botOrgSchema);
|
export const BotOrg = model<IBotOrg>("BotOrg", botOrgSchema);
|
||||||
|
|
||||||
export default BotOrg;
|
|
||||||
@@ -51,6 +51,4 @@ const folderRootSchema = new Schema<TFolderRootSchema>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const Folder = model<TFolderRootSchema>("Folder", folderRootSchema);
|
export const Folder = model<TFolderRootSchema>("Folder", folderRootSchema);
|
||||||
|
|
||||||
export default Folder;
|
|
||||||
@@ -23,9 +23,7 @@ const incidentContactOrgSchema = new Schema<IIncidentContactOrg>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const IncidentContactOrg = model<IIncidentContactOrg>(
|
export const IncidentContactOrg = model<IIncidentContactOrg>(
|
||||||
"IncidentContactOrg",
|
"IncidentContactOrg",
|
||||||
incidentContactOrgSchema
|
incidentContactOrgSchema
|
||||||
);
|
);
|
||||||
|
|
||||||
export default IncidentContactOrg;
|
|
||||||
+30
-89
@@ -1,89 +1,30 @@
|
|||||||
import BackupPrivateKey, { IBackupPrivateKey } from "./backupPrivateKey";
|
export * from "./backupPrivateKey";
|
||||||
import Bot, { IBot } from "./bot";
|
export * from "./bot";
|
||||||
import BotOrg, { IBotOrg } from "./botOrg";
|
export * from "./botOrg";
|
||||||
import BotKey, { IBotKey } from "./botKey";
|
export * from "./botKey";
|
||||||
import IncidentContactOrg, { IIncidentContactOrg } from "./incidentContactOrg";
|
export * from "./incidentContactOrg";
|
||||||
import Integration, { IIntegration } from "./integration";
|
export * from "./integration/integration";
|
||||||
import IntegrationAuth, { IIntegrationAuth } from "./integrationAuth";
|
export * from "./integrationAuth";
|
||||||
import Key, { IKey } from "./key";
|
export * from "./key";
|
||||||
import Membership, { IMembership } from "./membership";
|
export * from "./membership";
|
||||||
import MembershipOrg, { IMembershipOrg } from "./membershipOrg";
|
export * from "./membershipOrg";
|
||||||
import Organization, { IOrganization } from "./organization";
|
export * from "./organization";
|
||||||
import Secret, { ISecret } from "./secret";
|
export * from "./secret";
|
||||||
import Folder, { TFolderRootSchema, TFolderSchema } from "./folder";
|
export * from "./tag";
|
||||||
import SecretImport, { ISecretImports } from "./secretImports";
|
export * from "./folder";
|
||||||
import SecretBlindIndexData, { ISecretBlindIndexData } from "./secretBlindIndexData";
|
export * from "./secretImports";
|
||||||
import ServiceToken, { IServiceToken } from "./serviceToken";
|
export * from "./secretBlindIndexData";
|
||||||
import ServiceAccount, { IServiceAccount } from "./serviceAccount"; // new
|
export * from "./serviceToken";
|
||||||
import ServiceAccountKey, { IServiceAccountKey } from "./serviceAccountKey"; // new
|
export * from "./serviceAccount";
|
||||||
import ServiceAccountOrganizationPermission, { IServiceAccountOrganizationPermission } from "./serviceAccountOrganizationPermission"; // new
|
export * from "./serviceAccountKey";
|
||||||
import ServiceAccountWorkspacePermission, { IServiceAccountWorkspacePermission } from "./serviceAccountWorkspacePermission"; // new
|
export * from "./serviceAccountOrganizationPermission";
|
||||||
import TokenData, { ITokenData } from "./tokenData";
|
export * from "./serviceAccountWorkspacePermission";
|
||||||
import User, { AuthMethod, IUser } from "./user";
|
export * from "./tokenData";
|
||||||
import UserAction, { IUserAction } from "./userAction";
|
export * from "./user";
|
||||||
import Workspace, { IWorkspace } from "./workspace";
|
export * from "./userAction";
|
||||||
import ServiceTokenData, { IServiceTokenData } from "./serviceTokenData";
|
export * from "./workspace";
|
||||||
import APIKeyData, { IAPIKeyData } from "./apiKeyData";
|
export * from "./serviceTokenData";
|
||||||
import LoginSRPDetail, { ILoginSRPDetail } from "./loginSRPDetail";
|
export * from "./apiKeyData";
|
||||||
import TokenVersion, { ITokenVersion } from "./tokenVersion";
|
export * from "./loginSRPDetail";
|
||||||
|
export * from "./tokenVersion";
|
||||||
export {
|
export * from "./webhooks";
|
||||||
AuthMethod,
|
|
||||||
BackupPrivateKey,
|
|
||||||
IBackupPrivateKey,
|
|
||||||
Bot,
|
|
||||||
IBot,
|
|
||||||
BotOrg,
|
|
||||||
IBotOrg,
|
|
||||||
BotKey,
|
|
||||||
IBotKey,
|
|
||||||
IncidentContactOrg,
|
|
||||||
IIncidentContactOrg,
|
|
||||||
Integration,
|
|
||||||
IIntegration,
|
|
||||||
IntegrationAuth,
|
|
||||||
IIntegrationAuth,
|
|
||||||
Key,
|
|
||||||
IKey,
|
|
||||||
Membership,
|
|
||||||
IMembership,
|
|
||||||
MembershipOrg,
|
|
||||||
IMembershipOrg,
|
|
||||||
Organization,
|
|
||||||
IOrganization,
|
|
||||||
Secret,
|
|
||||||
ISecret,
|
|
||||||
Folder,
|
|
||||||
TFolderRootSchema,
|
|
||||||
TFolderSchema,
|
|
||||||
SecretImport,
|
|
||||||
ISecretImports,
|
|
||||||
SecretBlindIndexData,
|
|
||||||
ISecretBlindIndexData,
|
|
||||||
ServiceToken,
|
|
||||||
IServiceToken,
|
|
||||||
ServiceAccount,
|
|
||||||
IServiceAccount,
|
|
||||||
ServiceAccountKey,
|
|
||||||
IServiceAccountKey,
|
|
||||||
ServiceAccountOrganizationPermission,
|
|
||||||
IServiceAccountOrganizationPermission,
|
|
||||||
ServiceAccountWorkspacePermission,
|
|
||||||
IServiceAccountWorkspacePermission,
|
|
||||||
TokenData,
|
|
||||||
ITokenData,
|
|
||||||
User,
|
|
||||||
IUser,
|
|
||||||
UserAction,
|
|
||||||
IUserAction,
|
|
||||||
Workspace,
|
|
||||||
IWorkspace,
|
|
||||||
ServiceTokenData,
|
|
||||||
IServiceTokenData,
|
|
||||||
APIKeyData,
|
|
||||||
IAPIKeyData,
|
|
||||||
LoginSRPDetail,
|
|
||||||
ILoginSRPDetail,
|
|
||||||
TokenVersion,
|
|
||||||
ITokenVersion
|
|
||||||
};
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./integration";
|
||||||
@@ -26,8 +26,9 @@ import {
|
|||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
INTEGRATION_VERCEL,
|
INTEGRATION_VERCEL,
|
||||||
INTEGRATION_WINDMILL
|
INTEGRATION_WINDMILL
|
||||||
} from "../variables";
|
} from "../../variables";
|
||||||
import { Schema, Types, model } from "mongoose";
|
import { Schema, Types, model } from "mongoose";
|
||||||
|
import { Metadata } from "./types";
|
||||||
|
|
||||||
export interface IIntegration {
|
export interface IIntegration {
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
@@ -74,6 +75,7 @@ export interface IIntegration {
|
|||||||
| "windmill"
|
| "windmill"
|
||||||
| "gcp-secret-manager";
|
| "gcp-secret-manager";
|
||||||
integrationAuth: Types.ObjectId;
|
integrationAuth: Types.ObjectId;
|
||||||
|
metadata: Metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
const integrationSchema = new Schema<IIntegration>(
|
const integrationSchema = new Schema<IIntegration>(
|
||||||
@@ -183,6 +185,9 @@ const integrationSchema = new Schema<IIntegration>(
|
|||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
default: "/",
|
default: "/",
|
||||||
|
},
|
||||||
|
metadata: {
|
||||||
|
type: Schema.Types.Mixed
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -190,6 +195,4 @@ const integrationSchema = new Schema<IIntegration>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const Integration = model<IIntegration>("Integration", integrationSchema);
|
export const Integration = model<IIntegration>("Integration", integrationSchema);
|
||||||
|
|
||||||
export default Integration;
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export type Metadata = {
|
||||||
|
secretSuffix?: string;
|
||||||
|
}
|
||||||
@@ -193,9 +193,7 @@ const integrationAuthSchema = new Schema<IIntegrationAuth>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const IntegrationAuth = model<IIntegrationAuth>(
|
export const IntegrationAuth = model<IIntegrationAuth>(
|
||||||
"IntegrationAuth",
|
"IntegrationAuth",
|
||||||
integrationAuthSchema
|
integrationAuthSchema
|
||||||
);
|
);
|
||||||
|
|
||||||
export default IntegrationAuth;
|
|
||||||
@@ -40,6 +40,4 @@ const keySchema = new Schema<IKey>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const Key = model<IKey>("Key", keySchema);
|
export const Key = model<IKey>("Key", keySchema);
|
||||||
|
|
||||||
export default Key;
|
|
||||||
@@ -24,6 +24,4 @@ const loginSRPDetailSchema = new Schema<ILoginSRPDetail>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const LoginSRPDetail = model("LoginSRPDetail", loginSRPDetailSchema);
|
export const LoginSRPDetail = model("LoginSRPDetail", loginSRPDetailSchema);
|
||||||
|
|
||||||
export default LoginSRPDetail;
|
|
||||||
@@ -52,6 +52,4 @@ const membershipSchema = new Schema<IMembership>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const Membership = model<IMembership>("Membership", membershipSchema);
|
export const Membership = model<IMembership>("Membership", membershipSchema);
|
||||||
|
|
||||||
export default Membership;
|
|
||||||
@@ -39,9 +39,7 @@ const membershipOrgSchema = new Schema(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const MembershipOrg = model<IMembershipOrg>(
|
export const MembershipOrg = model<IMembershipOrg>(
|
||||||
"MembershipOrg",
|
"MembershipOrg",
|
||||||
membershipOrgSchema
|
membershipOrgSchema
|
||||||
);
|
);
|
||||||
|
|
||||||
export default MembershipOrg;
|
|
||||||
@@ -21,6 +21,4 @@ const organizationSchema = new Schema<IOrganization>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const Organization = model<IOrganization>("Organization", organizationSchema);
|
export const Organization = model<IOrganization>("Organization", organizationSchema);
|
||||||
|
|
||||||
export default Organization;
|
|
||||||
@@ -145,6 +145,4 @@ const secretSchema = new Schema<ISecret>(
|
|||||||
|
|
||||||
secretSchema.index({ tags: 1 }, { background: true });
|
secretSchema.index({ tags: 1 }, { background: true });
|
||||||
|
|
||||||
const Secret = model<ISecret>("Secret", secretSchema);
|
export const Secret = model<ISecret>("Secret", secretSchema);
|
||||||
|
|
||||||
export default Secret;
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import mongoose, { Schema, model } from "mongoose";
|
import mongoose, { Schema, model } from "mongoose";
|
||||||
import Secret, { ISecret } from "./secret";
|
import { ISecret, Secret } from "./secret";
|
||||||
|
|
||||||
interface ISecretApprovalRequest {
|
interface ISecretApprovalRequest {
|
||||||
secret: mongoose.Types.ObjectId;
|
secret: mongoose.Types.ObjectId;
|
||||||
@@ -78,6 +78,4 @@ const secretApprovalRequestSchema = new Schema<ISecretApprovalRequest>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const SecretApprovalRequest = model<ISecretApprovalRequest>("SecretApprovalRequest", secretApprovalRequestSchema);
|
export const SecretApprovalRequest = model<ISecretApprovalRequest>("SecretApprovalRequest", secretApprovalRequestSchema);
|
||||||
|
|
||||||
export default SecretApprovalRequest;
|
|
||||||
@@ -53,6 +53,4 @@ const secretBlindIndexDataSchema = new Schema<ISecretBlindIndexData>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const SecretBlindIndexData = model<ISecretBlindIndexData>("SecretBlindIndexData", secretBlindIndexDataSchema);
|
export const SecretBlindIndexData = model<ISecretBlindIndexData>("SecretBlindIndexData", secretBlindIndexDataSchema);
|
||||||
|
|
||||||
export default SecretBlindIndexData;
|
|
||||||
@@ -48,5 +48,4 @@ const secretImportSchema = new Schema<ISecretImports>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const SecretImport = model<ISecretImports>("SecretImports", secretImportSchema);
|
export const SecretImport = model<ISecretImports>("SecretImports", secretImportSchema);
|
||||||
export default SecretImport;
|
|
||||||
@@ -48,6 +48,4 @@ const serviceAccountSchema = new Schema<IServiceAccount>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const ServiceAccount = model<IServiceAccount>("ServiceAccount", serviceAccountSchema);
|
export const ServiceAccount = model<IServiceAccount>("ServiceAccount", serviceAccountSchema);
|
||||||
|
|
||||||
export default ServiceAccount;
|
|
||||||
@@ -39,6 +39,4 @@ const serviceAccountKeySchema = new Schema<IServiceAccountKey>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const ServiceAccountKey = model<IServiceAccountKey>("ServiceAccountKey", serviceAccountKeySchema);
|
export const ServiceAccountKey = model<IServiceAccountKey>("ServiceAccountKey", serviceAccountKeySchema);
|
||||||
|
|
||||||
export default ServiceAccountKey;
|
|
||||||
@@ -18,6 +18,4 @@ const serviceAccountOrganizationPermissionSchema = new Schema<IServiceAccountOrg
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const ServiceAccountOrganizationPermission = model<IServiceAccountOrganizationPermission>("ServiceAccountOrganizationPermission", serviceAccountOrganizationPermissionSchema);
|
export const ServiceAccountOrganizationPermission = model<IServiceAccountOrganizationPermission>("ServiceAccountOrganizationPermission", serviceAccountOrganizationPermissionSchema);
|
||||||
|
|
||||||
export default ServiceAccountOrganizationPermission;
|
|
||||||
@@ -39,6 +39,4 @@ const serviceAccountWorkspacePermissionSchema = new Schema<IServiceAccountWorksp
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const ServiceAccountWorkspacePermission = model<IServiceAccountWorkspacePermission>("ServiceAccountWorkspacePermission", serviceAccountWorkspacePermissionSchema);
|
export const ServiceAccountWorkspacePermission = model<IServiceAccountWorkspacePermission>("ServiceAccountWorkspacePermission", serviceAccountWorkspacePermissionSchema);
|
||||||
|
|
||||||
export default ServiceAccountWorkspacePermission;
|
|
||||||
@@ -56,6 +56,4 @@ const serviceTokenSchema = new Schema<IServiceToken>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const ServiceToken = model<IServiceToken>("ServiceToken", serviceTokenSchema);
|
export const ServiceToken = model<IServiceToken>("ServiceToken", serviceTokenSchema);
|
||||||
|
|
||||||
export default ServiceToken;
|
|
||||||
@@ -89,6 +89,4 @@ const serviceTokenDataSchema = new Schema<IServiceTokenData>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const ServiceTokenData = model<IServiceTokenData>("ServiceTokenData", serviceTokenDataSchema);
|
export const ServiceTokenData = model<IServiceTokenData>("ServiceTokenData", serviceTokenDataSchema);
|
||||||
|
|
||||||
export default ServiceTokenData;
|
|
||||||
@@ -50,6 +50,4 @@ const tagSchema = new Schema<ITag>(
|
|||||||
tagSchema.index({ slug: 1, workspace: 1 }, { unique: true })
|
tagSchema.index({ slug: 1, workspace: 1 }, { unique: true })
|
||||||
tagSchema.index({ workspace: 1 })
|
tagSchema.index({ workspace: 1 })
|
||||||
|
|
||||||
const Tag = model<ITag>("Tag", tagSchema);
|
export const Tag = model<ITag>("Tag", tagSchema);
|
||||||
|
|
||||||
export default Tag;
|
|
||||||
@@ -27,6 +27,4 @@ const tokenSchema = new Schema<IToken>({
|
|||||||
|
|
||||||
tokenSchema.index({ email: 1 });
|
tokenSchema.index({ email: 1 });
|
||||||
|
|
||||||
const Token = model<IToken>("Token", tokenSchema);
|
export const Token = model<IToken>("Token", tokenSchema);
|
||||||
|
|
||||||
export default Token;
|
|
||||||
@@ -50,6 +50,4 @@ const tokenDataSchema = new Schema<ITokenData>({
|
|||||||
timestamps: true,
|
timestamps: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const TokenData = model<ITokenData>("TokenData", tokenDataSchema);
|
export const TokenData = model<ITokenData>("TokenData", tokenDataSchema);
|
||||||
|
|
||||||
export default TokenData;
|
|
||||||
@@ -42,6 +42,4 @@ const tokenVersionSchema = new Schema<ITokenVersion>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const TokenVersion = model<ITokenVersion>("TokenVersion", tokenVersionSchema);
|
export const TokenVersion = model<ITokenVersion>("TokenVersion", tokenVersionSchema);
|
||||||
|
|
||||||
export default TokenVersion;
|
|
||||||
@@ -121,6 +121,4 @@ const userSchema = new Schema<IUser>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const User = model<IUser>("User", userSchema);
|
export const User = model<IUser>("User", userSchema);
|
||||||
|
|
||||||
export default User;
|
|
||||||
@@ -23,6 +23,4 @@ const userActionSchema = new Schema<IUserAction>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const UserAction = model<IUserAction>("UserAction", userActionSchema);
|
export const UserAction = model<IUserAction>("UserAction", userActionSchema);
|
||||||
|
|
||||||
export default UserAction;
|
|
||||||
@@ -80,6 +80,4 @@ const WebhookSchema = new Schema<IWebhook>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const Webhook = model<IWebhook>("Webhook", WebhookSchema);
|
export const Webhook = model<IWebhook>("Webhook", WebhookSchema);
|
||||||
|
|
||||||
export default Webhook;
|
|
||||||
@@ -49,6 +49,4 @@ const workspaceSchema = new Schema<IWorkspace>({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const Workspace = model<IWorkspace>("Workspace", workspaceSchema);
|
export const Workspace = model<IWorkspace>("Workspace", workspaceSchema);
|
||||||
|
|
||||||
export default Workspace;
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import Queue, { Job } from "bull";
|
import Queue, { Job } from "bull";
|
||||||
import Integration from "../../models/integration";
|
import { Integration, IntegrationAuth } from "../../models";
|
||||||
import IntegrationAuth from "../../models/integrationAuth";
|
|
||||||
import { BotService } from "../../services";
|
import { BotService } from "../../services";
|
||||||
import { getIntegrationAuthAccessHelper } from "../../helpers";
|
import { getIntegrationAuthAccessHelper } from "../../helpers";
|
||||||
import { syncSecrets } from "../../integrations/sync"
|
import { syncSecrets } from "../../integrations/sync"
|
||||||
@@ -36,6 +35,14 @@ syncSecretsToThirdPartyServices.process(async (job: Job) => {
|
|||||||
secretPath: integration.secretPath
|
secretPath: integration.secretPath
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const suffixedSecrets: any = {};
|
||||||
|
if (integration.metadata?.secretSuffix) {
|
||||||
|
for (const key in secrets) {
|
||||||
|
const newKey = key + integration.metadata?.secretSuffix;
|
||||||
|
suffixedSecrets[newKey] = secrets[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const integrationAuth = await IntegrationAuth.findById(integration.integrationAuth);
|
const integrationAuth = await IntegrationAuth.findById(integration.integrationAuth);
|
||||||
|
|
||||||
if (!integrationAuth) throw new Error("Failed to find integration auth");
|
if (!integrationAuth) throw new Error("Failed to find integration auth");
|
||||||
@@ -49,7 +56,7 @@ syncSecretsToThirdPartyServices.process(async (job: Job) => {
|
|||||||
await syncSecrets({
|
await syncSecrets({
|
||||||
integration,
|
integration,
|
||||||
integrationAuth,
|
integrationAuth,
|
||||||
secrets,
|
secrets: Object.keys(suffixedSecrets).length !== 0 ? suffixedSecrets : secrets,
|
||||||
accessId: access.accessId === undefined ? null : access.accessId,
|
accessId: access.accessId === undefined ? null : access.accessId,
|
||||||
accessToken: access.accessToken
|
accessToken: access.accessToken
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ router.post(
|
|||||||
body("owner").trim(),
|
body("owner").trim(),
|
||||||
body("path").trim(),
|
body("path").trim(),
|
||||||
body("region").trim(),
|
body("region").trim(),
|
||||||
|
body("metadata").optional().isObject().withMessage("Metadata should be an object"),
|
||||||
|
body("metadata.secretSuffix").optional().isString().withMessage("Suffix should be a string"),
|
||||||
validateRequest,
|
validateRequest,
|
||||||
integrationController.createIntegration
|
integrationController.createIntegration
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { nanoid } from "nanoid";
|
import { nanoid } from "nanoid";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import Folder, { TFolderSchema } from "../models/folder";
|
import { Folder, TFolderSchema } from "../models";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
type TAppendFolderDTO = {
|
type TAppendFolderDTO = {
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import Folder from "../models/folder";
|
import {
|
||||||
import Secret, { ISecret } from "../models/secret";
|
Folder,
|
||||||
import SecretImport from "../models/secretImports";
|
ISecret,
|
||||||
|
Secret,
|
||||||
|
SecretImport
|
||||||
|
} from "../models";
|
||||||
import { getFolderByPath } from "./FolderService";
|
import { getFolderByPath } from "./FolderService";
|
||||||
|
|
||||||
type TSecretImportFid = { environment: string; folderId: string; secretPath: string };
|
type TSecretImportFid = { environment: string; folderId: string; secretPath: string };
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import crypto from "crypto";
|
|||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import picomatch from "picomatch";
|
import picomatch from "picomatch";
|
||||||
import { client, getRootEncryptionKey } from "../config";
|
import { client, getRootEncryptionKey } from "../config";
|
||||||
import Webhook, { IWebhook } from "../models/webhooks";
|
import { IWebhook, Webhook } from "../models";
|
||||||
|
|
||||||
export const triggerWebhookRequest = async (
|
export const triggerWebhookRequest = async (
|
||||||
{ url, encryptedSecretKey, iv, tag }: IWebhook,
|
{ url, encryptedSecretKey, iv, tag }: IWebhook,
|
||||||
|
|||||||
@@ -35,3 +35,9 @@ Select which Infisical environment secrets you want to sync to Checkly and press
|
|||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
<Info>
|
||||||
|
In the new version of the Checkly integration, you are able to specify suffixes that depend on the secrets' environment and path.
|
||||||
|
If you choose to do so, you should utilize such suffixes for ALL Checkly integrations – otherwise the integration system
|
||||||
|
might run into issues with deleting secrets from the wrong environments.
|
||||||
|
</Info>
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ export const useCreateIntegration = () => {
|
|||||||
owner,
|
owner,
|
||||||
path,
|
path,
|
||||||
region,
|
region,
|
||||||
secretPath
|
secretPath,
|
||||||
|
metadata
|
||||||
}: {
|
}: {
|
||||||
integrationAuthId: string;
|
integrationAuthId: string;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
@@ -55,6 +56,9 @@ export const useCreateIntegration = () => {
|
|||||||
owner: string | null;
|
owner: string | null;
|
||||||
path: string | null;
|
path: string | null;
|
||||||
region: string | null;
|
region: string | null;
|
||||||
|
metadata?: {
|
||||||
|
secretSuffix?: string;
|
||||||
|
}
|
||||||
}) => {
|
}) => {
|
||||||
const { data: { integration } } = await apiRequest.post("/api/v1/integration", {
|
const { data: { integration } } = await apiRequest.post("/api/v1/integration", {
|
||||||
integrationAuthId,
|
integrationAuthId,
|
||||||
@@ -69,7 +73,8 @@ export const useCreateIntegration = () => {
|
|||||||
owner,
|
owner,
|
||||||
path,
|
path,
|
||||||
region,
|
region,
|
||||||
secretPath
|
secretPath,
|
||||||
|
metadata
|
||||||
});
|
});
|
||||||
|
|
||||||
return integration;
|
return integration;
|
||||||
|
|||||||
@@ -30,4 +30,7 @@ export type TIntegration = {
|
|||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
__v: number;
|
__v: number;
|
||||||
|
metadata?: {
|
||||||
|
secretSuffix?: string;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export default function ChecklyCreateIntegrationPage() {
|
|||||||
|
|
||||||
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
||||||
const [secretPath, setSecretPath] = useState("/");
|
const [secretPath, setSecretPath] = useState("/");
|
||||||
|
const [secretSuffix, setSecretSuffix] = useState("");
|
||||||
|
|
||||||
const [targetApp, setTargetApp] = useState("");
|
const [targetApp, setTargetApp] = useState("");
|
||||||
const [targetAppId, setTargetAppId] = useState("");
|
const [targetAppId, setTargetAppId] = useState("");
|
||||||
@@ -78,7 +79,10 @@ export default function ChecklyCreateIntegrationPage() {
|
|||||||
owner: null,
|
owner: null,
|
||||||
path: null,
|
path: null,
|
||||||
region: null,
|
region: null,
|
||||||
secretPath
|
secretPath,
|
||||||
|
metadata: {
|
||||||
|
secretSuffix
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@@ -148,6 +152,13 @@ export default function ChecklyCreateIntegrationPage() {
|
|||||||
)}
|
)}
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
<FormControl label="Append the Secret Name with..." className="mt-4 px-6">
|
||||||
|
<Input
|
||||||
|
value={secretSuffix}
|
||||||
|
onChange={(evt) => setSecretSuffix(evt.target.value)}
|
||||||
|
placeholder="Provide a suffix for secret names, default is no suffix"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleButtonClick}
|
onClick={handleButtonClick}
|
||||||
color="mineshaft"
|
color="mineshaft"
|
||||||
|
|||||||
+8
@@ -115,6 +115,14 @@ export const IntegrationsSection = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{(integration.integration === "checkly") && (
|
||||||
|
<div className="ml-2 flex flex-col">
|
||||||
|
<FormLabel label="Secret Suffix" />
|
||||||
|
<div className="rounded-md border border-mineshaft-700 bg-mineshaft-900 px-3 py-2 font-inter text-sm text-bunker-200">
|
||||||
|
{integration?.metadata?.secretSuffix || "-"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex cursor-default items-center">
|
<div className="flex cursor-default items-center">
|
||||||
<div className="ml-2 opacity-80 duration-200 hover:opacity-100">
|
<div className="ml-2 opacity-80 duration-200 hover:opacity-100">
|
||||||
|
|||||||
Reference in New Issue
Block a user