mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 13:22:08 +00:00
Fix merge conflicts
This commit is contained in:
+181
-62
@@ -306,12 +306,77 @@
|
||||
},
|
||||
"/api/v1/workspace/{workspaceId}/audit-logs": {
|
||||
"get": {
|
||||
"description": "",
|
||||
"summary": "Return audit logs",
|
||||
"description": "Return audit logs",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "workspaceId",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "ID of the workspace where to get folders from"
|
||||
},
|
||||
{
|
||||
"name": "offset",
|
||||
"description": "Number of logs to skip before starting to return logs for pagination",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"description": "Maximum number of logs to return for pagination",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "startDate",
|
||||
"description": "Filter logs from this date in ISO-8601 format",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "endDate",
|
||||
"description": "Filter logs till this date in ISO-8601 format",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "eventType",
|
||||
"description": "Filter by type of event such as get-secrets, get-secret, create-secret, update-secret, delete-secret, etc.",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "userAgentType",
|
||||
"description": "Filter by type of user agent such as web, cli, k8-operator, or other",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "actor",
|
||||
"description": "Filter by actor such as user or service",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
@@ -319,9 +384,30 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"auditLogs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/AuditLog"
|
||||
},
|
||||
"description": "List of audit log"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"apiKeyAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/workspace/{workspaceId}/audit-logs/filters/actors": {
|
||||
@@ -1132,6 +1218,43 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/admin/config": {
|
||||
"get": {
|
||||
"description": "",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"description": "",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/admin/signup": {
|
||||
"post": {
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "user-agent",
|
||||
"in": "header",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/bot/{workspaceId}": {
|
||||
"get": {
|
||||
"description": "",
|
||||
@@ -4560,65 +4683,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"get": {
|
||||
"summary": "Get all accessible environments of a workspace",
|
||||
"description": "Fetch all environments that the user has access to in a specified workspace",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "workspaceId",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "ID of the workspace"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accessibleEnvironments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "Development"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string",
|
||||
"example": "development"
|
||||
},
|
||||
"isWriteDenied": {
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"isReadDenied": {
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "List of environments the user has access to in the specified workspace"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"apiKeyAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v2/workspace/{workspaceId}/tags": {
|
||||
@@ -6864,6 +6928,61 @@
|
||||
"example": "2023-01-13T14:16:12.210Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AuditLog": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"actor": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"example": ""
|
||||
},
|
||||
"metadata": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"organization": {
|
||||
"type": "string",
|
||||
"example": ""
|
||||
},
|
||||
"workspace": {
|
||||
"type": "string",
|
||||
"example": ""
|
||||
},
|
||||
"ipAddress": {
|
||||
"type": "string",
|
||||
"example": ""
|
||||
},
|
||||
"event": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"example": ""
|
||||
},
|
||||
"metadata": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"userAgent": {
|
||||
"type": "string",
|
||||
"example": ""
|
||||
},
|
||||
"userAgentType": {
|
||||
"type": "string",
|
||||
"example": ""
|
||||
},
|
||||
"expiresAt": {
|
||||
"type": "string",
|
||||
"example": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securitySchemes": {
|
||||
|
||||
@@ -578,6 +578,82 @@ export const rollbackWorkspaceSecretSnapshot = async (req: Request, res: Respons
|
||||
* @param res
|
||||
*/
|
||||
export const getWorkspaceAuditLogs = async (req: Request, res: Response) => {
|
||||
/*
|
||||
#swagger.summary = 'Return audit logs'
|
||||
#swagger.description = 'Return audit logs'
|
||||
|
||||
#swagger.security = [{
|
||||
"apiKeyAuth": []
|
||||
}]
|
||||
|
||||
#swagger.parameters['workspaceId'] = {
|
||||
"description": "ID of the workspace where to get folders from",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"in": "path"
|
||||
}
|
||||
|
||||
#swagger.parameters['offset'] = {
|
||||
"description": "Number of logs to skip before starting to return logs for pagination",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
#swagger.parameters['limit'] = {
|
||||
"description": "Maximum number of logs to return for pagination",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
#swagger.parameters['startDate'] = {
|
||||
"description": "Filter logs from this date in ISO-8601 format",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
#swagger.parameters['endDate'] = {
|
||||
"description": "Filter logs till this date in ISO-8601 format",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
#swagger.parameters['eventType'] = {
|
||||
"description": "Filter by type of event such as get-secrets, get-secret, create-secret, update-secret, delete-secret, etc.",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
}
|
||||
|
||||
#swagger.parameters['userAgentType'] = {
|
||||
"description": "Filter by type of user agent such as web, cli, k8-operator, or other",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
}
|
||||
|
||||
#swagger.parameters['actor'] = {
|
||||
"description": "Filter by actor such as user or service",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
#swagger.responses[200] = {
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"auditLogs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
$ref: "#/components/schemas/AuditLog",
|
||||
},
|
||||
"description": "List of audit log"
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
const {
|
||||
query: { limit, offset, endDate, eventType, startDate, userAgentType, actor },
|
||||
params: { workspaceId }
|
||||
@@ -592,7 +668,7 @@ export const getWorkspaceAuditLogs = async (req: Request, res: Response) => {
|
||||
ProjectPermissionActions.Read,
|
||||
ProjectPermissionSub.AuditLogs
|
||||
);
|
||||
|
||||
|
||||
const query = {
|
||||
workspace: new Types.ObjectId(workspaceId),
|
||||
...(eventType
|
||||
@@ -626,14 +702,9 @@ export const getWorkspaceAuditLogs = async (req: Request, res: Response) => {
|
||||
}
|
||||
: {})
|
||||
};
|
||||
|
||||
const auditLogs = await AuditLog.find(query).sort({ createdAt: -1 }).skip(offset).limit(limit);
|
||||
|
||||
const totalCount = await AuditLog.countDocuments(query);
|
||||
|
||||
return res.status(200).send({
|
||||
auditLogs,
|
||||
totalCount
|
||||
auditLogs
|
||||
});
|
||||
};
|
||||
|
||||
@@ -685,7 +756,7 @@ export const getWorkspaceAuditLogActorFilterOpts = async (req: Request, res: Res
|
||||
name: serviceTokenData.name
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
const serviceV3Actors: ServiceActorV3[] = (
|
||||
await ServiceTokenDataV3.find({
|
||||
workspace: new Types.ObjectId(workspaceId)
|
||||
@@ -697,12 +768,8 @@ export const getWorkspaceAuditLogActorFilterOpts = async (req: Request, res: Res
|
||||
name: serviceTokenData.name
|
||||
}
|
||||
}));
|
||||
|
||||
const actors = [
|
||||
...userActors,
|
||||
...serviceActors,
|
||||
...serviceV3Actors
|
||||
];
|
||||
|
||||
const actors = [...userActors, ...serviceActors, ...serviceV3Actors];
|
||||
|
||||
return res.status(200).send({
|
||||
actors
|
||||
|
||||
@@ -1,76 +1,70 @@
|
||||
import { Schema, Types, model } from "mongoose";
|
||||
import {
|
||||
ActorType,
|
||||
EventType,
|
||||
UserAgentType
|
||||
} from "./enums";
|
||||
import {
|
||||
Actor,
|
||||
Event
|
||||
} from "./types";
|
||||
import { ActorType, EventType, UserAgentType } from "./enums";
|
||||
import { Actor, Event } from "./types";
|
||||
|
||||
export interface IAuditLog {
|
||||
actor: Actor;
|
||||
organization: Types.ObjectId;
|
||||
workspace: Types.ObjectId;
|
||||
ipAddress: string;
|
||||
event: Event;
|
||||
userAgent: string;
|
||||
userAgentType: UserAgentType;
|
||||
expiresAt: Date;
|
||||
actor: Actor;
|
||||
organization: Types.ObjectId;
|
||||
workspace: Types.ObjectId;
|
||||
ipAddress: string;
|
||||
event: Event;
|
||||
userAgent: string;
|
||||
userAgentType: UserAgentType;
|
||||
expiresAt: Date;
|
||||
}
|
||||
|
||||
const auditLogSchema = new Schema<IAuditLog>(
|
||||
{
|
||||
actor: {
|
||||
type: {
|
||||
type: String,
|
||||
enum: ActorType,
|
||||
required: true
|
||||
},
|
||||
metadata: {
|
||||
type: Schema.Types.Mixed
|
||||
}
|
||||
},
|
||||
organization: {
|
||||
type: Schema.Types.ObjectId,
|
||||
required: false
|
||||
},
|
||||
workspace: {
|
||||
type: Schema.Types.ObjectId,
|
||||
required: false
|
||||
},
|
||||
ipAddress: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
event: {
|
||||
type: {
|
||||
type: String,
|
||||
enum: EventType,
|
||||
required: true
|
||||
},
|
||||
metadata: {
|
||||
type: Schema.Types.Mixed
|
||||
}
|
||||
},
|
||||
userAgent: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
userAgentType: {
|
||||
type: String,
|
||||
enum: UserAgentType,
|
||||
required: true
|
||||
},
|
||||
expiresAt: {
|
||||
type: Date,
|
||||
expires: 0
|
||||
}
|
||||
{
|
||||
actor: {
|
||||
type: {
|
||||
type: String,
|
||||
enum: ActorType,
|
||||
required: true
|
||||
},
|
||||
metadata: {
|
||||
type: Schema.Types.Mixed
|
||||
}
|
||||
},
|
||||
{
|
||||
timestamps: true
|
||||
organization: {
|
||||
type: Schema.Types.ObjectId,
|
||||
required: false
|
||||
},
|
||||
workspace: {
|
||||
type: Schema.Types.ObjectId,
|
||||
required: false,
|
||||
index: true
|
||||
},
|
||||
ipAddress: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
event: {
|
||||
type: {
|
||||
type: String,
|
||||
enum: EventType,
|
||||
required: true
|
||||
},
|
||||
metadata: {
|
||||
type: Schema.Types.Mixed
|
||||
}
|
||||
},
|
||||
userAgent: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
userAgentType: {
|
||||
type: String,
|
||||
enum: UserAgentType,
|
||||
required: true
|
||||
},
|
||||
expiresAt: {
|
||||
type: Date,
|
||||
expires: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
timestamps: true
|
||||
}
|
||||
);
|
||||
|
||||
export const AuditLog = model<IAuditLog>("AuditLog", auditLogSchema);
|
||||
export const AuditLog = model<IAuditLog>("AuditLog", auditLogSchema);
|
||||
|
||||
@@ -10,6 +10,8 @@ import {
|
||||
INTEGRATION_CIRCLECI_API_URL,
|
||||
INTEGRATION_CLOUDFLARE_PAGES,
|
||||
INTEGRATION_CLOUDFLARE_PAGES_API_URL,
|
||||
INTEGRATION_CLOUDFLARE_WORKERS,
|
||||
INTEGRATION_CLOUDFLARE_WORKERS_API_URL,
|
||||
INTEGRATION_CLOUD_66,
|
||||
INTEGRATION_CLOUD_66_API_URL,
|
||||
INTEGRATION_CODEFRESH,
|
||||
@@ -186,6 +188,12 @@ const getApps = async ({
|
||||
accountId: accessId
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_CLOUDFLARE_WORKERS:
|
||||
apps = await getAppsCloudflareWorkers({
|
||||
accessToken,
|
||||
accountId: accessId
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_NORTHFLANK:
|
||||
apps = await getAppsNorthflank({
|
||||
accessToken
|
||||
@@ -968,6 +976,40 @@ const getAppsCloudflarePages = async ({
|
||||
return apps;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return list of projects for the Cloudflare Workers integration
|
||||
* @param {Object} obj
|
||||
* @param {String} obj.accessToken - api key for the Cloudflare API
|
||||
* @returns {Object[]} apps - Cloudflare Workers projects
|
||||
* @returns {String} apps.id - Id of Cloudflare Workers project
|
||||
* @returns {String} apps.name - Id of Cloudflare Workers project (Cloudflare workers API does not return the name)
|
||||
*/
|
||||
const getAppsCloudflareWorkers = async ({
|
||||
accessToken,
|
||||
accountId
|
||||
}: {
|
||||
accessToken: string;
|
||||
accountId?: string;
|
||||
}) => {
|
||||
const { data } = await standardRequest.get(
|
||||
`${INTEGRATION_CLOUDFLARE_WORKERS_API_URL}/client/v4/accounts/${accountId}/workers/services`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
Accept: "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const apps = data.result.map((a: any) => {
|
||||
return {
|
||||
name: a.id,
|
||||
appId: a.id
|
||||
};
|
||||
});
|
||||
return apps;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return list of repositories for the BitBucket integration based on provided BitBucket workspace
|
||||
* @param {Object} obj
|
||||
|
||||
@@ -18,6 +18,8 @@ import {
|
||||
INTEGRATION_CIRCLECI_API_URL,
|
||||
INTEGRATION_CLOUDFLARE_PAGES,
|
||||
INTEGRATION_CLOUDFLARE_PAGES_API_URL,
|
||||
INTEGRATION_CLOUDFLARE_WORKERS,
|
||||
INTEGRATION_CLOUDFLARE_WORKERS_API_URL,
|
||||
INTEGRATION_CLOUD_66,
|
||||
INTEGRATION_CLOUD_66_API_URL,
|
||||
INTEGRATION_CODEFRESH,
|
||||
@@ -262,6 +264,14 @@ const syncSecrets = async ({
|
||||
accessToken
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_CLOUDFLARE_WORKERS:
|
||||
await syncSecretsCloudflareWorkers({
|
||||
integration,
|
||||
secrets,
|
||||
accessId,
|
||||
accessToken
|
||||
});
|
||||
break;
|
||||
case INTEGRATION_CODEFRESH:
|
||||
await syncSecretsCodefresh({
|
||||
integration,
|
||||
@@ -2746,6 +2756,98 @@ const syncSecretsCloudflarePages = async ({
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sync/push [secrets] to Cloudflare Workers project with name [integration.app]
|
||||
* @param {Object} obj
|
||||
* @param {IIntegration} obj.integration - integration details
|
||||
* @param {Object} obj.secrets - secrets to push to integration (object where keys are secret keys and values are secret values)
|
||||
* @param {String} obj.accessToken - API token for Cloudflare workers
|
||||
*/
|
||||
const syncSecretsCloudflareWorkers = async ({
|
||||
integration,
|
||||
secrets,
|
||||
accessId,
|
||||
accessToken
|
||||
}: {
|
||||
integration: IIntegration;
|
||||
secrets: Record<string, { value: string; comment?: string }>;
|
||||
accessId: string | null;
|
||||
accessToken: string;
|
||||
}) => {
|
||||
// get secrets from cloudflare workers
|
||||
const getSecretsRes = (
|
||||
await standardRequest.get(
|
||||
`${INTEGRATION_CLOUDFLARE_WORKERS_API_URL}/client/v4/accounts/${accessId}/workers/scripts/${integration.app}/secrets`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
Accept: "application/json"
|
||||
}
|
||||
}
|
||||
)
|
||||
).data.result;
|
||||
|
||||
const secretsObj: any = getSecretKeyValuePair(secrets);
|
||||
|
||||
for (const [key, val] of Object.entries(secretsObj)) {
|
||||
secretsObj[key] = { type: "secret_text", value: val };
|
||||
}
|
||||
|
||||
// get deleted secrets list
|
||||
const deletedSecretKeys: string[] = [];
|
||||
if (getSecretsRes) {
|
||||
getSecretsRes.forEach((secretRes: any) => {
|
||||
if (!(Object.keys(secrets).includes(secretRes.name))) {
|
||||
deletedSecretKeys.push(secretRes.name);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
deletedSecretKeys.forEach(async (secretKey) => {
|
||||
await standardRequest.delete(
|
||||
`${INTEGRATION_CLOUDFLARE_WORKERS_API_URL}/client/v4/accounts/${accessId}/workers/scripts/${integration.app}/secrets/${secretKey}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
Accept: "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
interface ConvertedSecret {
|
||||
name: string;
|
||||
text: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface SecretsObj {
|
||||
[key: string]: {
|
||||
type: string;
|
||||
value: string;
|
||||
};
|
||||
}
|
||||
|
||||
const data: ConvertedSecret[] = Object.entries(secretsObj as SecretsObj).map(([name, secret]) => ({
|
||||
name,
|
||||
text: secret.value,
|
||||
type: "secret_text"
|
||||
}));
|
||||
|
||||
data.forEach(async (secret) => {
|
||||
await standardRequest.put(
|
||||
`${INTEGRATION_CLOUDFLARE_WORKERS_API_URL}/client/v4/accounts/${accessId}/workers/scripts/${integration.app}/secrets`,
|
||||
secret,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
Accept: "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
})
|
||||
};
|
||||
|
||||
/**
|
||||
* Sync/push [secrets] to BitBucket repo with name [integration.app]
|
||||
* @param {Object} obj
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
INTEGRATION_CHECKLY,
|
||||
INTEGRATION_CIRCLECI,
|
||||
INTEGRATION_CLOUDFLARE_PAGES,
|
||||
INTEGRATION_CLOUDFLARE_WORKERS,
|
||||
INTEGRATION_CLOUD_66,
|
||||
INTEGRATION_CODEFRESH,
|
||||
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
||||
@@ -71,6 +72,7 @@ export interface IIntegration {
|
||||
| "teamcity"
|
||||
| "hashicorp-vault"
|
||||
| "cloudflare-pages"
|
||||
| "cloudflare-workers"
|
||||
| "bitbucket"
|
||||
| "codefresh"
|
||||
| "digital-ocean-app-platform"
|
||||
@@ -179,6 +181,7 @@ const integrationSchema = new Schema<IIntegration>(
|
||||
INTEGRATION_TEAMCITY,
|
||||
INTEGRATION_HASHICORP_VAULT,
|
||||
INTEGRATION_CLOUDFLARE_PAGES,
|
||||
INTEGRATION_CLOUDFLARE_WORKERS,
|
||||
INTEGRATION_CODEFRESH,
|
||||
INTEGRATION_WINDMILL,
|
||||
INTEGRATION_BITBUCKET,
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
INTEGRATION_BITBUCKET,
|
||||
INTEGRATION_CIRCLECI,
|
||||
INTEGRATION_CLOUDFLARE_PAGES,
|
||||
INTEGRATION_CLOUDFLARE_WORKERS,
|
||||
INTEGRATION_CLOUD_66,
|
||||
INTEGRATION_CODEFRESH,
|
||||
INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
|
||||
@@ -55,6 +56,7 @@ export interface IIntegrationAuth extends Document {
|
||||
| "checkly"
|
||||
| "qovery"
|
||||
| "cloudflare-pages"
|
||||
| "cloudflare-workers"
|
||||
| "codefresh"
|
||||
| "digital-ocean-app-platform"
|
||||
| "bitbucket"
|
||||
@@ -113,6 +115,7 @@ const integrationAuthSchema = new Schema<IIntegrationAuth>(
|
||||
INTEGRATION_TERRAFORM_CLOUD,
|
||||
INTEGRATION_HASHICORP_VAULT,
|
||||
INTEGRATION_CLOUDFLARE_PAGES,
|
||||
INTEGRATION_CLOUDFLARE_WORKERS,
|
||||
INTEGRATION_CODEFRESH,
|
||||
INTEGRATION_WINDMILL,
|
||||
INTEGRATION_BITBUCKET,
|
||||
|
||||
@@ -59,7 +59,7 @@ export const validateClientForWorkspace = async ({
|
||||
environment,
|
||||
requiredPermissions
|
||||
});
|
||||
return { membership, workspace};
|
||||
return { membership, workspace };
|
||||
case ActorType.SERVICE_V3:
|
||||
throw UnauthorizedRequestError({
|
||||
message: "Failed service token authorization for organization"
|
||||
@@ -122,8 +122,8 @@ export const GetWorkspaceAuditLogsV1 = z.object({
|
||||
userAgentType: z.nativeEnum(UserAgentType).nullable().optional(),
|
||||
startDate: z.string().datetime().nullable().optional(),
|
||||
endDate: z.string().datetime().nullable().optional(),
|
||||
offset: z.coerce.number(),
|
||||
limit: z.coerce.number(),
|
||||
offset: z.coerce.number().default(0),
|
||||
limit: z.coerce.number().default(20),
|
||||
actor: z.string().nullish().optional()
|
||||
})
|
||||
});
|
||||
@@ -327,4 +327,4 @@ export const NameWorkspaceSecretsV3 = z.object({
|
||||
})
|
||||
.array()
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
@@ -32,6 +32,7 @@ export const INTEGRATION_QOVERY = "qovery";
|
||||
export const INTEGRATION_TERRAFORM_CLOUD = "terraform-cloud";
|
||||
export const INTEGRATION_HASHICORP_VAULT = "hashicorp-vault";
|
||||
export const INTEGRATION_CLOUDFLARE_PAGES = "cloudflare-pages";
|
||||
export const INTEGRATION_CLOUDFLARE_WORKERS = "cloudflare-workers";
|
||||
export const INTEGRATION_BITBUCKET = "bitbucket";
|
||||
export const INTEGRATION_CODEFRESH = "codefresh";
|
||||
export const INTEGRATION_WINDMILL = "windmill";
|
||||
@@ -59,6 +60,7 @@ export const INTEGRATION_SET = new Set([
|
||||
INTEGRATION_TERRAFORM_CLOUD,
|
||||
INTEGRATION_HASHICORP_VAULT,
|
||||
INTEGRATION_CLOUDFLARE_PAGES,
|
||||
INTEGRATION_CLOUDFLARE_WORKERS,
|
||||
INTEGRATION_CODEFRESH,
|
||||
INTEGRATION_WINDMILL,
|
||||
INTEGRATION_BITBUCKET,
|
||||
@@ -101,6 +103,7 @@ export const INTEGRATION_CHECKLY_API_URL = "https://api.checklyhq.com";
|
||||
export const INTEGRATION_QOVERY_API_URL = "https://api.qovery.com";
|
||||
export const INTEGRATION_TERRAFORM_CLOUD_API_URL = "https://app.terraform.io";
|
||||
export const INTEGRATION_CLOUDFLARE_PAGES_API_URL = "https://api.cloudflare.com";
|
||||
export const INTEGRATION_CLOUDFLARE_WORKERS_API_URL = "https://api.cloudflare.com";
|
||||
export const INTEGRATION_BITBUCKET_API_URL = "https://api.bitbucket.org";
|
||||
export const INTEGRATION_CODEFRESH_API_URL = "https://g.codefresh.io/api";
|
||||
export const INTEGRATION_WINDMILL_API_URL = "https://app.windmill.dev/api";
|
||||
@@ -316,6 +319,15 @@ export const getIntegrationOptions = async () => {
|
||||
clientId: "",
|
||||
docsLink: ""
|
||||
},
|
||||
{
|
||||
name: "Cloudflare Workers",
|
||||
slug: "cloudflare-workers",
|
||||
image: "Cloudflare.png",
|
||||
isAvailable: true,
|
||||
type: "pat",
|
||||
clientId: "",
|
||||
docsLink: ""
|
||||
},
|
||||
{
|
||||
name: "BitBucket",
|
||||
slug: "bitbucket",
|
||||
|
||||
+57
-41
@@ -12,32 +12,32 @@ const generateOpenAPISpec = async () => {
|
||||
const doc = {
|
||||
info: {
|
||||
title: "Infisical API",
|
||||
description: "List of all available APIs that can be consumed",
|
||||
description: "List of all available APIs that can be consumed"
|
||||
},
|
||||
host: ["https://infisical.com"],
|
||||
servers: [
|
||||
{
|
||||
url: "https://app.infisical.com",
|
||||
description: "Production server",
|
||||
description: "Production server"
|
||||
},
|
||||
{
|
||||
url: "http://localhost:8080",
|
||||
description: "Local server",
|
||||
},
|
||||
description: "Local server"
|
||||
}
|
||||
],
|
||||
securityDefinitions: {
|
||||
bearerAuth: {
|
||||
type: "http",
|
||||
scheme: "bearer",
|
||||
bearerFormat: "JWT",
|
||||
description: "A service token in Infisical",
|
||||
description: "A service token in Infisical"
|
||||
},
|
||||
apiKeyAuth: {
|
||||
type: "apiKey",
|
||||
in: "header",
|
||||
name: "X-API-Key",
|
||||
description: "An API Key in Infisical",
|
||||
},
|
||||
description: "An API Key in Infisical"
|
||||
}
|
||||
},
|
||||
definitions: {
|
||||
CurrentUser: {
|
||||
@@ -50,7 +50,7 @@ const generateOpenAPISpec = async () => {
|
||||
iv: "iv_of_enc_nacl_private_key",
|
||||
tag: "tag_of_enc_nacl_private_key",
|
||||
updatedAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z"
|
||||
},
|
||||
Membership: {
|
||||
user: {
|
||||
@@ -60,10 +60,10 @@ const generateOpenAPISpec = async () => {
|
||||
lastName: "Doe",
|
||||
publicKey: "johns_nacl_public_key",
|
||||
updatedAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z"
|
||||
},
|
||||
workspace: "",
|
||||
role: "admin",
|
||||
role: "admin"
|
||||
},
|
||||
MembershipOrg: {
|
||||
user: {
|
||||
@@ -73,33 +73,35 @@ const generateOpenAPISpec = async () => {
|
||||
lastName: "Doe",
|
||||
publicKey: "johns_nacl_public_key",
|
||||
updatedAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z"
|
||||
},
|
||||
organization: "",
|
||||
role: "owner",
|
||||
status: "accepted",
|
||||
status: "accepted"
|
||||
},
|
||||
Organization: {
|
||||
_id: "",
|
||||
name: "Acme Corp.",
|
||||
customerId: "",
|
||||
customerId: ""
|
||||
},
|
||||
Project: {
|
||||
name: "My Project",
|
||||
organization: "",
|
||||
environments: [{
|
||||
name: "development",
|
||||
slug: "dev",
|
||||
}],
|
||||
environments: [
|
||||
{
|
||||
name: "development",
|
||||
slug: "dev"
|
||||
}
|
||||
]
|
||||
},
|
||||
ProjectKey: {
|
||||
encryptedkey: "",
|
||||
nonce: "",
|
||||
sender: {
|
||||
publicKey: "senders_nacl_public_key",
|
||||
publicKey: "senders_nacl_public_key"
|
||||
},
|
||||
receiver: "",
|
||||
workspace: "",
|
||||
workspace: ""
|
||||
},
|
||||
CreateSecret: {
|
||||
type: "shared",
|
||||
@@ -111,7 +113,7 @@ const generateOpenAPISpec = async () => {
|
||||
secretValueTag: "",
|
||||
secretCommentCiphertext: "",
|
||||
secretCommentIV: "",
|
||||
secretCommentTag: "",
|
||||
secretCommentTag: ""
|
||||
},
|
||||
UpdateSecret: {
|
||||
id: "",
|
||||
@@ -123,12 +125,12 @@ const generateOpenAPISpec = async () => {
|
||||
secretValueTag: "",
|
||||
secretCommentCiphertext: "",
|
||||
secretCommentIV: "",
|
||||
secretCommentTag: "",
|
||||
secretCommentTag: ""
|
||||
},
|
||||
Secret: {
|
||||
_id: "",
|
||||
version: 1,
|
||||
workspace : "",
|
||||
workspace: "",
|
||||
type: "shared",
|
||||
user: null,
|
||||
secretKeyCiphertext: "",
|
||||
@@ -141,7 +143,7 @@ const generateOpenAPISpec = async () => {
|
||||
secretCommentIV: "",
|
||||
secretCommentTag: "",
|
||||
updatedAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z"
|
||||
},
|
||||
RawSecret: {
|
||||
_id: "abc123",
|
||||
@@ -167,12 +169,10 @@ const generateOpenAPISpec = async () => {
|
||||
_id: "",
|
||||
email: "[email protected]",
|
||||
firstName: "John",
|
||||
lastName: "Doe",
|
||||
lastName: "Doe"
|
||||
},
|
||||
workspace: "",
|
||||
actionNames: [
|
||||
"addSecrets",
|
||||
],
|
||||
actionNames: ["addSecrets"],
|
||||
actions: [
|
||||
{
|
||||
name: "addSecrets",
|
||||
@@ -181,24 +181,24 @@ const generateOpenAPISpec = async () => {
|
||||
payload: [
|
||||
{
|
||||
oldSecretVersion: "",
|
||||
newSecretVersion: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
newSecretVersion: ""
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
channel: "cli",
|
||||
ipAddress: "192.168.0.1",
|
||||
updatedAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z"
|
||||
},
|
||||
SecretSnapshot: {
|
||||
workspace: "",
|
||||
version: 1,
|
||||
secretVersions: [
|
||||
{
|
||||
_id: "",
|
||||
},
|
||||
],
|
||||
_id: ""
|
||||
}
|
||||
]
|
||||
},
|
||||
SecretVersion: {
|
||||
_id: "",
|
||||
@@ -214,7 +214,7 @@ const generateOpenAPISpec = async () => {
|
||||
secretKeyTag: "",
|
||||
secretValueCiphertext: "",
|
||||
secretValueIV: "",
|
||||
secretValueTag: "",
|
||||
secretValueTag: ""
|
||||
},
|
||||
ServiceTokenData: {
|
||||
_id: "",
|
||||
@@ -224,16 +224,32 @@ const generateOpenAPISpec = async () => {
|
||||
user: {
|
||||
_id: "",
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
lastName: ""
|
||||
},
|
||||
expiresAt: "2023-01-13T14:16:12.210Z",
|
||||
encryptedKey: "",
|
||||
iv: "",
|
||||
tag: "",
|
||||
updatedAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z",
|
||||
createdAt: "2023-01-13T14:16:12.210Z"
|
||||
},
|
||||
},
|
||||
AuditLog: {
|
||||
actor: {
|
||||
type: "",
|
||||
metadata: {}
|
||||
},
|
||||
organization: "",
|
||||
workspace: "",
|
||||
ipAddress: "",
|
||||
event: {
|
||||
type: "",
|
||||
metadata: {}
|
||||
},
|
||||
userAgent: "",
|
||||
userAgentType: "",
|
||||
expiresAt: ""
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const outputJSONFile = "../spec.json";
|
||||
@@ -243,6 +259,6 @@ const generateOpenAPISpec = async () => {
|
||||
const spec = await swaggerAutogen(outputJSONFile, endpointsFiles, doc);
|
||||
|
||||
await fs.writeFile(outputYAMLFile, yaml.dump(spec.data));
|
||||
}
|
||||
};
|
||||
|
||||
generateOpenAPISpec();
|
||||
generateOpenAPISpec();
|
||||
|
||||
Reference in New Issue
Block a user