mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 16:52:38 +00:00
improvements: address feedback
This commit is contained in:
@@ -548,6 +548,7 @@ export const secretV2BridgeDALFactory = (db: TDbClient) => {
|
||||
try {
|
||||
const secrets = await (tx || db.replicaNode())(TableName.SecretV2)
|
||||
.where({ folderId })
|
||||
|
||||
.where((bd) => {
|
||||
query.forEach((el) => {
|
||||
if (el.type === SecretType.Personal && !el.userId) {
|
||||
@@ -559,10 +560,20 @@ export const secretV2BridgeDALFactory = (db: TDbClient) => {
|
||||
userId: el.type === SecretType.Personal ? el.userId : null
|
||||
});
|
||||
});
|
||||
});
|
||||
return secrets;
|
||||
})
|
||||
.leftJoin(
|
||||
TableName.SecretRotationV2SecretMapping,
|
||||
`${TableName.SecretV2}.id`,
|
||||
`${TableName.SecretRotationV2SecretMapping}.secretId`
|
||||
)
|
||||
.select(selectAllTableCols(TableName.SecretV2))
|
||||
.select(db.ref("rotationId").withSchema(TableName.SecretRotationV2SecretMapping));
|
||||
return secrets.map((secret) => ({
|
||||
...secret,
|
||||
isRotatedSecret: Boolean(secret.rotationId)
|
||||
}));
|
||||
} catch (error) {
|
||||
throw new DatabaseError({ error, name: "find by blind indexes" });
|
||||
throw new DatabaseError({ error, name: "find by secret keys" });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -2234,6 +2234,10 @@ export const secretV2BridgeServiceFactory = ({
|
||||
const destinationActions = [ProjectPermissionSecretActions.Create, ProjectPermissionSecretActions.Edit] as const;
|
||||
|
||||
sourceSecrets.forEach((secret) => {
|
||||
if (secret.isRotatedSecret) {
|
||||
throw new BadRequestError({ message: `Cannot move rotated secret: ${secret.key}` });
|
||||
}
|
||||
|
||||
for (const sourceAction of sourceActions) {
|
||||
if (
|
||||
sourceAction === ProjectPermissionSecretActions.DescribeSecret ||
|
||||
|
||||
Reference in New Issue
Block a user