mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 00:52:09 +00:00
Enable all auth clients for secrets v3, remove serviceTokenData .populate in middleware, make secret versions and rollbacks compatible with blind indexing
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
DeleteSecretParams
|
||||
} from '../interfaces/services/SecretService';
|
||||
import {
|
||||
initSecretBlindIndexDataHelper,
|
||||
createSecretBlindIndexDataHelper,
|
||||
getSecretBlindIndexSaltHelper,
|
||||
generateSecretBlindIndexWithSaltHelper,
|
||||
@@ -23,6 +24,17 @@ import {
|
||||
} from '../helpers/secrets';
|
||||
|
||||
class SecretService {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param param0 h
|
||||
* @returns
|
||||
*/
|
||||
|
||||
static async initSecretBlindIndexDataHelper() {
|
||||
return await initSecretBlindIndexDataHelper();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create secret blind index data containing encrypted blind index salt
|
||||
* for workspace with id [workspaceId]
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
ServiceTokenData
|
||||
} from '../models';
|
||||
import {
|
||||
AccountNotFoundError,
|
||||
BadRequestError
|
||||
} from '../utils/errors';
|
||||
|
||||
@@ -50,20 +51,23 @@ class Telemetry {
|
||||
return postHogClient;
|
||||
}
|
||||
|
||||
static getDistinctId ({
|
||||
static getDistinctId = async ({
|
||||
authData
|
||||
}: {
|
||||
authData: AuthData;
|
||||
}) {
|
||||
let distinctId: any = '';
|
||||
}) => {
|
||||
let distinctId = '';
|
||||
if (authData.authPayload instanceof User) {
|
||||
distinctId = authData.authPayload.email;
|
||||
} else if (authData.authPayload instanceof ServiceAccount) {
|
||||
distinctId = `sa.${authData.authPayload._id.toString()}`;
|
||||
} else if (authData.authPayload instanceof ServiceTokenData) {
|
||||
if (authData.authPayload.user instanceof User) {
|
||||
distinctId = authData.authPayload?.user.email;
|
||||
} else if (authData.authPayload?.serviceAccount) {
|
||||
|
||||
if (authData.authPayload.user) {
|
||||
const user = await User.findById(authData.authPayload.user, 'email');
|
||||
if (!user) throw AccountNotFoundError();
|
||||
distinctId = user.email;
|
||||
} else if (authData.authPayload.serviceAccount) {
|
||||
distinctId = distinctId = `sa.${authData.authPayload.serviceAccount.toString()}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user