feat: resolved bug reported on search and integration failing due to typo in integration field

This commit is contained in:
=
2024-07-30 23:19:07 +05:30
parent 8435b20178
commit 6a156371c0
10 changed files with 30 additions and 24 deletions
@@ -329,7 +329,7 @@ export const integrationAuthServiceFactory = ({
if ( if (
integrationAuth.integration === Integrations.AWS_SECRET_MANAGER && integrationAuth.integration === Integrations.AWS_SECRET_MANAGER &&
(shouldUseSecretV2Bridge (shouldUseSecretV2Bridge
? integrationAuth.encryptedAwsIamAssumRole ? integrationAuth.encryptedAwsAssumeIamRoleArn
: integrationAuth.awsAssumeIamRoleArnCipherText) : integrationAuth.awsAssumeIamRoleArnCipherText)
) { ) {
return { accessToken: "", accessId: "" }; return { accessToken: "", accessId: "" };
@@ -127,7 +127,7 @@ export const integrationDALFactory = (db: TDbClient) => {
db.ref("encryptedRefresh").withSchema(TableName.IntegrationAuth), db.ref("encryptedRefresh").withSchema(TableName.IntegrationAuth),
db.ref("encryptedAccess").withSchema(TableName.IntegrationAuth), db.ref("encryptedAccess").withSchema(TableName.IntegrationAuth),
db.ref("encryptedAccessId").withSchema(TableName.IntegrationAuth), db.ref("encryptedAccessId").withSchema(TableName.IntegrationAuth),
db.ref("encryptedAwsIamAssumRole").withSchema(TableName.IntegrationAuth) db.ref("encryptedAwsAssumeIamRoleArn").withSchema(TableName.IntegrationAuth)
); );
return docs.map( return docs.map(
({ ({
@@ -159,7 +159,7 @@ export const integrationDALFactory = (db: TDbClient) => {
encryptedAccess, encryptedAccess,
encryptedRefresh, encryptedRefresh,
encryptedAccessId, encryptedAccessId,
encryptedAwsIamAssumRole, encryptedAwsAssumeIamRoleArn,
...el ...el
}) => ({ }) => ({
...el, ...el,
@@ -195,7 +195,7 @@ export const integrationDALFactory = (db: TDbClient) => {
encryptedAccess, encryptedAccess,
encryptedRefresh, encryptedRefresh,
encryptedAccessId, encryptedAccessId,
encryptedAwsIamAssumRole encryptedAwsAssumeIamRoleArn
} }
}) })
); );
+2 -2
View File
@@ -635,9 +635,9 @@ export const secretQueueFactory = ({
); );
let awsAssumeRoleArn = null; let awsAssumeRoleArn = null;
if (shouldUseSecretV2Bridge) { if (shouldUseSecretV2Bridge) {
if (integrationAuth.encryptedAwsIamAssumRole) { if (integrationAuth.encryptedAwsAssumeIamRoleArn) {
awsAssumeRoleArn = secretManagerDecryptor({ awsAssumeRoleArn = secretManagerDecryptor({
cipherTextBlob: Buffer.from(integrationAuth.encryptedAwsIamAssumRole) cipherTextBlob: Buffer.from(integrationAuth.encryptedAwsAssumeIamRoleArn)
}).toString(); }).toString();
} }
} else if ( } else if (
+1 -1
View File
@@ -44,7 +44,7 @@ export const fetchProjectSecrets = async ({
}; };
export const mergePersonalSecrets = (rawSecrets: SecretV3Raw[]) => { export const mergePersonalSecrets = (rawSecrets: SecretV3Raw[]) => {
const personalSecrets: Record<string, { id: string; value: string }> = {}; const personalSecrets: Record<string, { id: string; value?: string }> = {};
const secrets: SecretV3RawSanitized[] = []; const secrets: SecretV3RawSanitized[] = [];
rawSecrets.forEach((el) => { rawSecrets.forEach((el) => {
const decryptedSecret: SecretV3RawSanitized = { const decryptedSecret: SecretV3RawSanitized = {
+2 -2
View File
@@ -34,7 +34,7 @@ export type SecretV3RawSanitized = {
id: string; id: string;
version: number; version: number;
key: string; key: string;
value: string; value?: string;
comment?: string; comment?: string;
reminderRepeatDays?: number | null; reminderRepeatDays?: number | null;
reminderNote?: string | null; reminderNote?: string | null;
@@ -57,7 +57,7 @@ export type SecretV3Raw = {
version: number; version: number;
type: string; type: string;
secretKey: string; secretKey: string;
secretValue: string; secretValue?: string;
secretComment?: string; secretComment?: string;
secretReminderNote?: string; secretReminderNote?: string;
secretReminderRepeatDays?: number; secretReminderRepeatDays?: number;
@@ -19,13 +19,7 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications"; import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions"; import { ProjectPermissionCan } from "@app/components/permissions";
import { import { EmptyState, IconButton, SecretInput, TableContainer, Tooltip } from "@app/components/v2";
EmptyState,
IconButton,
SecretInput,
TableContainer,
Tooltip
} from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context"; import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
import { useToggle } from "@app/hooks"; import { useToggle } from "@app/hooks";
import { useResyncSecretReplication } from "@app/hooks/api"; import { useResyncSecretReplication } from "@app/hooks/api";
@@ -37,7 +31,11 @@ type Props = {
secretPath?: string; secretPath?: string;
secretImport?: TSecretImport; secretImport?: TSecretImport;
isReplicationExpand?: boolean; isReplicationExpand?: boolean;
importedSecrets: { key: string; value: string; overriden: { env: string; secretPath: string } }[]; importedSecrets: {
key: string;
value?: string;
overriden: { env: string; secretPath: string };
}[];
searchTerm: string; searchTerm: string;
onExpandReplicateSecrets: (id: string) => void; onExpandReplicateSecrets: (id: string) => void;
}; };
@@ -45,9 +43,9 @@ type Props = {
// to show the environment and folder icon // to show the environment and folder icon
export const EnvFolderIcon = ({ export const EnvFolderIcon = ({
env, env,
secretPath, secretPath
// isReplication }: // isReplication
}: { {
env: string; env: string;
secretPath: string; secretPath: string;
// isReplication?: boolean; // isReplication?: boolean;
@@ -63,7 +63,7 @@ export const computeImportedSecretRows = (
const importedEntry: Record<string, boolean> = {}; const importedEntry: Record<string, boolean> = {};
const importedSecretEntries: { const importedSecretEntries: {
key: string; key: string;
value: string; value?: string;
overriden: { overriden: {
env: string; env: string;
secretPath: string; secretPath: string;
@@ -417,7 +417,12 @@ export const SecretDetailSidebar = ({
className="px-2 py-1" className="px-2 py-1"
variant="outline_bg" variant="outline_bg"
leftIcon={<FontAwesomeIcon icon={faShare} />} leftIcon={<FontAwesomeIcon icon={faShare} />}
onClick={() => handleSecretShare(secret.valueOverride ?? secret.value)} onClick={() => {
const value = secret?.valueOverride ?? secret?.value;
if (value) {
handleSecretShare(value);
}
}}
> >
Share Secret Share Secret
</Button> </Button>
@@ -79,7 +79,7 @@ export const filterSecrets = (secrets: SecretV3RawSanitized[], filter: Filter) =
const searchTerm = filter.searchFilter.toLowerCase(); const searchTerm = filter.searchFilter.toLowerCase();
return ( return (
(!isTagFilterActive || tags?.some(({ id }) => filter.tags?.[id])) && (!isTagFilterActive || tags?.some(({ id }) => filter.tags?.[id])) &&
(key.toLowerCase().includes(searchTerm) || value.toLowerCase().includes(searchTerm)) (key.toLowerCase().includes(searchTerm) || value?.toLowerCase().includes(searchTerm))
); );
}); });
@@ -23,7 +23,10 @@ export enum SecretActionType {
export const formSchema = z.object({ export const formSchema = z.object({
key: z.string().trim().min(1, { message: "Secret key is required" }), key: z.string().trim().min(1, { message: "Secret key is required" }),
value: z.string().transform((val) => (val.at(-1) === "\n" ? `${val.trim()}\n` : val.trim())), value: z
.string()
.transform((val) => (val.at(-1) === "\n" ? `${val.trim()}\n` : val.trim()))
.optional(),
idOverride: z.string().trim().optional(), idOverride: z.string().trim().optional(),
valueOverride: z valueOverride: z
.string() .string()