review fixes

This commit is contained in:
x
2025-04-24 22:39:20 -04:00
parent c01c58fdcb
commit dd112b3850
6 changed files with 29 additions and 27 deletions

View File

@@ -52,7 +52,7 @@ export const HCVaultSyncFns = {
const variables = await listHCVaultVariables({ instanceUrl, accessToken, mount, path });
let tainted = false;
for await (const entry of Object.entries(secretMap)) {
for (const entry of Object.entries(secretMap)) {
const [key, { value }] = entry;
if (value !== variables[key]) {
variables[key] = value;

View File

@@ -1,3 +1,4 @@
import RE2 from "re2";
import { z } from "zod";
import { SecretSyncs } from "@app/lib/api-docs";
@@ -20,8 +21,8 @@ const HCVaultSyncDestinationConfigSchema = z.object({
.string()
.trim()
.min(1, "Path required")
.transform((val) => val.trim().replace(/^\/+|\/+$/g, "")) // removes leading/trailing slashes
.refine((val) => /^([a-zA-Z0-9._-]+\/)*[a-zA-Z0-9._-]+$/.test(val), {
.transform((val) => val.replace(/^\/+|\/+$/g, "")) // removes leading/trailing slashes
.refine((val) => new RE2("^([a-zA-Z0-9._-]+/)*[a-zA-Z0-9._-]+$").test(val), {
message:
"Invalid Vault path format. Use alphanumerics, dots, dashes, underscores, and single slashes between segments."
})

View File

@@ -101,7 +101,7 @@ Infisical supports two methods for connecting to Hashicorp Vault.
<Tabs>
<Tab title="Self Hosted">
On self-hosted instances, simply copy your vault's base URL. (Ex. `https://vault.mycompany.com`)
On self-hosted instances, simply copy your vault's base URL. (Ex. `https://vault.example.com`)
Save this value for later steps.
</Tab>
@@ -159,7 +159,7 @@ Infisical supports two methods for connecting to Hashicorp Vault.
"name": "my-vault-connection",
"method": "app-role",
"credentials": {
"instanceUrl": "https://vault.mycompany.com",
"instanceUrl": "https://vault.example.com",
"roleId": "4797c4fa-7794-71f0-c8b1-7c87759df5bf",
"secretId": "ad24df93-19c8-c865-9997-6b8513253d3a"
}
@@ -180,7 +180,7 @@ Infisical supports two methods for connecting to Hashicorp Vault.
"app": "hashicorp-vault",
"method": "app-role",
"credentials": {
"instanceUrl": "https://vault.mycompany.com",
"instanceUrl": "https://vault.example.com",
"roleId": "4797c4fa-7794-71f0-c8b1-7c87759df5bf"
}
}

View File

@@ -36,8 +36,8 @@ description: "Learn how to configure a Hashicorp Vault Sync for Infisical."
![Configure Destination](/images/secret-syncs/hashicorp-vault/sync-destination.png)
- **Hashicorp Vault Connection**: The Vault Connection to authenticate with.
- **Secrets Engine Mount**: The Secrets Engine Mount to sync secrets to.
- **Path**: The Secrets Engine Mount path to sync secrets to.
- **Secrets Engine Mount**: The type of secrets engine to use (e.g., 'secret', 'kv').
- **Path**: The specific path within the secrets engine where secrets will be stored.
After configuring these parameters, click the **Next** button to continue to the Sync Options step.
</Step>
@@ -80,24 +80,24 @@ description: "Learn how to configure a Hashicorp Vault Sync for Infisical."
```bash Request
curl --request POST \
--url https://app.infisical.com/api/v1/secret-syncs/hashicorp-vault \
--header 'Content-Type: application/json' \
--data '{
"name": "my-vault-sync",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "an example sync",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment": "dev",
"secretPath": "/",
"isEnabled": true,
"syncOptions": {
"initialSyncBehavior": "overwrite-destination"
},
"destinationConfig": {
"mount": "secret",
"path": "dev/nested"
}
}'
--url https://app.infisical.com/api/v1/secret-syncs/hashicorp-vault \
--header 'Content-Type: application/json' \
--data '{
"name": "my-vault-sync",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "an example sync",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment": "dev",
"secretPath": "/",
"isEnabled": true,
"syncOptions": {
"initialSyncBehavior": "overwrite-destination"
},
"destinationConfig": {
"mount": "secret",
"path": "dev/nested"
}
}'
```
### Sample response

View File

@@ -29,6 +29,7 @@ export const HCVaultSyncFields = () => {
<SecretSyncConnectionField
onChange={() => {
setValue("destinationConfig.mount", "");
setValue("destinationConfig.path", "");
}}
/>

View File

@@ -122,7 +122,7 @@ export const HCVaultConnectionForm = ({ appConnection, onSubmit }: Props) => {
tooltipClassName="max-w-sm"
tooltipText="The URL at which your Hashicorp Vault instance is hosted."
>
<Input {...field} placeholder="https://vault.mycompany.com" />
<Input {...field} placeholder="https://vault.example.com" />
</FormControl>
)}
/>