mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 01:27:31 +00:00
fix: resolved approval failing when secret was missing in board
This commit is contained in:
@@ -139,18 +139,25 @@ export const secretReplicationServiceFactory = ({
|
|||||||
});
|
});
|
||||||
const localSecretsGroupedByBlindIndex = groupBy(localSecrets, (i) => i.secretBlindIndex as string);
|
const localSecretsGroupedByBlindIndex = groupBy(localSecrets, (i) => i.secretBlindIndex as string);
|
||||||
|
|
||||||
const locallyCreatedSecrets = sanitizedSecrets.filter(({ operation, id }) => {
|
const locallyCreatedSecrets = sanitizedSecrets
|
||||||
return (
|
.filter(
|
||||||
(operation === SecretOperations.Create || operation === SecretOperations.Update) &&
|
({ operation, id }) =>
|
||||||
!localSecretsGroupedByBlindIndex[replicatedSecretsGroupBySecretId[id][0].secretBlindIndex as string]?.[0]
|
// upsert: irrespective of create or update its a create if not found in dashboard
|
||||||
);
|
(operation === SecretOperations.Create || operation === SecretOperations.Update) &&
|
||||||
});
|
!localSecretsGroupedByBlindIndex[
|
||||||
|
replicatedSecretsGroupBySecretId[id][0].secretBlindIndex as string
|
||||||
|
]?.[0]
|
||||||
|
)
|
||||||
|
.map((el) => ({ ...el, operation: SecretOperations.Create })); // rewrite update ops to create
|
||||||
|
|
||||||
const locallyUpdatedSecrets = sanitizedSecrets.filter(
|
const locallyUpdatedSecrets = sanitizedSecrets
|
||||||
({ operation, id }) =>
|
.filter(
|
||||||
(operation === SecretOperations.Create || operation === SecretOperations.Update) &&
|
({ operation, id }) =>
|
||||||
localSecretsGroupedByBlindIndex[replicatedSecretsGroupBySecretId[id][0].secretBlindIndex as string]?.[0]
|
// upsert: irrespective of create or update its an update if not found in dashboard
|
||||||
);
|
(operation === SecretOperations.Create || operation === SecretOperations.Update) &&
|
||||||
|
localSecretsGroupedByBlindIndex[replicatedSecretsGroupBySecretId[id][0].secretBlindIndex as string]?.[0]
|
||||||
|
)
|
||||||
|
.map((el) => ({ ...el, operation: SecretOperations.Update })); // rewrite create ops to update
|
||||||
|
|
||||||
const locallyDeletedSecrets = sanitizedSecrets.filter(
|
const locallyDeletedSecrets = sanitizedSecrets.filter(
|
||||||
({ operation, id }) =>
|
({ operation, id }) =>
|
||||||
@@ -196,6 +203,7 @@ export const secretReplicationServiceFactory = ({
|
|||||||
.map(({ id, operation }) => {
|
.map(({ id, operation }) => {
|
||||||
const doc = replicatedSecretsGroupBySecretId[id][0];
|
const doc = replicatedSecretsGroupBySecretId[id][0];
|
||||||
const localSecret = localSecretsGroupedByBlindIndex[doc.secretBlindIndex as string]?.[0];
|
const localSecret = localSecretsGroupedByBlindIndex[doc.secretBlindIndex as string]?.[0];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
op: operation,
|
op: operation,
|
||||||
keyEncoding: doc.keyEncoding,
|
keyEncoding: doc.keyEncoding,
|
||||||
|
|||||||
Reference in New Issue
Block a user