Skip to content

Commit ed47ae1

Browse files
committed
feat(secrets-manager): add AWS Secrets Manager integration
1 parent 4544fd4 commit ed47ae1

File tree

25 files changed

+2028
-65
lines changed

25 files changed

+2028
-65
lines changed

apps/docs/components/icons.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4502,6 +4502,24 @@ export function DynamoDBIcon(props: SVGProps<SVGSVGElement>) {
45024502
)
45034503
}
45044504

4505+
export function SecretsManagerIcon(props: SVGProps<SVGSVGElement>) {
4506+
return (
4507+
<svg {...props} viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'>
4508+
<defs>
4509+
<linearGradient x1='0%' y1='100%' x2='100%' y2='0%' id='secretsManagerGradient'>
4510+
<stop stopColor='#BD0816' offset='0%' />
4511+
<stop stopColor='#FF5252' offset='100%' />
4512+
</linearGradient>
4513+
</defs>
4514+
<rect fill='url(#secretsManagerGradient)' width='80' height='80' />
4515+
<path
4516+
d='M38.76,43.36 C38.76,44.044 39.317,44.6 40,44.6 C40.684,44.6 41.24,44.044 41.24,43.36 C41.24,42.676 40.684,42.12 40,42.12 C39.317,42.12 38.76,42.676 38.76,43.36 L38.76,43.36 Z M36.76,43.36 C36.76,41.573 38.213,40.12 40,40.12 C41.787,40.12 43.24,41.573 43.24,43.36 C43.24,44.796 42.296,46.002 41,46.426 L41,49 L39,49 L39,46.426 C37.704,46.002 36.76,44.796 36.76,43.36 L36.76,43.36 Z M49,38 L31,38 L31,51 L49,51 L49,48 L46,48 L46,46 L49,46 L49,43 L46,43 L46,41 L49,41 L49,38 Z M34,36 L45.999,36 L46,31 C46.001,28.384 43.143,26.002 40.004,26 L40.001,26 C38.472,26 36.928,26.574 35.763,27.575 C34.643,28.537 34,29.786 34,31.001 L34,36 Z M48,31.001 L47.999,36 L50,36 C50.553,36 51,36.448 51,37 L51,52 C51,52.552 50.553,53 50,53 L30,53 C29.447,53 29,52.552 29,52 L29,37 C29,36.448 29.447,36 30,36 L32,36 L32,31 C32.001,29.202 32.897,27.401 34.459,26.058 C35.982,24.75 38.001,24 40.001,24 L40.004,24 C44.265,24.002 48.001,27.273 48,31.001 L48,31.001 Z M19.207,55.049 L20.828,53.877 C18.093,50.097 16.581,45.662 16.396,41 L19,41 L19,39 L16.399,39 C16.598,34.366 18.108,29.957 20.828,26.198 L19.207,25.025 C16.239,29.128 14.599,33.942 14.399,39 L12,39 L12,41 L14.396,41 C14.582,46.086 16.224,50.926 19.207,55.049 L19.207,55.049 Z M53.838,59.208 C50.069,61.936 45.648,63.446 41,63.639 L41,61 L39,61 L39,63.639 C34.352,63.447 29.93,61.937 26.159,59.208 L24.988,60.828 C29.1,63.805 33.928,65.445 39,65.639 L39,68 L41,68 L41,65.639 C46.072,65.445 50.898,63.805 55.01,60.828 L53.838,59.208 Z M26.159,20.866 C29.93,18.138 34.352,16.628 39,16.436 L39,19 L41,19 L41,16.436 C45.648,16.628 50.069,18.138 53.838,20.866 L55.01,19.246 C50.898,16.27 46.072,14.63 41,14.436 L41,12 L39,12 L39,14.436 C33.928,14.629 29.1,16.269 24.988,19.246 L26.159,20.866 Z M65.599,39 C65.399,33.942 63.759,29.128 60.79,25.025 L59.169,26.198 C61.89,29.957 63.4,34.366 63.599,39 L61,39 L61,41 L63.602,41 C63.416,45.662 61.905,50.097 59.169,53.877 L60.79,55.049 C63.774,50.926 65.415,46.086 65.602,41 L68,41 L68,39 L65.599,39 Z M56.386,25.064 L64.226,17.224 L62.812,15.81 L54.972,23.65 L56.386,25.064 Z M23.612,55.01 L15.772,62.85 L17.186,64.264 L25.026,56.424 L23.612,55.01 Z M28.666,27.253 L13.825,12.413 L12.411,13.827 L27.252,28.667 L28.666,27.253 Z M54.193,52.78 L67.586,66.173 L66.172,67.587 L52.779,54.194 L54.193,52.78 Z'
4517+
fill='#FFFFFF'
4518+
/>
4519+
</svg>
4520+
)
4521+
}
4522+
45054523
export function SQSIcon(props: SVGProps<SVGSVGElement>) {
45064524
return (
45074525
<svg

apps/docs/components/ui/icon-mapping.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ import {
140140
S3Icon,
141141
SalesforceIcon,
142142
SearchIcon,
143+
SecretsManagerIcon,
143144
SendgridIcon,
144145
SentryIcon,
145146
SerperIcon,
@@ -317,6 +318,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
317318
s3: S3Icon,
318319
salesforce: SalesforceIcon,
319320
search: SearchIcon,
321+
secrets_manager: SecretsManagerIcon,
320322
sendgrid: SendgridIcon,
321323
sentry: SentryIcon,
322324
serper: SerperIcon,

apps/docs/content/docs/en/tools/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
"s3",
136136
"salesforce",
137137
"search",
138+
"secrets_manager",
138139
"sendgrid",
139140
"sentry",
140141
"serper",
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
title: AWS Secrets Manager
3+
description: Connect to AWS Secrets Manager
4+
---
5+
6+
import { BlockInfoCard } from "@/components/ui/block-info-card"
7+
8+
<BlockInfoCard
9+
type="secrets_manager"
10+
color="linear-gradient(45deg, #BD0816 0%, #FF5252 100%)"
11+
/>
12+
13+
{/* MANUAL-CONTENT-START:intro */}
14+
[AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) is a secrets management service that helps you protect access to your applications, services, and IT resources. It enables you to rotate, manage, and retrieve database credentials, API keys, and other secrets throughout their lifecycle.
15+
16+
With AWS Secrets Manager, you can:
17+
18+
- **Securely store secrets**: Encrypt secrets at rest using AWS KMS encryption keys
19+
- **Retrieve secrets programmatically**: Access secrets from your applications and workflows without hardcoding credentials
20+
- **Rotate secrets automatically**: Configure automatic rotation for supported services like RDS, Redshift, and DocumentDB
21+
- **Audit access**: Track secret access and changes through AWS CloudTrail integration
22+
- **Control access with IAM**: Use fine-grained IAM policies to manage who can access which secrets
23+
- **Replicate across regions**: Automatically replicate secrets to multiple AWS regions for disaster recovery
24+
25+
In Sim, the AWS Secrets Manager integration allows your workflows to securely retrieve credentials and configuration values at runtime, create and manage secrets as part of automation pipelines, and maintain a centralized secrets store that your agents can access. This is particularly useful for workflows that need to authenticate with external services, rotate credentials, or manage sensitive configuration across environments — all without exposing secrets in your workflow definitions.
26+
{/* MANUAL-CONTENT-END */}
27+
28+
29+
## Usage Instructions
30+
31+
Integrate AWS Secrets Manager into the workflow. Can retrieve, create, update, list, and delete secrets.
32+
33+
34+
35+
## Tools
36+
37+
### `secrets_manager_get_secret`
38+
39+
Retrieve a secret value from AWS Secrets Manager
40+
41+
#### Input
42+
43+
| Parameter | Type | Required | Description |
44+
| --------- | ---- | -------- | ----------- |
45+
| `region` | string | Yes | AWS region \(e.g., us-east-1\) |
46+
| `accessKeyId` | string | Yes | AWS access key ID |
47+
| `secretAccessKey` | string | Yes | AWS secret access key |
48+
| `secretId` | string | Yes | The name or ARN of the secret to retrieve |
49+
| `versionId` | string | No | The unique identifier of the version to retrieve |
50+
| `versionStage` | string | No | The staging label of the version to retrieve \(e.g., AWSCURRENT, AWSPREVIOUS\) |
51+
52+
#### Output
53+
54+
| Parameter | Type | Description |
55+
| --------- | ---- | ----------- |
56+
| `name` | string | Name of the secret |
57+
| `secretValue` | string | The decrypted secret value |
58+
| `arn` | string | ARN of the secret |
59+
| `versionId` | string | Version ID of the secret |
60+
| `versionStages` | array | Staging labels attached to this version |
61+
| `createdDate` | string | Date the secret was created |
62+
63+
### `secrets_manager_list_secrets`
64+
65+
List secrets stored in AWS Secrets Manager
66+
67+
#### Input
68+
69+
| Parameter | Type | Required | Description |
70+
| --------- | ---- | -------- | ----------- |
71+
| `region` | string | Yes | AWS region \(e.g., us-east-1\) |
72+
| `accessKeyId` | string | Yes | AWS access key ID |
73+
| `secretAccessKey` | string | Yes | AWS secret access key |
74+
| `maxResults` | number | No | Maximum number of secrets to return \(1-100, default 100\) |
75+
| `nextToken` | string | No | Pagination token from a previous request |
76+
77+
#### Output
78+
79+
| Parameter | Type | Description |
80+
| --------- | ---- | ----------- |
81+
| `secrets` | json | List of secrets with name, ARN, description, and dates |
82+
| `nextToken` | string | Pagination token for the next page of results |
83+
| `count` | number | Number of secrets returned |
84+
85+
### `secrets_manager_create_secret`
86+
87+
Create a new secret in AWS Secrets Manager
88+
89+
#### Input
90+
91+
| Parameter | Type | Required | Description |
92+
| --------- | ---- | -------- | ----------- |
93+
| `region` | string | Yes | AWS region \(e.g., us-east-1\) |
94+
| `accessKeyId` | string | Yes | AWS access key ID |
95+
| `secretAccessKey` | string | Yes | AWS secret access key |
96+
| `name` | string | Yes | Name of the secret to create |
97+
| `secretValue` | string | Yes | The secret value \(plain text or JSON string\) |
98+
| `description` | string | No | Description of the secret |
99+
100+
#### Output
101+
102+
| Parameter | Type | Description |
103+
| --------- | ---- | ----------- |
104+
| `message` | string | Operation status message |
105+
| `name` | string | Name of the created secret |
106+
| `arn` | string | ARN of the created secret |
107+
| `versionId` | string | Version ID of the created secret |
108+
109+
### `secrets_manager_update_secret`
110+
111+
Update the value of an existing secret in AWS Secrets Manager
112+
113+
#### Input
114+
115+
| Parameter | Type | Required | Description |
116+
| --------- | ---- | -------- | ----------- |
117+
| `region` | string | Yes | AWS region \(e.g., us-east-1\) |
118+
| `accessKeyId` | string | Yes | AWS access key ID |
119+
| `secretAccessKey` | string | Yes | AWS secret access key |
120+
| `secretId` | string | Yes | The name or ARN of the secret to update |
121+
| `secretValue` | string | Yes | The new secret value \(plain text or JSON string\) |
122+
| `description` | string | No | Updated description of the secret |
123+
124+
#### Output
125+
126+
| Parameter | Type | Description |
127+
| --------- | ---- | ----------- |
128+
| `message` | string | Operation status message |
129+
| `name` | string | Name of the updated secret |
130+
| `arn` | string | ARN of the updated secret |
131+
| `versionId` | string | Version ID of the updated secret |
132+
133+
### `secrets_manager_delete_secret`
134+
135+
Delete a secret from AWS Secrets Manager
136+
137+
#### Input
138+
139+
| Parameter | Type | Required | Description |
140+
| --------- | ---- | -------- | ----------- |
141+
| `region` | string | Yes | AWS region \(e.g., us-east-1\) |
142+
| `accessKeyId` | string | Yes | AWS access key ID |
143+
| `secretAccessKey` | string | Yes | AWS secret access key |
144+
| `secretId` | string | Yes | The name or ARN of the secret to delete |
145+
| `recoveryWindowInDays` | number | No | Number of days before permanent deletion \(7-30, default 30\) |
146+
| `forceDelete` | boolean | No | If true, immediately delete without recovery window |
147+
148+
#### Output
149+
150+
| Parameter | Type | Description |
151+
| --------- | ---- | ----------- |
152+
| `message` | string | Operation status message |
153+
| `name` | string | Name of the deleted secret |
154+
| `arn` | string | ARN of the deleted secret |
155+
| `deletionDate` | string | Scheduled deletion date |
156+
157+

apps/sim/app/(landing)/integrations/data/icon-mapping.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ import {
140140
S3Icon,
141141
SalesforceIcon,
142142
SearchIcon,
143+
SecretsManagerIcon,
143144
SendgridIcon,
144145
SentryIcon,
145146
SerperIcon,
@@ -317,6 +318,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
317318
s3: S3Icon,
318319
salesforce: SalesforceIcon,
319320
search: SearchIcon,
321+
secrets_manager: SecretsManagerIcon,
320322
sendgrid: SendgridIcon,
321323
sentry: SentryIcon,
322324
serper: SerperIcon,

apps/sim/app/(landing)/integrations/data/integrations.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,45 @@
11381138
"integrationType": "crm",
11391139
"tags": ["sales-engagement", "enrichment"]
11401140
},
1141+
{
1142+
"type": "secrets_manager",
1143+
"slug": "aws-secrets-manager",
1144+
"name": "AWS Secrets Manager",
1145+
"description": "Connect to AWS Secrets Manager",
1146+
"longDescription": "Integrate AWS Secrets Manager into the workflow. Can retrieve, create, update, list, and delete secrets.",
1147+
"bgColor": "linear-gradient(45deg, #BD0816 0%, #FF5252 100%)",
1148+
"iconName": "SecretsManagerIcon",
1149+
"docsUrl": "https://docs.sim.ai/tools/secrets-manager",
1150+
"operations": [
1151+
{
1152+
"name": "Get Secret",
1153+
"description": "Retrieve a secret value from AWS Secrets Manager"
1154+
},
1155+
{
1156+
"name": "List Secrets",
1157+
"description": "List secrets stored in AWS Secrets Manager"
1158+
},
1159+
{
1160+
"name": "Create Secret",
1161+
"description": "Create a new secret in AWS Secrets Manager"
1162+
},
1163+
{
1164+
"name": "Update Secret",
1165+
"description": "Update the value of an existing secret in AWS Secrets Manager"
1166+
},
1167+
{
1168+
"name": "Delete Secret",
1169+
"description": "Delete a secret from AWS Secrets Manager"
1170+
}
1171+
],
1172+
"operationCount": 5,
1173+
"triggers": [],
1174+
"triggerCount": 0,
1175+
"authType": "none",
1176+
"category": "tools",
1177+
"integrationType": "developer-tools",
1178+
"tags": ["cloud", "secrets-management"]
1179+
},
11411180
{
11421181
"type": "textract_v2",
11431182
"slug": "aws-textract",
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { randomUUID } from 'crypto'
2+
import { createLogger } from '@sim/logger'
3+
import { type NextRequest, NextResponse } from 'next/server'
4+
import { z } from 'zod'
5+
import { checkInternalAuth } from '@/lib/auth/hybrid'
6+
import { createSecret, createSecretsManagerClient } from '../utils'
7+
8+
const logger = createLogger('SecretsManagerCreateSecretAPI')
9+
10+
const CreateSecretSchema = z.object({
11+
region: z.string().min(1, 'AWS region is required'),
12+
accessKeyId: z.string().min(1, 'AWS access key ID is required'),
13+
secretAccessKey: z.string().min(1, 'AWS secret access key is required'),
14+
name: z.string().min(1, 'Secret name is required'),
15+
secretValue: z.string().min(1, 'Secret value is required'),
16+
description: z.string().nullish(),
17+
})
18+
19+
export async function POST(request: NextRequest) {
20+
const requestId = randomUUID().slice(0, 8)
21+
22+
const auth = await checkInternalAuth(request)
23+
if (!auth.success || !auth.userId) {
24+
return NextResponse.json({ error: auth.error || 'Unauthorized' }, { status: 401 })
25+
}
26+
27+
try {
28+
const body = await request.json()
29+
const params = CreateSecretSchema.parse(body)
30+
31+
logger.info(`[${requestId}] Creating secret ${params.name}`)
32+
33+
const client = createSecretsManagerClient({
34+
region: params.region,
35+
accessKeyId: params.accessKeyId,
36+
secretAccessKey: params.secretAccessKey,
37+
})
38+
39+
try {
40+
const result = await createSecret(client, params.name, params.secretValue, params.description)
41+
42+
logger.info(`[${requestId}] Secret created: ${result.name}`)
43+
44+
return NextResponse.json({
45+
message: `Secret "${result.name}" created successfully`,
46+
...result,
47+
})
48+
} finally {
49+
client.destroy()
50+
}
51+
} catch (error) {
52+
if (error instanceof z.ZodError) {
53+
logger.warn(`[${requestId}] Invalid request data`, { errors: error.errors })
54+
return NextResponse.json(
55+
{ error: 'Invalid request data', details: error.errors },
56+
{ status: 400 }
57+
)
58+
}
59+
60+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'
61+
logger.error(`[${requestId}] Failed to create secret:`, error)
62+
63+
return NextResponse.json({ error: `Failed to create secret: ${errorMessage}` }, { status: 500 })
64+
}
65+
}

0 commit comments

Comments
 (0)