mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 07:26:34 +00:00
greptile review fixes
This commit is contained in:
@@ -97,7 +97,7 @@ export const registerOCIConnectionRouter = async (server: FastifyZodProvider) =>
|
|||||||
}),
|
}),
|
||||||
querystring: z.object({
|
querystring: z.object({
|
||||||
compartmentOcid: z.string().min(1, "Compartment OCID required"),
|
compartmentOcid: z.string().min(1, "Compartment OCID required"),
|
||||||
vaultOcid: z.string().min(1, "Compartment OCID required")
|
vaultOcid: z.string().min(1, "Vault OCID required")
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z
|
200: z
|
||||||
@@ -113,11 +113,11 @@ export const registerOCIConnectionRouter = async (server: FastifyZodProvider) =>
|
|||||||
const { connectionId } = req.params;
|
const { connectionId } = req.params;
|
||||||
const { compartmentOcid, vaultOcid } = req.query;
|
const { compartmentOcid, vaultOcid } = req.query;
|
||||||
|
|
||||||
const vaults = await server.services.appConnection.oci.listVaultKeys(
|
const keys = await server.services.appConnection.oci.listVaultKeys(
|
||||||
{ connectionId, compartmentOcid, vaultOcid },
|
{ connectionId, compartmentOcid, vaultOcid },
|
||||||
req.permission
|
req.permission
|
||||||
);
|
);
|
||||||
return vaults;
|
return keys;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export const listOCIVaultKeys = async (appConnection: TOCIConnection, compartmen
|
|||||||
authenticationDetailsProvider: provider
|
authenticationDetailsProvider: provider
|
||||||
});
|
});
|
||||||
|
|
||||||
keyManagementClient.endpoint = `https://${vaultIdMatch[1]}-management.kms.${appConnection.credentials.region}.oraclecloud.com`;
|
keyManagementClient.endpoint = `https://${vaultIdMatch[1].replace(/[^a-zA-Z0-9]/g, "")}-management.kms.${appConnection.credentials.region}.oraclecloud.com`;
|
||||||
|
|
||||||
const keys = await keyManagementClient.listKeys({
|
const keys = await keyManagementClient.listKeys({
|
||||||
compartmentId: compartmentOcid
|
compartmentId: compartmentOcid
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { logger } from "@app/lib/logger";
|
||||||
import { OrgServiceActor } from "@app/lib/types";
|
import { OrgServiceActor } from "@app/lib/types";
|
||||||
|
|
||||||
import { AppConnection } from "../app-connection-enums";
|
import { AppConnection } from "../app-connection-enums";
|
||||||
@@ -29,6 +30,7 @@ export const ociConnectionService = (getAppConnection: TGetAppConnectionFunc) =>
|
|||||||
const compartments = await listOCICompartments(appConnection);
|
const compartments = await listOCICompartments(appConnection);
|
||||||
return compartments;
|
return compartments;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
logger.error(error, "Failed to establish connection with OCI");
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -40,6 +42,7 @@ export const ociConnectionService = (getAppConnection: TGetAppConnectionFunc) =>
|
|||||||
const vaults = await listOCIVaults(appConnection, compartmentOcid);
|
const vaults = await listOCIVaults(appConnection, compartmentOcid);
|
||||||
return vaults;
|
return vaults;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
logger.error(error, "Failed to establish connection with OCI");
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -51,9 +54,10 @@ export const ociConnectionService = (getAppConnection: TGetAppConnectionFunc) =>
|
|||||||
const appConnection = await getAppConnection(AppConnection.OCI, connectionId, actor);
|
const appConnection = await getAppConnection(AppConnection.OCI, connectionId, actor);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const vaults = await listOCIVaultKeys(appConnection, compartmentOcid, vaultOcid);
|
const keys = await listOCIVaultKeys(appConnection, compartmentOcid, vaultOcid);
|
||||||
return vaults;
|
return keys;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
logger.error(error, "Failed to establish connection with OCI");
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,13 +15,23 @@ const OCIVaultSyncDestinationConfigSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1, "Compartment OCID required")
|
.min(1, "Compartment OCID required")
|
||||||
|
.regex(
|
||||||
|
/^ocid1\.(tenancy|compartment)\.oc1\..+$/,
|
||||||
|
"Invalid Compartment OCID format. Must start with ocid1.tenancy.oc1. or ocid1.compartment.oc1."
|
||||||
|
)
|
||||||
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.compartmentOcid),
|
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.compartmentOcid),
|
||||||
vaultOcid: z
|
vaultOcid: z
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1, "Vault OCID required")
|
.min(1, "Vault OCID required")
|
||||||
|
.regex(/^ocid1\.vault\.oc1\..+$/, "Invalid Vault OCID format. Must start with ocid1.vault.oc1.")
|
||||||
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.vaultOcid),
|
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.vaultOcid),
|
||||||
keyOcid: z.string().trim().min(1, "Key OCID required").describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.keyOcid)
|
keyOcid: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1, "Key OCID required")
|
||||||
|
.regex(/^ocid1\.key\.oc1\..+$/, "Invalid Key OCID format. Must start with ocid1.key.oc1.")
|
||||||
|
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.keyOcid)
|
||||||
});
|
});
|
||||||
|
|
||||||
const OCIVaultSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: true };
|
const OCIVaultSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: true };
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ Infisical supports the use of [API Signing Key Authentication](https://docs.orac
|
|||||||

|

|
||||||
</Step>
|
</Step>
|
||||||
<Step title="Create group">
|
<Step title="Create group">
|
||||||
The name and description can be anything. **Ensure that you assing the user created in earlier steps to this group**.
|
The name and description can be anything. **Ensure that you assign the user created in earlier steps to this group**.
|
||||||
|
|
||||||

|

|
||||||
</Step>
|
</Step>
|
||||||
<Step title="Store group name">
|
<Step title="Store group name">
|
||||||
After creating the group, take note of it's name. It will be used in later steps.
|
After creating the group, take note of its name. It will be used in later steps.
|
||||||
</Step>
|
</Step>
|
||||||
</Steps>
|
</Steps>
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ Infisical supports the use of [API Signing Key Authentication](https://docs.orac
|
|||||||
"isPlatformManagedCredentials": false,
|
"isPlatformManagedCredentials": false,
|
||||||
"credentialsHash": "7c2d371dec195f82a6a0d5b41c970a229cfcaf88e894a5b6395e2dbd0280661f",
|
"credentialsHash": "7c2d371dec195f82a6a0d5b41c970a229cfcaf88e894a5b6395e2dbd0280661f",
|
||||||
"app": "oci",
|
"app": "oci",
|
||||||
"method": "access-token",
|
"method": "access-key",
|
||||||
"credentials": {
|
"credentials": {
|
||||||
"userOcid": "ocid1.user.oc1..aaaaaaaagrp35tbkvvad4y2j7sug7xonua7dl2gfp4at2u5i5xj4ghnitg3a",
|
"userOcid": "ocid1.user.oc1..aaaaaaaagrp35tbkvvad4y2j7sug7xonua7dl2gfp4at2u5i5xj4ghnitg3a",
|
||||||
"tenancyOcid": "ocid1.tenancy.oc1..aaaaaaaaotfma465m4zumfe2ua64mj2m5dwmlw2llh4g4dnfttnakiifonta",
|
"tenancyOcid": "ocid1.tenancy.oc1..aaaaaaaaotfma465m4zumfe2ua64mj2m5dwmlw2llh4g4dnfttnakiifonta",
|
||||||
|
|||||||
+4
-6
@@ -34,7 +34,7 @@ export const OCIVaultSyncFields = () => {
|
|||||||
const { data: vaults, isLoading: isVaultsLoading } = useOCIConnectionListVaults(
|
const { data: vaults, isLoading: isVaultsLoading } = useOCIConnectionListVaults(
|
||||||
{ connectionId, compartmentOcid: selectedCompartment },
|
{ connectionId, compartmentOcid: selectedCompartment },
|
||||||
{
|
{
|
||||||
enabled: Boolean(connectionId)
|
enabled: Boolean(connectionId && selectedCompartment)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ export const OCIVaultSyncFields = () => {
|
|||||||
const { data: keys, isLoading: isKeysLoading } = useOCIConnectionListVaultKeys(
|
const { data: keys, isLoading: isKeysLoading } = useOCIConnectionListVaultKeys(
|
||||||
{ connectionId, compartmentOcid: selectedCompartment, vaultOcid: selectedVault },
|
{ connectionId, compartmentOcid: selectedCompartment, vaultOcid: selectedVault },
|
||||||
{
|
{
|
||||||
enabled: Boolean(connectionId)
|
enabled: Boolean(connectionId && selectedCompartment && selectedVault)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ export const OCIVaultSyncFields = () => {
|
|||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
isLoading={isVaultsLoading && Boolean(connectionId)}
|
isLoading={isVaultsLoading && Boolean(connectionId)}
|
||||||
isDisabled={!connectionId || !selectedCompartment || !vaults}
|
isDisabled={!connectionId || !selectedCompartment}
|
||||||
value={vaults?.find((v) => v.id === value) ?? null}
|
value={vaults?.find((v) => v.id === value) ?? null}
|
||||||
onChange={(option) => {
|
onChange={(option) => {
|
||||||
onChange((option as SingleValue<{ id: string }>)?.id ?? null);
|
onChange((option as SingleValue<{ id: string }>)?.id ?? null);
|
||||||
@@ -157,9 +157,7 @@ export const OCIVaultSyncFields = () => {
|
|||||||
<FilterableSelect
|
<FilterableSelect
|
||||||
menuPlacement="top"
|
menuPlacement="top"
|
||||||
isLoading={isKeysLoading && Boolean(connectionId)}
|
isLoading={isKeysLoading && Boolean(connectionId)}
|
||||||
isDisabled={
|
isDisabled={!connectionId || !selectedCompartment || !selectedVault}
|
||||||
!connectionId || !selectedCompartment || !selectedVault || !vaults || !keys
|
|
||||||
}
|
|
||||||
value={keys?.find((v) => v.id === value) ?? null}
|
value={keys?.find((v) => v.id === value) ?? null}
|
||||||
onChange={(option) => {
|
onChange={(option) => {
|
||||||
onChange((option as SingleValue<{ id: string }>)?.id ?? null);
|
onChange((option as SingleValue<{ id: string }>)?.id ?? null);
|
||||||
|
|||||||
+21
-3
@@ -7,9 +7,27 @@ export const OCIVaultSyncDestinationSchema = BaseSecretSyncSchema().merge(
|
|||||||
z.object({
|
z.object({
|
||||||
destination: z.literal(SecretSync.OCIVault),
|
destination: z.literal(SecretSync.OCIVault),
|
||||||
destinationConfig: z.object({
|
destinationConfig: z.object({
|
||||||
compartmentOcid: z.string().trim().min(1, "Compartment OCID required"),
|
compartmentOcid: z
|
||||||
vaultOcid: z.string().trim().min(1, "Vault OCID required"),
|
.string()
|
||||||
keyOcid: z.string().trim().min(1, "Key OCID required")
|
.trim()
|
||||||
|
.min(1, "Compartment OCID required")
|
||||||
|
.regex(
|
||||||
|
/^ocid1\.(tenancy|compartment)\.oc1\..+$/,
|
||||||
|
"Invalid Compartment OCID format. Must start with ocid1.tenancy.oc1. or ocid1.compartment.oc1."
|
||||||
|
),
|
||||||
|
vaultOcid: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1, "Vault OCID required")
|
||||||
|
.regex(
|
||||||
|
/^ocid1\.vault\.oc1\..+$/,
|
||||||
|
"Invalid Vault OCID format. Must start with ocid1.vault.oc1."
|
||||||
|
),
|
||||||
|
keyOcid: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1, "Key OCID required")
|
||||||
|
.regex(/^ocid1\.key\.oc1\..+$/, "Invalid Key OCID format. Must start with ocid1.key.oc1.")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
+10
-2
@@ -33,8 +33,16 @@ const formSchema = z.discriminatedUnion("method", [
|
|||||||
rootSchema.extend({
|
rootSchema.extend({
|
||||||
method: z.literal(OCIConnectionMethod.AccessKey),
|
method: z.literal(OCIConnectionMethod.AccessKey),
|
||||||
credentials: z.object({
|
credentials: z.object({
|
||||||
userOcid: z.string().trim().min(1, "User OCID required"),
|
userOcid: z
|
||||||
tenancyOcid: z.string().trim().min(1, "Tenancy OCID required"),
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1, "User OCID required")
|
||||||
|
.regex(/^ocid1\.user\.oc1\.\..+$/, "Invalid User OCID format"),
|
||||||
|
tenancyOcid: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1, "Tenancy OCID required")
|
||||||
|
.regex(/^ocid1\.tenancy\.oc1\.\..+$/, "Invalid Tenancy OCID format"),
|
||||||
region: z.string().trim().min(1, "Region required"),
|
region: z.string().trim().min(1, "Region required"),
|
||||||
fingerprint: z.string().trim().min(1, "Fingerprint required"),
|
fingerprint: z.string().trim().min(1, "Fingerprint required"),
|
||||||
privateKey: z.string().trim().min(1, "Private Key required")
|
privateKey: z.string().trim().min(1, "Private Key required")
|
||||||
|
|||||||
Reference in New Issue
Block a user