mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 20:28:54 +00:00
Modify secret snapshots to point to secret versions
This commit is contained in:
@@ -14,6 +14,7 @@ import { apiLimiter } from './helpers/rateLimiter';
|
|||||||
import {
|
import {
|
||||||
workspace as eeWorkspaceRouter,
|
workspace as eeWorkspaceRouter,
|
||||||
secret as eeSecretRouter,
|
secret as eeSecretRouter,
|
||||||
|
secretSnapshot as eeSecretSnapshotRouter,
|
||||||
action as eeActionRouter
|
action as eeActionRouter
|
||||||
} from './ee/routes/v1';
|
} from './ee/routes/v1';
|
||||||
import {
|
import {
|
||||||
@@ -69,6 +70,7 @@ if (NODE_ENV === 'production') {
|
|||||||
|
|
||||||
// (EE) routes
|
// (EE) routes
|
||||||
app.use('/api/v1/secret', eeSecretRouter);
|
app.use('/api/v1/secret', eeSecretRouter);
|
||||||
|
app.use('/api/v1/secret-snapshot', eeSecretSnapshotRouter);
|
||||||
app.use('/api/v1/workspace', eeWorkspaceRouter);
|
app.use('/api/v1/workspace', eeWorkspaceRouter);
|
||||||
app.use('/api/v1/action', eeActionRouter);
|
app.use('/api/v1/action', eeActionRouter);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import * as stripeController from './stripeController';
|
import * as stripeController from './stripeController';
|
||||||
import * as secretController from './secretController';
|
import * as secretController from './secretController';
|
||||||
|
import * as secretSnapshotController from './secretSnapshotController';
|
||||||
import * as workspaceController from './workspaceController';
|
import * as workspaceController from './workspaceController';
|
||||||
import * as actionController from './actionController';
|
import * as actionController from './actionController';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
stripeController,
|
stripeController,
|
||||||
secretController,
|
secretController,
|
||||||
|
secretSnapshotController,
|
||||||
workspaceController,
|
workspaceController,
|
||||||
actionController
|
actionController
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { Request, Response } from 'express';
|
||||||
|
import * as Sentry from '@sentry/node';
|
||||||
|
import { SecretSnapshot } from '../../models';
|
||||||
|
|
||||||
|
export const getSecretSnapshot = async (req: Request, res: Response) => {
|
||||||
|
let secretSnapshot;
|
||||||
|
try {
|
||||||
|
const { secretSnapshotId } = req.params;
|
||||||
|
|
||||||
|
secretSnapshot = await SecretSnapshot
|
||||||
|
.findById(secretSnapshotId)
|
||||||
|
.populate('secretVersions');
|
||||||
|
|
||||||
|
if (!secretSnapshot) throw new Error('Failed to find secret snapshot');
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
Sentry.setUser({ email: req.user.email });
|
||||||
|
Sentry.captureException(err);
|
||||||
|
return res.status(400).send({
|
||||||
|
message: 'Failed to get secret snapshot'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.status(200).send({
|
||||||
|
secretSnapshot
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -23,34 +23,44 @@ import {
|
|||||||
}: {
|
}: {
|
||||||
workspaceId: string;
|
workspaceId: string;
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
let secretSnapshot;
|
let secretSnapshot;
|
||||||
try {
|
try {
|
||||||
const secrets = await Secret.find({
|
const secretIds = (await Secret.find({
|
||||||
workspace: workspaceId
|
workspace: workspaceId
|
||||||
});
|
}, '_id')).map((s) => s._id);
|
||||||
|
|
||||||
|
const latestSecretVersions = (await SecretVersion.aggregate([
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
secret: {
|
||||||
|
$in: secretIds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$group: {
|
||||||
|
_id: '$secret',
|
||||||
|
version: { $max: '$version' },
|
||||||
|
versionId: { $max: '$_id' } // secret version id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$sort: { version: -1 }
|
||||||
|
}
|
||||||
|
])
|
||||||
|
.exec())
|
||||||
|
.map((s) => s.versionId);
|
||||||
|
|
||||||
const latestSecretSnapshot = await SecretSnapshot.findOne({
|
const latestSecretSnapshot = await SecretSnapshot.findOne({
|
||||||
workspace: workspaceId
|
workspace: workspaceId
|
||||||
}).sort({ version: -1 });
|
}).sort({ version: -1 });
|
||||||
|
|
||||||
if (!latestSecretSnapshot) {
|
|
||||||
// case: no snapshots exist for workspace -> create first snapshot
|
|
||||||
await new SecretSnapshot({
|
|
||||||
workspace: workspaceId,
|
|
||||||
version: 1,
|
|
||||||
secrets
|
|
||||||
}).save();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// case: snapshots exist for workspace
|
|
||||||
secretSnapshot = await new SecretSnapshot({
|
secretSnapshot = await new SecretSnapshot({
|
||||||
workspace: workspaceId,
|
workspace: workspaceId,
|
||||||
version: latestSecretSnapshot.version + 1,
|
version: latestSecretSnapshot ? latestSecretSnapshot.version + 1 : 1,
|
||||||
secrets
|
secretVersions: latestSecretVersions
|
||||||
}).save();
|
}).save();
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Sentry.setUser(null);
|
Sentry.setUser(null);
|
||||||
Sentry.captureException(err);
|
Sentry.captureException(err);
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import requireLicenseAuth from './requireLicenseAuth';
|
||||||
|
import requireSecretSnapshotAuth from './requireSecretSnapshotAuth';
|
||||||
|
|
||||||
|
export {
|
||||||
|
requireLicenseAuth,
|
||||||
|
requireSecretSnapshotAuth
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import { Request, Response, NextFunction } from 'express';
|
||||||
|
import { UnauthorizedRequestError, SecretSnapshotNotFoundError } from '../../utils/errors';
|
||||||
|
import { SecretSnapshot } from '../models';
|
||||||
|
import {
|
||||||
|
validateMembership
|
||||||
|
} from '../../helpers/membership';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate if user on request has proper membership for secret snapshot
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {String[]} obj.acceptedRoles - accepted workspace roles
|
||||||
|
* @param {String[]} obj.acceptedStatuses - accepted workspace statuses
|
||||||
|
* @param {String[]} obj.location - location of [workspaceId] on request (e.g. params, body) for parsing
|
||||||
|
*/
|
||||||
|
const requireSecretSnapshotAuth = ({
|
||||||
|
acceptedRoles,
|
||||||
|
acceptedStatuses
|
||||||
|
}: {
|
||||||
|
acceptedRoles: string[];
|
||||||
|
acceptedStatuses: string[];
|
||||||
|
}) => {
|
||||||
|
return async (req: Request, res: Response, next: NextFunction) => {
|
||||||
|
try {
|
||||||
|
const { secretSnapshotId } = req.params;
|
||||||
|
|
||||||
|
const secretSnapshot = await SecretSnapshot.findById(secretSnapshotId);
|
||||||
|
|
||||||
|
if (!secretSnapshot) {
|
||||||
|
return next(SecretSnapshotNotFoundError({
|
||||||
|
message: 'Failed to find secret snapshot'
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
await validateMembership({
|
||||||
|
userId: req.user._id.toString(),
|
||||||
|
workspaceId: secretSnapshot.workspace.toString(),
|
||||||
|
acceptedRoles,
|
||||||
|
acceptedStatuses
|
||||||
|
});
|
||||||
|
|
||||||
|
req.secretSnapshot = secretSnapshot as any;
|
||||||
|
|
||||||
|
next();
|
||||||
|
} catch (err) {
|
||||||
|
return next(UnauthorizedRequestError({ message: 'Unable to authenticate secret snapshot' }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default requireSecretSnapshotAuth;
|
||||||
@@ -1,31 +1,9 @@
|
|||||||
import { Schema, model, Types } from 'mongoose';
|
import { Schema, model, Types } from 'mongoose';
|
||||||
import {
|
|
||||||
SECRET_SHARED,
|
|
||||||
SECRET_PERSONAL,
|
|
||||||
ENV_DEV,
|
|
||||||
ENV_TESTING,
|
|
||||||
ENV_STAGING,
|
|
||||||
ENV_PROD
|
|
||||||
} from '../../variables';
|
|
||||||
|
|
||||||
export interface ISecretSnapshot {
|
export interface ISecretSnapshot {
|
||||||
workspace: Types.ObjectId;
|
workspace: Types.ObjectId;
|
||||||
version: number;
|
version: number;
|
||||||
secrets: {
|
secretVersions: Types.ObjectId[];
|
||||||
version: number;
|
|
||||||
workspace: Types.ObjectId;
|
|
||||||
type: string;
|
|
||||||
user: Types.ObjectId;
|
|
||||||
environment: string;
|
|
||||||
secretKeyCiphertext: string;
|
|
||||||
secretKeyIV: string;
|
|
||||||
secretKeyTag: string;
|
|
||||||
secretKeyHash: string;
|
|
||||||
secretValueCiphertext: string;
|
|
||||||
secretValueIV: string;
|
|
||||||
secretValueTag: string;
|
|
||||||
secretValueHash: string;
|
|
||||||
}[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const secretSnapshotSchema = new Schema<ISecretSnapshot>(
|
const secretSnapshotSchema = new Schema<ISecretSnapshot>(
|
||||||
@@ -39,64 +17,10 @@ const secretSnapshotSchema = new Schema<ISecretSnapshot>(
|
|||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
secrets: [{
|
secretVersions: [{
|
||||||
version: {
|
type: Schema.Types.ObjectId,
|
||||||
type: Number,
|
ref: 'SecretVersion',
|
||||||
default: 1,
|
required: true
|
||||||
required: true
|
|
||||||
},
|
|
||||||
workspace: {
|
|
||||||
type: Schema.Types.ObjectId,
|
|
||||||
ref: 'Workspace',
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
enum: [SECRET_SHARED, SECRET_PERSONAL],
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
// user associated with the personal secret
|
|
||||||
type: Schema.Types.ObjectId,
|
|
||||||
ref: 'User'
|
|
||||||
},
|
|
||||||
environment: {
|
|
||||||
type: String,
|
|
||||||
enum: [ENV_DEV, ENV_TESTING, ENV_STAGING, ENV_PROD],
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
secretKeyCiphertext: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
secretKeyIV: {
|
|
||||||
type: String, // symmetric
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
secretKeyTag: {
|
|
||||||
type: String, // symmetric
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
secretKeyHash: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
secretValueCiphertext: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
secretValueIV: {
|
|
||||||
type: String, // symmetric
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
secretValueTag: {
|
|
||||||
type: String, // symmetric
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
secretValueHash: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,30 @@
|
|||||||
import { Schema, model, Types } from 'mongoose';
|
import { Schema, model, Types } from 'mongoose';
|
||||||
|
import {
|
||||||
|
SECRET_SHARED,
|
||||||
|
SECRET_PERSONAL,
|
||||||
|
ENV_DEV,
|
||||||
|
ENV_TESTING,
|
||||||
|
ENV_STAGING,
|
||||||
|
ENV_PROD
|
||||||
|
} from '../../variables';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO:
|
||||||
|
* 1. Modify SecretVersion to also contain XX
|
||||||
|
* - type
|
||||||
|
* - user
|
||||||
|
* - environment
|
||||||
|
* 2. Modify SecretSnapshot to point to arrays of SecretVersion
|
||||||
|
*/
|
||||||
|
|
||||||
export interface ISecretVersion {
|
export interface ISecretVersion {
|
||||||
_id?: Types.ObjectId;
|
_id?: Types.ObjectId;
|
||||||
secret: Types.ObjectId;
|
secret: Types.ObjectId;
|
||||||
version: number;
|
version: number;
|
||||||
|
workspace: Types.ObjectId; // new
|
||||||
|
type: string; // new
|
||||||
|
user: Types.ObjectId; // new
|
||||||
|
environment: string; // new
|
||||||
isDeleted: boolean;
|
isDeleted: boolean;
|
||||||
secretKeyCiphertext: string;
|
secretKeyCiphertext: string;
|
||||||
secretKeyIV: string;
|
secretKeyIV: string;
|
||||||
@@ -27,6 +48,26 @@ const secretVersionSchema = new Schema<ISecretVersion>(
|
|||||||
default: 1,
|
default: 1,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
workspace: {
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: 'Workspace',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
enum: [SECRET_SHARED, SECRET_PERSONAL],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
// user associated with the personal secret
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: 'User'
|
||||||
|
},
|
||||||
|
environment: {
|
||||||
|
type: String,
|
||||||
|
enum: [ENV_DEV, ENV_TESTING, ENV_STAGING, ENV_PROD],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
isDeleted: {
|
isDeleted: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import secret from './secret';
|
import secret from './secret';
|
||||||
|
import secretSnapshot from './secretSnapshot';
|
||||||
import workspace from './workspace';
|
import workspace from './workspace';
|
||||||
import action from './action';
|
import action from './action';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
secret,
|
secret,
|
||||||
|
secretSnapshot,
|
||||||
workspace,
|
workspace,
|
||||||
action
|
action
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
requireSecretAuth,
|
requireSecretAuth,
|
||||||
validateRequest
|
validateRequest
|
||||||
} from '../../../middleware';
|
} from '../../../middleware';
|
||||||
import { body, query, param } from 'express-validator';
|
import { query, param } from 'express-validator';
|
||||||
import { secretController } from '../../controllers/v1';
|
import { secretController } from '../../controllers/v1';
|
||||||
import { ADMIN, MEMBER, COMPLETED, GRANTED } from '../../../variables';
|
import { ADMIN, MEMBER, COMPLETED, GRANTED } from '../../../variables';
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import express from 'express';
|
||||||
|
const router = express.Router();
|
||||||
|
import {
|
||||||
|
requireSecretSnapshotAuth
|
||||||
|
} from '../../middleware';
|
||||||
|
import {
|
||||||
|
requireAuth,
|
||||||
|
validateRequest
|
||||||
|
} from '../../../middleware';
|
||||||
|
import { param } from 'express-validator';
|
||||||
|
import { ADMIN, MEMBER, GRANTED } from '../../../variables';
|
||||||
|
import { secretSnapshotController } from '../../controllers/v1';
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
'/:secretSnapshotId',
|
||||||
|
requireAuth,
|
||||||
|
requireSecretSnapshotAuth({
|
||||||
|
acceptedRoles: [ADMIN, MEMBER],
|
||||||
|
acceptedStatuses: [GRANTED]
|
||||||
|
}),
|
||||||
|
param('secretSnapshotId').exists().trim(),
|
||||||
|
validateRequest,
|
||||||
|
secretSnapshotController.getSecretSnapshot
|
||||||
|
);
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import * as Sentry from '@sentry/node';
|
import * as Sentry from '@sentry/node';
|
||||||
|
import { Types } from 'mongoose';
|
||||||
import {
|
import {
|
||||||
Secret,
|
Secret,
|
||||||
ISecret,
|
ISecret,
|
||||||
@@ -8,7 +9,6 @@ import {
|
|||||||
EELogService
|
EELogService
|
||||||
} from '../ee/services';
|
} from '../ee/services';
|
||||||
import {
|
import {
|
||||||
SecretVersion,
|
|
||||||
IAction
|
IAction
|
||||||
} from '../ee/models';
|
} from '../ee/models';
|
||||||
import {
|
import {
|
||||||
@@ -105,10 +105,8 @@ const v1PushSecrets = async ({
|
|||||||
_id: { $in: toDelete }
|
_id: { $in: toDelete }
|
||||||
});
|
});
|
||||||
|
|
||||||
await SecretVersion.updateMany({
|
await EESecretService.markDeletedSecretVersions({
|
||||||
secret: { $in: toDelete }
|
secretIds: toDelete
|
||||||
}, {
|
|
||||||
isDeleted: true
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,6 +189,10 @@ const v1PushSecrets = async ({
|
|||||||
return ({
|
return ({
|
||||||
secret: _id,
|
secret: _id,
|
||||||
version: version ? version + 1 : 1,
|
version: version ? version + 1 : 1,
|
||||||
|
workspace: new Types.ObjectId(workspaceId),
|
||||||
|
type: newSecret.type,
|
||||||
|
user: new Types.ObjectId(userId),
|
||||||
|
environment,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
secretKeyCiphertext: newSecret.ciphertextKey,
|
secretKeyCiphertext: newSecret.ciphertextKey,
|
||||||
secretKeyIV: newSecret.ivKey,
|
secretKeyIV: newSecret.ivKey,
|
||||||
@@ -242,6 +244,11 @@ const v1PushSecrets = async ({
|
|||||||
EESecretService.addSecretVersions({
|
EESecretService.addSecretVersions({
|
||||||
secretVersions: newSecrets.map(({
|
secretVersions: newSecrets.map(({
|
||||||
_id,
|
_id,
|
||||||
|
version,
|
||||||
|
workspace,
|
||||||
|
type,
|
||||||
|
user,
|
||||||
|
environment,
|
||||||
secretKeyCiphertext,
|
secretKeyCiphertext,
|
||||||
secretKeyIV,
|
secretKeyIV,
|
||||||
secretKeyTag,
|
secretKeyTag,
|
||||||
@@ -252,7 +259,11 @@ const v1PushSecrets = async ({
|
|||||||
secretValueHash
|
secretValueHash
|
||||||
}) => ({
|
}) => ({
|
||||||
secret: _id,
|
secret: _id,
|
||||||
version: 1,
|
version,
|
||||||
|
workspace,
|
||||||
|
type,
|
||||||
|
user,
|
||||||
|
environment,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
secretKeyCiphertext,
|
secretKeyCiphertext,
|
||||||
secretKeyIV,
|
secretKeyIV,
|
||||||
@@ -419,29 +430,14 @@ const v1PushSecrets = async ({
|
|||||||
// (EE) add secret versions for updated secrets
|
// (EE) add secret versions for updated secrets
|
||||||
await EESecretService.addSecretVersions({
|
await EESecretService.addSecretVersions({
|
||||||
secretVersions: toUpdate.map((s) => {
|
secretVersions: toUpdate.map((s) => {
|
||||||
const {
|
|
||||||
secretKeyCiphertext,
|
|
||||||
secretKeyIV,
|
|
||||||
secretKeyTag,
|
|
||||||
secretKeyHash,
|
|
||||||
secretValueCiphertext,
|
|
||||||
secretValueIV,
|
|
||||||
secretValueTag,
|
|
||||||
secretValueHash,
|
|
||||||
} = newSecretsObj[`${s.type}-${s.secretKeyHash}`];
|
|
||||||
|
|
||||||
return ({
|
return ({
|
||||||
|
...newSecretsObj[`${s.type}-${s.secretKeyHash}`],
|
||||||
secret: s._id,
|
secret: s._id,
|
||||||
version: s.version ? s.version + 1 : 1,
|
version: s.version ? s.version + 1 : 1,
|
||||||
isDeleted: false,
|
workspace: new Types.ObjectId(workspaceId),
|
||||||
secretKeyCiphertext,
|
user: s.user,
|
||||||
secretKeyIV,
|
environment: s.environment,
|
||||||
secretKeyTag,
|
isDeleted: false
|
||||||
secretKeyHash,
|
|
||||||
secretValueCiphertext,
|
|
||||||
secretValueIV,
|
|
||||||
secretValueTag,
|
|
||||||
secretValueHash
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -474,28 +470,10 @@ const v1PushSecrets = async ({
|
|||||||
|
|
||||||
// (EE) add secret versions for new secrets
|
// (EE) add secret versions for new secrets
|
||||||
EESecretService.addSecretVersions({
|
EESecretService.addSecretVersions({
|
||||||
secretVersions: newSecrets.map(({
|
secretVersions: newSecrets.map((s) => ({
|
||||||
_id,
|
...s,
|
||||||
secretKeyCiphertext,
|
secret: s._id,
|
||||||
secretKeyIV,
|
isDeleted: false
|
||||||
secretKeyTag,
|
|
||||||
secretKeyHash,
|
|
||||||
secretValueCiphertext,
|
|
||||||
secretValueIV,
|
|
||||||
secretValueTag,
|
|
||||||
secretValueHash
|
|
||||||
}) => ({
|
|
||||||
secret: _id,
|
|
||||||
version: 1,
|
|
||||||
isDeleted: false,
|
|
||||||
secretKeyCiphertext,
|
|
||||||
secretKeyIV,
|
|
||||||
secretKeyTag,
|
|
||||||
secretKeyHash,
|
|
||||||
secretValueCiphertext,
|
|
||||||
secretValueIV,
|
|
||||||
secretValueTag,
|
|
||||||
secretValueHash
|
|
||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
@@ -13,6 +13,7 @@ declare global {
|
|||||||
integrationAuth: any;
|
integrationAuth: any;
|
||||||
bot: any;
|
bot: any;
|
||||||
secret: any;
|
secret: any;
|
||||||
|
secretSnapshot: any;
|
||||||
serviceToken: any;
|
serviceToken: any;
|
||||||
accessToken: any;
|
accessToken: any;
|
||||||
query?: any;
|
query?: any;
|
||||||
|
|||||||
@@ -123,6 +123,16 @@ export const SecretNotFoundError = (error?: Partial<RequestErrorContext>) => new
|
|||||||
stack: error?.stack
|
stack: error?.stack
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//* ----->[SECRET SNAPSHOT ERRORS]<-----
|
||||||
|
export const SecretSnapshotNotFoundError = (error?: Partial<RequestErrorContext>) => new RequestError({
|
||||||
|
logLevel: error?.logLevel ?? LogLevel.ERROR,
|
||||||
|
statusCode: error?.statusCode ?? 404,
|
||||||
|
type: error?.type ?? 'secret_snapshot_not_found_error',
|
||||||
|
message: error?.message ?? 'The requested secret snapshot was not found',
|
||||||
|
context: error?.context,
|
||||||
|
stack: error?.stack
|
||||||
|
});
|
||||||
|
|
||||||
//* ----->[ACTION ERRORS]<-----
|
//* ----->[ACTION ERRORS]<-----
|
||||||
export const ActionNotFoundError = (error?: Partial<RequestErrorContext>) => new RequestError({
|
export const ActionNotFoundError = (error?: Partial<RequestErrorContext>) => new RequestError({
|
||||||
logLevel: error?.logLevel ?? LogLevel.ERROR,
|
logLevel: error?.logLevel ?? LogLevel.ERROR,
|
||||||
|
|||||||
Reference in New Issue
Block a user