Skip to content

Commit cfc7377

Browse files
committed
fix(infisical): rename tool files to underscores, add configurable baseUrl, fix error type casts
1 parent ca032c1 commit cfc7377

File tree

9 files changed

+228
-30
lines changed

9 files changed

+228
-30
lines changed

apps/docs/content/docs/en/tools/infisical.mdx

Lines changed: 161 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Manage secrets with Infisical
55

66
import { BlockInfoCard } from "@/components/ui/block-info-card"
77

8-
<BlockInfoCard
8+
<BlockInfoCard
99
type="infisical"
1010
color="#F7FE62"
1111
/>
@@ -24,6 +24,7 @@ With Infisical in Sim, you can:
2424
In Sim, the Infisical integration enables your agents to programmatically manage secrets as part of automated workflows — for example, rotating credentials, syncing environment variables across environments, or auditing secret usage. Simply configure the Infisical block with your API key, select the operation, and provide the project ID and environment slug to get started.
2525
{/* MANUAL-CONTENT-END */}
2626

27+
2728
## Usage Instructions
2829

2930
Integrate Infisical into your workflow. List, get, create, update, and delete secrets across project environments.
@@ -34,77 +35,221 @@ Integrate Infisical into your workflow. List, get, create, update, and delete se
3435

3536
### `infisical_list_secrets`
3637

38+
List all secrets in a project environment. Returns secret keys, values, comments, tags, and metadata.
39+
3740
#### Input
3841

3942
| Parameter | Type | Required | Description |
4043
| --------- | ---- | -------- | ----------- |
44+
| `apiKey` | string | Yes | Infisical API token |
45+
| `baseUrl` | string | No | Infisical instance URL \(default: "https://us.infisical.com"\). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL. |
46+
| `projectId` | string | Yes | The ID of the project to list secrets from |
47+
| `environment` | string | Yes | The environment slug \(e.g., "dev", "staging", "prod"\) |
48+
| `secretPath` | string | No | The path of the secrets \(default: "/"\) |
49+
| `recursive` | boolean | No | Whether to fetch secrets recursively from subdirectories |
50+
| `expandSecretReferences` | boolean | No | Whether to expand secret references \(default: true\) |
51+
| `viewSecretValue` | boolean | No | Whether to include secret values in the response \(default: true\) |
52+
| `includeImports` | boolean | No | Whether to include imported secrets \(default: true\) |
53+
| `tagSlugs` | string | No | Comma-separated tag slugs to filter secrets by |
4154

4255
#### Output
4356

4457
| Parameter | Type | Description |
4558
| --------- | ---- | ----------- |
46-
| `secrets` | json | Array of secrets \(list operation\) |
47-
| `count` | number | Number of secrets returned |
48-
| `secret` | json | Secret object \(get/create/update/delete operations\) |
59+
| `secrets` | array | Array of secrets |
60+
|`id` | string | Secret ID |
61+
|`workspace` | string | Workspace/project ID |
62+
|`secretKey` | string | Secret name/key |
63+
|`secretValue` | string | Secret value |
64+
|`secretComment` | string | Secret comment |
65+
|`secretPath` | string | Secret path |
66+
|`version` | number | Secret version |
67+
|`type` | string | Secret type \(shared or personal\) |
68+
|`environment` | string | Environment slug |
69+
|`tags` | array | Tags attached to the secret |
70+
|`id` | string | Tag ID |
71+
|`slug` | string | Tag slug |
72+
|`color` | string | Tag color |
73+
|`name` | string | Tag name |
74+
|`secretMetadata` | array | Custom metadata key-value pairs |
75+
|`key` | string | Metadata key |
76+
|`value` | string | Metadata value |
77+
|`createdAt` | string | Creation timestamp |
78+
|`updatedAt` | string | Last update timestamp |
79+
| `count` | number | Total number of secrets returned |
4980

5081
### `infisical_get_secret`
5182

83+
Retrieve a single secret by name from a project environment.
84+
5285
#### Input
5386

5487
| Parameter | Type | Required | Description |
5588
| --------- | ---- | -------- | ----------- |
89+
| `apiKey` | string | Yes | Infisical API token |
90+
| `baseUrl` | string | No | Infisical instance URL \(default: "https://us.infisical.com"\). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL. |
91+
| `projectId` | string | Yes | The ID of the project |
92+
| `environment` | string | Yes | The environment slug \(e.g., "dev", "staging", "prod"\) |
93+
| `secretName` | string | Yes | The name of the secret to retrieve |
94+
| `secretPath` | string | No | The path of the secret \(default: "/"\) |
95+
| `version` | number | No | Specific version of the secret to retrieve |
96+
| `type` | string | No | Secret type: "shared" or "personal" \(default: "shared"\) |
97+
| `viewSecretValue` | boolean | No | Whether to include the secret value in the response \(default: true\) |
98+
| `expandSecretReferences` | boolean | No | Whether to expand secret references \(default: true\) |
5699

57100
#### Output
58101

59102
| Parameter | Type | Description |
60103
| --------- | ---- | ----------- |
61-
| `secrets` | json | Array of secrets \(list operation\) |
62-
| `count` | number | Number of secrets returned |
63-
| `secret` | json | Secret object \(get/create/update/delete operations\) |
104+
| `secret` | object | The retrieved secret |
105+
|`id` | string | Secret ID |
106+
|`workspace` | string | Workspace/project ID |
107+
|`secretKey` | string | Secret name/key |
108+
|`secretValue` | string | Secret value |
109+
|`secretComment` | string | Secret comment |
110+
|`secretPath` | string | Secret path |
111+
|`version` | number | Secret version |
112+
|`type` | string | Secret type \(shared or personal\) |
113+
|`environment` | string | Environment slug |
114+
|`tags` | array | Tags attached to the secret |
115+
|`id` | string | Tag ID |
116+
|`slug` | string | Tag slug |
117+
|`color` | string | Tag color |
118+
|`name` | string | Tag name |
119+
|`secretMetadata` | array | Custom metadata key-value pairs |
120+
|`key` | string | Metadata key |
121+
|`value` | string | Metadata value |
122+
|`createdAt` | string | Creation timestamp |
123+
|`updatedAt` | string | Last update timestamp |
64124

65125
### `infisical_create_secret`
66126

127+
Create a new secret in a project environment.
128+
67129
#### Input
68130

69131
| Parameter | Type | Required | Description |
70132
| --------- | ---- | -------- | ----------- |
133+
| `apiKey` | string | Yes | Infisical API token |
134+
| `baseUrl` | string | No | Infisical instance URL \(default: "https://us.infisical.com"\). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL. |
135+
| `projectId` | string | Yes | The ID of the project |
136+
| `environment` | string | Yes | The environment slug \(e.g., "dev", "staging", "prod"\) |
137+
| `secretName` | string | Yes | The name of the secret to create |
138+
| `secretValue` | string | Yes | The value of the secret |
139+
| `secretPath` | string | No | The path for the secret \(default: "/"\) |
140+
| `secretComment` | string | No | A comment for the secret |
141+
| `type` | string | No | Secret type: "shared" or "personal" \(default: "shared"\) |
142+
| `tagIds` | string | No | Comma-separated tag IDs to attach to the secret |
71143

72144
#### Output
73145

74146
| Parameter | Type | Description |
75147
| --------- | ---- | ----------- |
76-
| `secrets` | json | Array of secrets \(list operation\) |
77-
| `count` | number | Number of secrets returned |
78-
| `secret` | json | Secret object \(get/create/update/delete operations\) |
148+
| `secret` | object | The created secret |
149+
|`id` | string | Secret ID |
150+
|`workspace` | string | Workspace/project ID |
151+
|`secretKey` | string | Secret name/key |
152+
|`secretValue` | string | Secret value |
153+
|`secretComment` | string | Secret comment |
154+
|`secretPath` | string | Secret path |
155+
|`version` | number | Secret version |
156+
|`type` | string | Secret type \(shared or personal\) |
157+
|`environment` | string | Environment slug |
158+
|`tags` | array | Tags attached to the secret |
159+
|`id` | string | Tag ID |
160+
|`slug` | string | Tag slug |
161+
|`color` | string | Tag color |
162+
|`name` | string | Tag name |
163+
|`secretMetadata` | array | Custom metadata key-value pairs |
164+
|`key` | string | Metadata key |
165+
|`value` | string | Metadata value |
166+
|`createdAt` | string | Creation timestamp |
167+
|`updatedAt` | string | Last update timestamp |
79168

80169
### `infisical_update_secret`
81170

171+
Update an existing secret in a project environment.
172+
82173
#### Input
83174

84175
| Parameter | Type | Required | Description |
85176
| --------- | ---- | -------- | ----------- |
177+
| `apiKey` | string | Yes | Infisical API token |
178+
| `baseUrl` | string | No | Infisical instance URL \(default: "https://us.infisical.com"\). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL. |
179+
| `projectId` | string | Yes | The ID of the project |
180+
| `environment` | string | Yes | The environment slug \(e.g., "dev", "staging", "prod"\) |
181+
| `secretName` | string | Yes | The name of the secret to update |
182+
| `secretValue` | string | No | The new value for the secret |
183+
| `secretPath` | string | No | The path of the secret \(default: "/"\) |
184+
| `secretComment` | string | No | A comment for the secret |
185+
| `newSecretName` | string | No | New name for the secret \(to rename it\) |
186+
| `type` | string | No | Secret type: "shared" or "personal" \(default: "shared"\) |
187+
| `tagIds` | string | No | Comma-separated tag IDs to set on the secret |
86188

87189
#### Output
88190

89191
| Parameter | Type | Description |
90192
| --------- | ---- | ----------- |
91-
| `secrets` | json | Array of secrets \(list operation\) |
92-
| `count` | number | Number of secrets returned |
93-
| `secret` | json | Secret object \(get/create/update/delete operations\) |
193+
| `secret` | object | The updated secret |
194+
|`id` | string | Secret ID |
195+
|`workspace` | string | Workspace/project ID |
196+
|`secretKey` | string | Secret name/key |
197+
|`secretValue` | string | Secret value |
198+
|`secretComment` | string | Secret comment |
199+
|`secretPath` | string | Secret path |
200+
|`version` | number | Secret version |
201+
|`type` | string | Secret type \(shared or personal\) |
202+
|`environment` | string | Environment slug |
203+
|`tags` | array | Tags attached to the secret |
204+
|`id` | string | Tag ID |
205+
|`slug` | string | Tag slug |
206+
|`color` | string | Tag color |
207+
|`name` | string | Tag name |
208+
|`secretMetadata` | array | Custom metadata key-value pairs |
209+
|`key` | string | Metadata key |
210+
|`value` | string | Metadata value |
211+
|`createdAt` | string | Creation timestamp |
212+
|`updatedAt` | string | Last update timestamp |
94213

95214
### `infisical_delete_secret`
96215

216+
Delete a secret from a project environment.
217+
97218
#### Input
98219

99220
| Parameter | Type | Required | Description |
100221
| --------- | ---- | -------- | ----------- |
222+
| `apiKey` | string | Yes | Infisical API token |
223+
| `baseUrl` | string | No | Infisical instance URL \(default: "https://us.infisical.com"\). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL. |
224+
| `projectId` | string | Yes | The ID of the project |
225+
| `environment` | string | Yes | The environment slug \(e.g., "dev", "staging", "prod"\) |
226+
| `secretName` | string | Yes | The name of the secret to delete |
227+
| `secretPath` | string | No | The path of the secret \(default: "/"\) |
228+
| `type` | string | No | Secret type: "shared" or "personal" \(default: "shared"\) |
101229

102230
#### Output
103231

104232
| Parameter | Type | Description |
105233
| --------- | ---- | ----------- |
106-
| `secrets` | json | Array of secrets \(list operation\) |
107-
| `count` | number | Number of secrets returned |
108-
| `secret` | json | Secret object \(get/create/update/delete operations\) |
234+
| `secret` | object | The deleted secret |
235+
|`id` | string | Secret ID |
236+
|`workspace` | string | Workspace/project ID |
237+
|`secretKey` | string | Secret name/key |
238+
|`secretValue` | string | Secret value |
239+
|`secretComment` | string | Secret comment |
240+
|`secretPath` | string | Secret path |
241+
|`version` | number | Secret version |
242+
|`type` | string | Secret type \(shared or personal\) |
243+
|`environment` | string | Environment slug |
244+
|`tags` | array | Tags attached to the secret |
245+
|`id` | string | Tag ID |
246+
|`slug` | string | Tag slug |
247+
|`color` | string | Tag color |
248+
|`name` | string | Tag name |
249+
|`secretMetadata` | array | Custom metadata key-value pairs |
250+
|`key` | string | Metadata key |
251+
|`value` | string | Metadata value |
252+
|`createdAt` | string | Creation timestamp |
253+
|`updatedAt` | string | Last update timestamp |
109254

110255

apps/sim/blocks/blocks/infisical.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ export const InfisicalBlock: BlockConfig<InfisicalResponse> = {
8989
mode: 'advanced',
9090
condition: { field: 'operation', value: 'update_secret' },
9191
},
92+
{
93+
id: 'baseUrl',
94+
title: 'Instance URL',
95+
type: 'short-input',
96+
placeholder: 'https://us.infisical.com (default)',
97+
mode: 'advanced',
98+
},
9299
{
93100
id: 'secretPath',
94101
title: 'Secret Path',
@@ -160,6 +167,7 @@ export const InfisicalBlock: BlockConfig<InfisicalResponse> = {
160167
environment: params.environment,
161168
}
162169

170+
if (params.baseUrl) result.baseUrl = params.baseUrl
163171
if (params.secretPath) result.secretPath = params.secretPath
164172

165173
switch (params.operation) {
@@ -197,6 +205,7 @@ export const InfisicalBlock: BlockConfig<InfisicalResponse> = {
197205
inputs: {
198206
operation: { type: 'string', description: 'Operation to perform' },
199207
apiKey: { type: 'string', description: 'Infisical API token' },
208+
baseUrl: { type: 'string', description: 'Infisical instance URL' },
200209
projectId: { type: 'string', description: 'Project ID' },
201210
environment: { type: 'string', description: 'Environment slug' },
202211
secretName: { type: 'string', description: 'Secret name' },
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const createSecretTool: ToolConfig<
2020
visibility: 'user-only',
2121
description: 'Infisical API token',
2222
},
23+
baseUrl: {
24+
type: 'string',
25+
required: false,
26+
visibility: 'user-or-llm',
27+
description:
28+
'Infisical instance URL (default: "https://us.infisical.com"). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL.',
29+
},
2330
projectId: {
2431
type: 'string',
2532
required: true,
@@ -73,7 +80,7 @@ export const createSecretTool: ToolConfig<
7380
request: {
7481
method: 'POST',
7582
url: (params) =>
76-
`https://us.infisical.com/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}`,
83+
`${params.baseUrl?.replace(/\/+$/, '') ?? 'https://us.infisical.com'}/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}`,
7784
headers: (params) => ({
7885
'Content-Type': 'application/json',
7986
Authorization: `Bearer ${params.apiKey}`,
@@ -99,7 +106,7 @@ export const createSecretTool: ToolConfig<
99106
if (!response.ok) {
100107
return {
101108
success: false,
102-
output: { secret: {} },
109+
output: { secret: {} as InfisicalCreateSecretResponse['output']['secret'] },
103110
error: data.message ?? `Request failed with status ${response.status}`,
104111
}
105112
}
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const deleteSecretTool: ToolConfig<
2020
visibility: 'user-only',
2121
description: 'Infisical API token',
2222
},
23+
baseUrl: {
24+
type: 'string',
25+
required: false,
26+
visibility: 'user-or-llm',
27+
description:
28+
'Infisical instance URL (default: "https://us.infisical.com"). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL.',
29+
},
2330
projectId: {
2431
type: 'string',
2532
required: true,
@@ -55,7 +62,7 @@ export const deleteSecretTool: ToolConfig<
5562
request: {
5663
method: 'DELETE',
5764
url: (params) =>
58-
`https://us.infisical.com/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}`,
65+
`${params.baseUrl?.replace(/\/+$/, '') ?? 'https://us.infisical.com'}/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}`,
5966
headers: (params) => ({
6067
'Content-Type': 'application/json',
6168
Authorization: `Bearer ${params.apiKey}`,
@@ -76,7 +83,7 @@ export const deleteSecretTool: ToolConfig<
7683
if (!response.ok) {
7784
return {
7885
success: false,
79-
output: { secret: {} },
86+
output: { secret: {} as InfisicalDeleteSecretResponse['output']['secret'] },
8087
error: data.message ?? `Request failed with status ${response.status}`,
8188
}
8289
}
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ export const getSecretTool: ToolConfig<InfisicalGetSecretParams, InfisicalGetSec
1414
visibility: 'user-only',
1515
description: 'Infisical API token',
1616
},
17+
baseUrl: {
18+
type: 'string',
19+
required: false,
20+
visibility: 'user-or-llm',
21+
description:
22+
'Infisical instance URL (default: "https://us.infisical.com"). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL.',
23+
},
1724
projectId: {
1825
type: 'string',
1926
required: true,
@@ -77,7 +84,8 @@ export const getSecretTool: ToolConfig<InfisicalGetSecretParams, InfisicalGetSec
7784
searchParams.set('viewSecretValue', String(params.viewSecretValue))
7885
if (params.expandSecretReferences != null)
7986
searchParams.set('expandSecretReferences', String(params.expandSecretReferences))
80-
return `https://us.infisical.com/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}?${searchParams.toString()}`
87+
const base = params.baseUrl?.replace(/\/+$/, '') ?? 'https://us.infisical.com'
88+
return `${base}/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}?${searchParams.toString()}`
8189
},
8290
headers: (params) => ({
8391
Authorization: `Bearer ${params.apiKey}`,
@@ -89,7 +97,7 @@ export const getSecretTool: ToolConfig<InfisicalGetSecretParams, InfisicalGetSec
8997
if (!response.ok) {
9098
return {
9199
success: false,
92-
output: { secret: {} },
100+
output: { secret: {} as InfisicalGetSecretResponse['output']['secret'] },
93101
error: data.message ?? `Request failed with status ${response.status}`,
94102
}
95103
}

apps/sim/tools/infisical/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { createSecretTool } from '@/tools/infisical/create-secret'
2-
import { deleteSecretTool } from '@/tools/infisical/delete-secret'
3-
import { getSecretTool } from '@/tools/infisical/get-secret'
4-
import { listSecretsTool } from '@/tools/infisical/list-secrets'
5-
import { updateSecretTool } from '@/tools/infisical/update-secret'
1+
import { createSecretTool } from '@/tools/infisical/create_secret'
2+
import { deleteSecretTool } from '@/tools/infisical/delete_secret'
3+
import { getSecretTool } from '@/tools/infisical/get_secret'
4+
import { listSecretsTool } from '@/tools/infisical/list_secrets'
5+
import { updateSecretTool } from '@/tools/infisical/update_secret'
66

77
export const infisicalListSecretsTool = listSecretsTool
88
export const infisicalGetSecretTool = getSecretTool
99
export const infisicalCreateSecretTool = createSecretTool
1010
export const infisicalUpdateSecretTool = updateSecretTool
1111
export const infisicalDeleteSecretTool = deleteSecretTool
12+
13+
export * from './types'

0 commit comments

Comments
 (0)