Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(infisical): guard empty secretValue, validate version number, mov…
…e DELETE params to query string
  • Loading branch information
waleedlatif1 committed Mar 19, 2026
commit 0a16f691439ac48d2f2301381eb069c4df06a82b
7 changes: 5 additions & 2 deletions apps/sim/blocks/blocks/infisical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ export const InfisicalBlock: BlockConfig<InfisicalResponse> = {
break
case 'get_secret':
result.secretName = params.secretName
if (params.secretVersion) result.version = Number(params.secretVersion)
if (params.secretVersion) {
const v = Number(params.secretVersion)
if (!Number.isNaN(v)) result.version = v
}
break
case 'create_secret':
result.secretName = params.secretName
Expand All @@ -188,7 +191,7 @@ export const InfisicalBlock: BlockConfig<InfisicalResponse> = {
break
case 'update_secret':
result.secretName = params.secretName
if (params.updateSecretValue != null) result.secretValue = params.updateSecretValue
if (params.updateSecretValue) result.secretValue = params.updateSecretValue
if (params.secretComment != null) result.secretComment = params.secretComment
if (params.newSecretName) result.newSecretName = params.newSecretName
if (params.tagIds) result.tagIds = params.tagIds
Expand Down
21 changes: 9 additions & 12 deletions apps/sim/tools/infisical/delete_secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,18 @@ export const deleteSecretTool: ToolConfig<

request: {
method: 'DELETE',
url: (params) =>
`${params.baseUrl?.replace(/\/+$/, '') ?? 'https://us.infisical.com'}/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}`,
url: (params) => {
const searchParams = new URLSearchParams()
searchParams.set('projectId', params.projectId)
searchParams.set('environment', params.environment)
if (params.secretPath) searchParams.set('secretPath', params.secretPath)
if (params.type) searchParams.set('type', params.type)
const base = params.baseUrl?.replace(/\/+$/, '') ?? 'https://us.infisical.com'
return `${base}/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}?${searchParams.toString()}`
},
headers: (params) => ({
'Content-Type': 'application/json',
Authorization: `Bearer ${params.apiKey}`,
}),
body: (params) => {
const body: Record<string, unknown> = {
projectId: params.projectId,
environment: params.environment,
}
if (params.secretPath) body.secretPath = params.secretPath
if (params.type) body.type = params.type
return body
},
},
Comment thread
waleedlatif1 marked this conversation as resolved.

transformResponse: async (response) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/tools/infisical/update_secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const updateSecretTool: ToolConfig<
projectId: params.projectId,
environment: params.environment,
}
if (params.secretValue != null) body.secretValue = params.secretValue
if (params.secretValue) body.secretValue = params.secretValue
if (params.secretPath) body.secretPath = params.secretPath
if (params.secretComment != null) body.secretComment = params.secretComment
Comment thread
waleedlatif1 marked this conversation as resolved.
Outdated
if (params.newSecretName) body.newSecretName = params.newSecretName
Expand Down
Loading