mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +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 { Types } from "mongoose";
|
||||
import { Integration } from "../../models";
|
||||
import { Folder, Integration } from "../../models";
|
||||
import { EventService } from "../../services";
|
||||
import { eventStartIntegration } from "../../events";
|
||||
import Folder from "../../models/folder";
|
||||
import { getFolderByPath } from "../../services/FolderService";
|
||||
import { BadRequestError } from "../../utils/errors";
|
||||
import { EEAuditLogService } from "../../ee/services";
|
||||
@@ -30,7 +29,8 @@ export const createIntegration = async (req: Request, res: Response) => {
|
||||
owner,
|
||||
path,
|
||||
region,
|
||||
secretPath
|
||||
secretPath,
|
||||
metadata
|
||||
} = req.body;
|
||||
|
||||
const folders = await Folder.findOne({
|
||||
@@ -65,7 +65,8 @@ export const createIntegration = async (req: Request, res: Response) => {
|
||||
region,
|
||||
secretPath,
|
||||
integration: req.integrationAuth.integration,
|
||||
integrationAuth: new Types.ObjectId(integrationAuthId)
|
||||
integrationAuth: new Types.ObjectId(integrationAuthId),
|
||||
metadata
|
||||
}).save();
|
||||
|
||||
if (integration) {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Request, Response } from "express";
|
||||
import { isValidScope, validateMembership } from "../../helpers";
|
||||
import { ServiceTokenData } from "../../models";
|
||||
import Folder from "../../models/folder";
|
||||
import SecretImport from "../../models/secretImports";
|
||||
import { Folder, SecretImport, ServiceTokenData } from "../../models";
|
||||
import { getAllImportedSecrets } from "../../services/SecretImportService";
|
||||
import { getFolderWithPathFromId } from "../../services/FolderService";
|
||||
import { BadRequestError, ResourceNotFoundError,UnauthorizedRequestError } from "../../utils/errors";
|
||||
|
||||
@@ -4,8 +4,7 @@ import { EventType, FolderVersion } from "../../ee/models";
|
||||
import { EEAuditLogService, EESecretService } from "../../ee/services";
|
||||
import { validateMembership } from "../../helpers/membership";
|
||||
import { isValidScope } from "../../helpers/secrets";
|
||||
import { Secret, ServiceTokenData } from "../../models";
|
||||
import Folder from "../../models/folder";
|
||||
import { Folder, Secret, ServiceTokenData } from "../../models";
|
||||
import {
|
||||
appendFolder,
|
||||
deleteFolderById,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Request, Response } from "express";
|
||||
import { Types } from "mongoose";
|
||||
import { client, getRootEncryptionKey } from "../../config";
|
||||
import { validateMembership } from "../../helpers";
|
||||
import Webhook from "../../models/webhooks";
|
||||
import { Webhook } from "../../models";
|
||||
import { getWebhookPayload, triggerWebhookRequest } from "../../services/WebhookService";
|
||||
import { BadRequestError, ResourceNotFoundError } from "../../utils/errors";
|
||||
import { EEAuditLogService } from "../../ee/services";
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Request, Response } from "express";
|
||||
import mongoose, { Types } from "mongoose";
|
||||
import Secret, { ISecret } from "../../models/secret";
|
||||
import {
|
||||
CreateSecretRequestBody,
|
||||
ModifySecretRequestBody,
|
||||
@@ -20,7 +19,7 @@ import {
|
||||
SECRET_SHARED
|
||||
} from "../../variables";
|
||||
import { TelemetryService } from "../../services";
|
||||
import { User } from "../../models";
|
||||
import { ISecret, Secret, User } from "../../models";
|
||||
import { AccountNotFoundError } from "../../utils/errors";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Types } from "mongoose";
|
||||
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 {
|
||||
ACTION_ADD_SECRETS,
|
||||
@@ -24,10 +24,8 @@ import {
|
||||
userHasWorkspaceAccess,
|
||||
userHasWriteOnlyAbility
|
||||
} from "../../ee/helpers/checkMembershipPermissions";
|
||||
import Tag from "../../models/tag";
|
||||
import _ from "lodash";
|
||||
import { BatchSecret, BatchSecretRequest } from "../../types/secret";
|
||||
import Folder from "../../models/folder";
|
||||
import {
|
||||
getFolderByPath,
|
||||
getFolderIdFromServiceToken,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Request, Response } from "express";
|
||||
import { Types } from "mongoose";
|
||||
import { Membership, Secret } from "../../models";
|
||||
import Tag from "../../models/tag";
|
||||
import { Membership, Secret, Tag } from "../../models";
|
||||
import { BadRequestError, UnauthorizedRequestError } from "../../utils/errors";
|
||||
|
||||
export const createWorkspaceTag = async (req: Request, res: Response) => {
|
||||
|
||||
@@ -6,10 +6,9 @@ import { BotService } from "../../services";
|
||||
import { containsGlobPatterns, repackageSecretToRaw } from "../../helpers/secrets";
|
||||
import { encryptSymmetric128BitHexKeyUTF8 } from "../../utils/crypto";
|
||||
import { getAllImportedSecrets } from "../../services/SecretImportService";
|
||||
import Folder from "../../models/folder";
|
||||
import { Folder, IServiceTokenData } from "../../models";
|
||||
import { getFolderByPath } from "../../services/FolderService";
|
||||
import { BadRequestError } from "../../utils/errors";
|
||||
import { IServiceTokenData } from "../../models";
|
||||
import { requireWorkspaceAuth } from "../../middleware";
|
||||
import { ADMIN, MEMBER, PERMISSION_READ_SECRETS } from "../../variables";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Request, Response } from "express";
|
||||
import { PipelineStage, Types } from "mongoose";
|
||||
import { Membership, Secret, ServiceTokenData, User } from "../../../models";
|
||||
import { Folder, Membership, Secret, ServiceTokenData, TFolderSchema, User } from "../../../models";
|
||||
import {
|
||||
ActorType,
|
||||
AuditLog,
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
} from "../../models";
|
||||
import { EESecretService } from "../../services";
|
||||
import { getLatestSecretVersionIds } from "../../helpers/secretVersion";
|
||||
import Folder, { TFolderSchema } from "../../../models/folder";
|
||||
// import Folder, { TFolderSchema } from "../../../models/folder";
|
||||
import { searchByFolderId } from "../../../services/FolderService";
|
||||
import { EEAuditLogService, EELicenseService } from "../../services";
|
||||
import { extractIPDetails, isValidIpOrCidr } from "../../../utils/ip";
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
} from "../variables";
|
||||
import { client, getEncryptionKey, getRootEncryptionKey } from "../config";
|
||||
import { InternalServerError } from "../utils/errors";
|
||||
import Folder from "../models/folder";
|
||||
import { Folder } from "../models";
|
||||
import { getFolderByPath } from "../services/FolderService";
|
||||
import { getAllImportedSecrets } from "../services/SecretImportService";
|
||||
import { expandSecrets } from "./secrets";
|
||||
|
||||
@@ -7,11 +7,13 @@ import {
|
||||
UpdateSecretParams
|
||||
} from "../interfaces/services/SecretService";
|
||||
import {
|
||||
Folder,
|
||||
ISecret,
|
||||
IServiceTokenData,
|
||||
Secret,
|
||||
SecretBlindIndexData,
|
||||
ServiceTokenData
|
||||
ServiceTokenData,
|
||||
TFolderRootSchema
|
||||
} from "../models";
|
||||
import { EventType, SecretVersion } from "../ee/models";
|
||||
import {
|
||||
@@ -46,7 +48,6 @@ import { getAuthDataPayloadIdObj, getAuthDataPayloadUserObj } from "../utils/aut
|
||||
import { getFolderByPath, getFolderIdFromServiceToken } from "../services/FolderService";
|
||||
import picomatch from "picomatch";
|
||||
import path from "path";
|
||||
import Folder, { TFolderRootSchema } from "../models/folder";
|
||||
|
||||
export const isValidScope = (
|
||||
authPayload: IServiceTokenData,
|
||||
|
||||
@@ -2004,7 +2004,7 @@ const syncSecretsCheckly = async ({
|
||||
secrets: Record<string, { value: string; comment?: string }>;
|
||||
accessToken: string;
|
||||
}) => {
|
||||
// get secrets from travis-ci
|
||||
|
||||
const getSecretsRes = (
|
||||
await standardRequest.get(`${INTEGRATION_CHECKLY_API_URL}/v1/variables`, {
|
||||
headers: {
|
||||
@@ -2026,7 +2026,6 @@ const syncSecretsCheckly = async ({
|
||||
if (!(key in getSecretsRes)) {
|
||||
// case: secret does not exist in checkly
|
||||
// -> add secret
|
||||
|
||||
await standardRequest.post(
|
||||
`${INTEGRATION_CHECKLY_API_URL}/v1/variables`,
|
||||
{
|
||||
|
||||
@@ -36,6 +36,4 @@ const apiKeyDataSchema = new Schema<IAPIKeyData>(
|
||||
}
|
||||
);
|
||||
|
||||
const APIKeyData = model<IAPIKeyData>("APIKeyData", apiKeyDataSchema);
|
||||
|
||||
export default APIKeyData;
|
||||
export const APIKeyData = model<IAPIKeyData>("APIKeyData", apiKeyDataSchema);
|
||||
@@ -68,9 +68,7 @@ const backupPrivateKeySchema = new Schema<IBackupPrivateKey>(
|
||||
}
|
||||
);
|
||||
|
||||
const BackupPrivateKey = model<IBackupPrivateKey>(
|
||||
export const BackupPrivateKey = model<IBackupPrivateKey>(
|
||||
"BackupPrivateKey",
|
||||
backupPrivateKeySchema
|
||||
);
|
||||
|
||||
export default BackupPrivateKey;
|
||||
|
||||
@@ -74,6 +74,4 @@ const botSchema = new Schema<IBot>(
|
||||
}
|
||||
);
|
||||
|
||||
const Bot = model<IBot>("Bot", botSchema);
|
||||
|
||||
export default Bot;
|
||||
export const Bot = model<IBot>("Bot", botSchema);
|
||||
@@ -40,6 +40,4 @@ const botKeySchema = new Schema<IBotKey>(
|
||||
}
|
||||
);
|
||||
|
||||
const BotKey = model<IBotKey>("BotKey", botKeySchema);
|
||||
|
||||
export default BotKey;
|
||||
export const BotKey = model<IBotKey>("BotKey", botKeySchema);
|
||||
@@ -93,6 +93,4 @@ const botOrgSchema = new Schema<IBotOrg>(
|
||||
}
|
||||
);
|
||||
|
||||
const BotOrg = model<IBotOrg>("BotOrg", botOrgSchema);
|
||||
|
||||
export default BotOrg;
|
||||
export const BotOrg = model<IBotOrg>("BotOrg", botOrgSchema);
|
||||
@@ -51,6 +51,4 @@ const folderRootSchema = new Schema<TFolderRootSchema>(
|
||||
}
|
||||
);
|
||||
|
||||
const Folder = model<TFolderRootSchema>("Folder", folderRootSchema);
|
||||
|
||||
export default Folder;
|
||||
export const Folder = model<TFolderRootSchema>("Folder", folderRootSchema);
|
||||
@@ -23,9 +23,7 @@ const incidentContactOrgSchema = new Schema<IIncidentContactOrg>(
|
||||
}
|
||||
);
|
||||
|
||||
const IncidentContactOrg = model<IIncidentContactOrg>(
|
||||
export const IncidentContactOrg = model<IIncidentContactOrg>(
|
||||
"IncidentContactOrg",
|
||||
incidentContactOrgSchema
|
||||
);
|
||||
|
||||
export default IncidentContactOrg;
|
||||
);
|
||||
@@ -1,89 +1,30 @@
|
||||
import BackupPrivateKey, { IBackupPrivateKey } from "./backupPrivateKey";
|
||||
import Bot, { IBot } from "./bot";
|
||||
import BotOrg, { IBotOrg } from "./botOrg";
|
||||
import BotKey, { IBotKey } from "./botKey";
|
||||
import IncidentContactOrg, { IIncidentContactOrg } from "./incidentContactOrg";
|
||||
import Integration, { IIntegration } from "./integration";
|
||||
import IntegrationAuth, { IIntegrationAuth } from "./integrationAuth";
|
||||
import Key, { IKey } from "./key";
|
||||
import Membership, { IMembership } from "./membership";
|
||||
import MembershipOrg, { IMembershipOrg } from "./membershipOrg";
|
||||
import Organization, { IOrganization } from "./organization";
|
||||
import Secret, { ISecret } from "./secret";
|
||||
import Folder, { TFolderRootSchema, TFolderSchema } from "./folder";
|
||||
import SecretImport, { ISecretImports } from "./secretImports";
|
||||
import SecretBlindIndexData, { ISecretBlindIndexData } from "./secretBlindIndexData";
|
||||
import ServiceToken, { IServiceToken } from "./serviceToken";
|
||||
import ServiceAccount, { IServiceAccount } from "./serviceAccount"; // new
|
||||
import ServiceAccountKey, { IServiceAccountKey } from "./serviceAccountKey"; // new
|
||||
import ServiceAccountOrganizationPermission, { IServiceAccountOrganizationPermission } from "./serviceAccountOrganizationPermission"; // new
|
||||
import ServiceAccountWorkspacePermission, { IServiceAccountWorkspacePermission } from "./serviceAccountWorkspacePermission"; // new
|
||||
import TokenData, { ITokenData } from "./tokenData";
|
||||
import User, { AuthMethod, IUser } from "./user";
|
||||
import UserAction, { IUserAction } from "./userAction";
|
||||
import Workspace, { IWorkspace } from "./workspace";
|
||||
import ServiceTokenData, { IServiceTokenData } from "./serviceTokenData";
|
||||
import APIKeyData, { IAPIKeyData } from "./apiKeyData";
|
||||
import LoginSRPDetail, { ILoginSRPDetail } from "./loginSRPDetail";
|
||||
import TokenVersion, { ITokenVersion } from "./tokenVersion";
|
||||
|
||||
export {
|
||||
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
|
||||
};
|
||||
export * from "./backupPrivateKey";
|
||||
export * from "./bot";
|
||||
export * from "./botOrg";
|
||||
export * from "./botKey";
|
||||
export * from "./incidentContactOrg";
|
||||
export * from "./integration/integration";
|
||||
export * from "./integrationAuth";
|
||||
export * from "./key";
|
||||
export * from "./membership";
|
||||
export * from "./membershipOrg";
|
||||
export * from "./organization";
|
||||
export * from "./secret";
|
||||
export * from "./tag";
|
||||
export * from "./folder";
|
||||
export * from "./secretImports";
|
||||
export * from "./secretBlindIndexData";
|
||||
export * from "./serviceToken";
|
||||
export * from "./serviceAccount";
|
||||
export * from "./serviceAccountKey";
|
||||
export * from "./serviceAccountOrganizationPermission";
|
||||
export * from "./serviceAccountWorkspacePermission";
|
||||
export * from "./tokenData";
|
||||
export * from "./user";
|
||||
export * from "./userAction";
|
||||
export * from "./workspace";
|
||||
export * from "./serviceTokenData";
|
||||
export * from "./apiKeyData";
|
||||
export * from "./loginSRPDetail";
|
||||
export * from "./tokenVersion";
|
||||
export * from "./webhooks";
|
||||
1
backend/src/models/integration/index.ts
Normal file
1
backend/src/models/integration/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./integration";
|
||||
@@ -26,8 +26,9 @@ import {
|
||||
INTEGRATION_TRAVISCI,
|
||||
INTEGRATION_VERCEL,
|
||||
INTEGRATION_WINDMILL
|
||||
} from "../variables";
|
||||
} from "../../variables";
|
||||
import { Schema, Types, model } from "mongoose";
|
||||
import { Metadata } from "./types";
|
||||
|
||||
export interface IIntegration {
|
||||
_id: Types.ObjectId;
|
||||
@@ -74,6 +75,7 @@ export interface IIntegration {
|
||||
| "windmill"
|
||||
| "gcp-secret-manager";
|
||||
integrationAuth: Types.ObjectId;
|
||||
metadata: Metadata;
|
||||
}
|
||||
|
||||
const integrationSchema = new Schema<IIntegration>(
|
||||
@@ -183,6 +185,9 @@ const integrationSchema = new Schema<IIntegration>(
|
||||
type: String,
|
||||
required: true,
|
||||
default: "/",
|
||||
},
|
||||
metadata: {
|
||||
type: Schema.Types.Mixed
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -190,6 +195,4 @@ const integrationSchema = new Schema<IIntegration>(
|
||||
}
|
||||
);
|
||||
|
||||
const Integration = model<IIntegration>("Integration", integrationSchema);
|
||||
|
||||
export default Integration;
|
||||
export const Integration = model<IIntegration>("Integration", integrationSchema);
|
||||
3
backend/src/models/integration/types.ts
Normal file
3
backend/src/models/integration/types.ts
Normal file
@@ -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",
|
||||
integrationAuthSchema
|
||||
);
|
||||
|
||||
export default IntegrationAuth;
|
||||
);
|
||||
@@ -40,6 +40,4 @@ const keySchema = new Schema<IKey>(
|
||||
}
|
||||
);
|
||||
|
||||
const Key = model<IKey>("Key", keySchema);
|
||||
|
||||
export default Key;
|
||||
export const Key = model<IKey>("Key", keySchema);
|
||||
@@ -24,6 +24,4 @@ const loginSRPDetailSchema = new Schema<ILoginSRPDetail>(
|
||||
}
|
||||
);
|
||||
|
||||
const LoginSRPDetail = model("LoginSRPDetail", loginSRPDetailSchema);
|
||||
|
||||
export default LoginSRPDetail;
|
||||
export const LoginSRPDetail = model("LoginSRPDetail", loginSRPDetailSchema);
|
||||
@@ -52,6 +52,4 @@ const membershipSchema = new Schema<IMembership>(
|
||||
}
|
||||
);
|
||||
|
||||
const Membership = model<IMembership>("Membership", membershipSchema);
|
||||
|
||||
export default Membership;
|
||||
export const Membership = model<IMembership>("Membership", membershipSchema);
|
||||
@@ -39,9 +39,7 @@ const membershipOrgSchema = new Schema(
|
||||
}
|
||||
);
|
||||
|
||||
const MembershipOrg = model<IMembershipOrg>(
|
||||
export const MembershipOrg = model<IMembershipOrg>(
|
||||
"MembershipOrg",
|
||||
membershipOrgSchema
|
||||
);
|
||||
|
||||
export default MembershipOrg;
|
||||
);
|
||||
@@ -21,6 +21,4 @@ const organizationSchema = new Schema<IOrganization>(
|
||||
}
|
||||
);
|
||||
|
||||
const Organization = model<IOrganization>("Organization", organizationSchema);
|
||||
|
||||
export default Organization;
|
||||
export const Organization = model<IOrganization>("Organization", organizationSchema);
|
||||
@@ -145,6 +145,4 @@ const secretSchema = new Schema<ISecret>(
|
||||
|
||||
secretSchema.index({ tags: 1 }, { background: true });
|
||||
|
||||
const Secret = model<ISecret>("Secret", secretSchema);
|
||||
|
||||
export default Secret;
|
||||
export const Secret = model<ISecret>("Secret", secretSchema);
|
||||
@@ -1,5 +1,5 @@
|
||||
import mongoose, { Schema, model } from "mongoose";
|
||||
import Secret, { ISecret } from "./secret";
|
||||
import { ISecret, Secret } from "./secret";
|
||||
|
||||
interface ISecretApprovalRequest {
|
||||
secret: mongoose.Types.ObjectId;
|
||||
@@ -78,6 +78,4 @@ const secretApprovalRequestSchema = new Schema<ISecretApprovalRequest>(
|
||||
}
|
||||
);
|
||||
|
||||
const SecretApprovalRequest = model<ISecretApprovalRequest>("SecretApprovalRequest", secretApprovalRequestSchema);
|
||||
|
||||
export default SecretApprovalRequest;
|
||||
export const SecretApprovalRequest = model<ISecretApprovalRequest>("SecretApprovalRequest", secretApprovalRequestSchema);
|
||||
@@ -53,6 +53,4 @@ const secretBlindIndexDataSchema = new Schema<ISecretBlindIndexData>(
|
||||
}
|
||||
);
|
||||
|
||||
const SecretBlindIndexData = model<ISecretBlindIndexData>("SecretBlindIndexData", secretBlindIndexDataSchema);
|
||||
|
||||
export default SecretBlindIndexData;
|
||||
export const SecretBlindIndexData = model<ISecretBlindIndexData>("SecretBlindIndexData", secretBlindIndexDataSchema);
|
||||
@@ -48,5 +48,4 @@ const secretImportSchema = new Schema<ISecretImports>(
|
||||
}
|
||||
);
|
||||
|
||||
const SecretImport = model<ISecretImports>("SecretImports", secretImportSchema);
|
||||
export default SecretImport;
|
||||
export const SecretImport = model<ISecretImports>("SecretImports", secretImportSchema);
|
||||
@@ -48,6 +48,4 @@ const serviceAccountSchema = new Schema<IServiceAccount>(
|
||||
}
|
||||
);
|
||||
|
||||
const ServiceAccount = model<IServiceAccount>("ServiceAccount", serviceAccountSchema);
|
||||
|
||||
export default ServiceAccount;
|
||||
export const ServiceAccount = model<IServiceAccount>("ServiceAccount", serviceAccountSchema);
|
||||
@@ -39,6 +39,4 @@ const serviceAccountKeySchema = new Schema<IServiceAccountKey>(
|
||||
}
|
||||
);
|
||||
|
||||
const ServiceAccountKey = model<IServiceAccountKey>("ServiceAccountKey", serviceAccountKeySchema);
|
||||
|
||||
export default ServiceAccountKey;
|
||||
export const ServiceAccountKey = model<IServiceAccountKey>("ServiceAccountKey", serviceAccountKeySchema);
|
||||
@@ -18,6 +18,4 @@ const serviceAccountOrganizationPermissionSchema = new Schema<IServiceAccountOrg
|
||||
}
|
||||
);
|
||||
|
||||
const ServiceAccountOrganizationPermission = model<IServiceAccountOrganizationPermission>("ServiceAccountOrganizationPermission", serviceAccountOrganizationPermissionSchema);
|
||||
|
||||
export default ServiceAccountOrganizationPermission;
|
||||
export const ServiceAccountOrganizationPermission = model<IServiceAccountOrganizationPermission>("ServiceAccountOrganizationPermission", serviceAccountOrganizationPermissionSchema);
|
||||
@@ -39,6 +39,4 @@ const serviceAccountWorkspacePermissionSchema = new Schema<IServiceAccountWorksp
|
||||
}
|
||||
);
|
||||
|
||||
const ServiceAccountWorkspacePermission = model<IServiceAccountWorkspacePermission>("ServiceAccountWorkspacePermission", serviceAccountWorkspacePermissionSchema);
|
||||
|
||||
export default ServiceAccountWorkspacePermission;
|
||||
export const ServiceAccountWorkspacePermission = model<IServiceAccountWorkspacePermission>("ServiceAccountWorkspacePermission", serviceAccountWorkspacePermissionSchema);
|
||||
@@ -56,6 +56,4 @@ const serviceTokenSchema = new Schema<IServiceToken>(
|
||||
}
|
||||
);
|
||||
|
||||
const ServiceToken = model<IServiceToken>("ServiceToken", serviceTokenSchema);
|
||||
|
||||
export default ServiceToken;
|
||||
export const ServiceToken = model<IServiceToken>("ServiceToken", serviceTokenSchema);
|
||||
@@ -89,6 +89,4 @@ const serviceTokenDataSchema = new Schema<IServiceTokenData>(
|
||||
}
|
||||
);
|
||||
|
||||
const ServiceTokenData = model<IServiceTokenData>("ServiceTokenData", serviceTokenDataSchema);
|
||||
|
||||
export default ServiceTokenData;
|
||||
export const ServiceTokenData = model<IServiceTokenData>("ServiceTokenData", serviceTokenDataSchema);
|
||||
@@ -50,6 +50,4 @@ const tagSchema = new Schema<ITag>(
|
||||
tagSchema.index({ slug: 1, workspace: 1 }, { unique: true })
|
||||
tagSchema.index({ workspace: 1 })
|
||||
|
||||
const Tag = model<ITag>("Tag", tagSchema);
|
||||
|
||||
export default Tag;
|
||||
export const Tag = model<ITag>("Tag", tagSchema);
|
||||
@@ -27,6 +27,4 @@ const tokenSchema = new Schema<IToken>({
|
||||
|
||||
tokenSchema.index({ email: 1 });
|
||||
|
||||
const Token = model<IToken>("Token", tokenSchema);
|
||||
|
||||
export default Token;
|
||||
export const Token = model<IToken>("Token", tokenSchema);
|
||||
@@ -50,6 +50,4 @@ const tokenDataSchema = new Schema<ITokenData>({
|
||||
timestamps: true,
|
||||
});
|
||||
|
||||
const TokenData = model<ITokenData>("TokenData", tokenDataSchema);
|
||||
|
||||
export default TokenData;
|
||||
export const TokenData = model<ITokenData>("TokenData", tokenDataSchema);
|
||||
@@ -42,6 +42,4 @@ const tokenVersionSchema = new Schema<ITokenVersion>(
|
||||
}
|
||||
);
|
||||
|
||||
const TokenVersion = model<ITokenVersion>("TokenVersion", tokenVersionSchema);
|
||||
|
||||
export default TokenVersion;
|
||||
export const TokenVersion = model<ITokenVersion>("TokenVersion", tokenVersionSchema);
|
||||
@@ -121,6 +121,4 @@ const userSchema = new Schema<IUser>(
|
||||
}
|
||||
);
|
||||
|
||||
const User = model<IUser>("User", userSchema);
|
||||
|
||||
export default User;
|
||||
export const User = model<IUser>("User", userSchema);
|
||||
@@ -23,6 +23,4 @@ const userActionSchema = new Schema<IUserAction>(
|
||||
}
|
||||
);
|
||||
|
||||
const UserAction = model<IUserAction>("UserAction", userActionSchema);
|
||||
|
||||
export default UserAction;
|
||||
export const UserAction = model<IUserAction>("UserAction", userActionSchema);
|
||||
@@ -80,6 +80,4 @@ const WebhookSchema = new Schema<IWebhook>(
|
||||
}
|
||||
);
|
||||
|
||||
const Webhook = model<IWebhook>("Webhook", WebhookSchema);
|
||||
|
||||
export default Webhook;
|
||||
export const Webhook = model<IWebhook>("Webhook", WebhookSchema);
|
||||
@@ -49,6 +49,4 @@ const workspaceSchema = new Schema<IWorkspace>({
|
||||
},
|
||||
});
|
||||
|
||||
const Workspace = model<IWorkspace>("Workspace", workspaceSchema);
|
||||
|
||||
export default Workspace;
|
||||
export const Workspace = model<IWorkspace>("Workspace", workspaceSchema);
|
||||
@@ -1,6 +1,5 @@
|
||||
import Queue, { Job } from "bull";
|
||||
import Integration from "../../models/integration";
|
||||
import IntegrationAuth from "../../models/integrationAuth";
|
||||
import { Integration, IntegrationAuth } from "../../models";
|
||||
import { BotService } from "../../services";
|
||||
import { getIntegrationAuthAccessHelper } from "../../helpers";
|
||||
import { syncSecrets } from "../../integrations/sync"
|
||||
@@ -36,6 +35,14 @@ syncSecretsToThirdPartyServices.process(async (job: Job) => {
|
||||
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);
|
||||
|
||||
if (!integrationAuth) throw new Error("Failed to find integration auth");
|
||||
@@ -49,7 +56,7 @@ syncSecretsToThirdPartyServices.process(async (job: Job) => {
|
||||
await syncSecrets({
|
||||
integration,
|
||||
integrationAuth,
|
||||
secrets,
|
||||
secrets: Object.keys(suffixedSecrets).length !== 0 ? suffixedSecrets : secrets,
|
||||
accessId: access.accessId === undefined ? null : access.accessId,
|
||||
accessToken: access.accessToken
|
||||
});
|
||||
|
||||
@@ -37,6 +37,8 @@ router.post(
|
||||
body("owner").trim(),
|
||||
body("path").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,
|
||||
integrationController.createIntegration
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { nanoid } from "nanoid";
|
||||
import { Types } from "mongoose";
|
||||
import Folder, { TFolderSchema } from "../models/folder";
|
||||
import { Folder, TFolderSchema } from "../models";
|
||||
import path from "path";
|
||||
|
||||
type TAppendFolderDTO = {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { Types } from "mongoose";
|
||||
import Folder from "../models/folder";
|
||||
import Secret, { ISecret } from "../models/secret";
|
||||
import SecretImport from "../models/secretImports";
|
||||
import {
|
||||
Folder,
|
||||
ISecret,
|
||||
Secret,
|
||||
SecretImport
|
||||
} from "../models";
|
||||
import { getFolderByPath } from "./FolderService";
|
||||
|
||||
type TSecretImportFid = { environment: string; folderId: string; secretPath: string };
|
||||
|
||||
@@ -3,7 +3,7 @@ import crypto from "crypto";
|
||||
import { Types } from "mongoose";
|
||||
import picomatch from "picomatch";
|
||||
import { client, getRootEncryptionKey } from "../config";
|
||||
import Webhook, { IWebhook } from "../models/webhooks";
|
||||
import { IWebhook, Webhook } from "../models";
|
||||
|
||||
export const triggerWebhookRequest = async (
|
||||
{ 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,
|
||||
path,
|
||||
region,
|
||||
secretPath
|
||||
secretPath,
|
||||
metadata
|
||||
}: {
|
||||
integrationAuthId: string;
|
||||
isActive: boolean;
|
||||
@@ -55,6 +56,9 @@ export const useCreateIntegration = () => {
|
||||
owner: string | null;
|
||||
path: string | null;
|
||||
region: string | null;
|
||||
metadata?: {
|
||||
secretSuffix?: string;
|
||||
}
|
||||
}) => {
|
||||
const { data: { integration } } = await apiRequest.post("/api/v1/integration", {
|
||||
integrationAuthId,
|
||||
@@ -69,7 +73,8 @@ export const useCreateIntegration = () => {
|
||||
owner,
|
||||
path,
|
||||
region,
|
||||
secretPath
|
||||
secretPath,
|
||||
metadata
|
||||
});
|
||||
|
||||
return integration;
|
||||
|
||||
@@ -30,4 +30,7 @@ export type TIntegration = {
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
__v: number;
|
||||
metadata?: {
|
||||
secretSuffix?: string;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -35,6 +35,7 @@ export default function ChecklyCreateIntegrationPage() {
|
||||
|
||||
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
||||
const [secretPath, setSecretPath] = useState("/");
|
||||
const [secretSuffix, setSecretSuffix] = useState("");
|
||||
|
||||
const [targetApp, setTargetApp] = useState("");
|
||||
const [targetAppId, setTargetAppId] = useState("");
|
||||
@@ -78,7 +79,10 @@ export default function ChecklyCreateIntegrationPage() {
|
||||
owner: null,
|
||||
path: null,
|
||||
region: null,
|
||||
secretPath
|
||||
secretPath,
|
||||
metadata: {
|
||||
secretSuffix
|
||||
}
|
||||
});
|
||||
|
||||
setIsLoading(false);
|
||||
@@ -148,6 +152,13 @@ export default function ChecklyCreateIntegrationPage() {
|
||||
)}
|
||||
</Select>
|
||||
</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
|
||||
onClick={handleButtonClick}
|
||||
color="mineshaft"
|
||||
|
||||
@@ -115,6 +115,14 @@ export const IntegrationsSection = ({
|
||||
</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 className="flex cursor-default items-center">
|
||||
<div className="ml-2 opacity-80 duration-200 hover:opacity-100">
|
||||
|
||||
Reference in New Issue
Block a user