You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e5af324
Browse filesBrowse the repository at this point in the historyBrowse files
feat(knowledge): let the S3 connector sync with a saved AWS credential (#9934)
* feat(connectors): sign S3 connector requests with a seeded AWS session
The S3 knowledge connector can now sign with keys a saved AWS credential
resolved to, read from the run's syncContext. STS session tokens are sent
as x-amz-security-token and included in the SigV4 signed headers. A saved
credential signs only for Amazon S3 in an AWS region: a custom endpoint is
refused so an AWS session never reaches an S3-compatible host. Inline keys
sign exactly as before.
* feat(knowledge): let a key connector sync with its declared saved credential
A key-based connector may now declare a saved-credential alternative
(auth.savedCredential); Amazon S3 declares a saved AWS credential. A row
that names a credential resolves it for the knowledge base's own scope
through the same owner check and STS exchange AWS tools use, and the
resolved session is seeded into syncContext. Rows that store a key keep
using it, and key-only connectors are unchanged.
- connectorUsesCredential/connectorHasAuthSource decide the auth source
in one place for the resolver, sync engine, validation and setup.
- resolveConnectorAccessToken takes the knowledge base scope.
- A run token reuses an STS session until shortly before it expires and
re-seeds syncContext when it is replaced.
- Setup with a saved credential is gated by the global
knowledge-connector-saved-credentials flag: workers from an earlier
release read a key connector without a key as credential-removed and
unschedule it, so the flag stays off until the release is live on the
app and Trigger.dev.
- The connector catalog and v2 contract gain optional savedCredential
and apiKeyOnly fields; generated OpenAPI, CLI API and CLI docs updated.
- Adds a central mock for @/lib/internal/aws/credentials.
* feat(knowledge): offer a saved AWS credential when setting up an S3 connector
When knowledge-connector-saved-credentials is on, the add-connector
modal lets Amazon S3 authenticate with a saved AWS credential instead of
its access keys, hides the key-only Access Key ID and custom endpoint
fields, and never sends values typed into them. The edit modal keeps the
credential replaceable for a connector that syncs with one, including
after its credential was removed. Inline keys stay the default.
* docs(knowledge): describe the S3 connector's saved AWS credential option
* fix(knowledge): refuse moving a stored-key connector onto its saved credential
The access update accepted a credentialId for a key connector that still
stored its key. The key stayed on the row and took over again, silently,
once the credential was deleted. Switching auth source now means creating
the connector anew, as it did before saved credentials.
* fix(knowledge): classify saved AWS credential failures and labels consistently
- Share the AWS failure message and transient check with the AWS tools, so
STS throttling or an IdP outage during setup is no longer a 400.
- Refuse another service's credential on S3 creation, as access updates do.
- Return an empty access token for a saved AWS credential, not its id.
- Record saved-credential connectors as authMode savedCredential in audit.
- Narrow savedCredential.provider to aws, the only provider that resolves.
- Derive create's key-vs-credential choice from connectorUsesCredential and
rename the run-token refresh.
* fix(connectors): sign saved AWS credentials only for commercial and GovCloud S3
China regions serve S3 under amazonaws.com.cn and the isolated partitions
under their own domains, so a saved credential for them failed with an
opaque DNS error. Refuse them with a clear message instead.
* docs(knowledge): state saved-credential availability and rollback limits
Catalog and connector credentialId descriptions say saved credentials work
once the deployment enables them, the connector credentialId field covers
saved credentials, and the flag notes that a release rollback is unsafe
once any connector uses one. Regenerates OpenAPI, CLI API and CLI docs.
* fix(knowledge): redact saved AWS session secrets and share the credential service check
A saved AWS credential resolves to an empty bearer with its secret key and
session token in awsSession, so redacting accessToken alone left them in
provider validation text. Both validation sites now redact every secret the
resolved token carries (connectorTokenSecrets).
Setup and access updates now share requireConnectorCredentialService, so a
key connector's saved-credential setup refuses a missing service config
instead of skipping the provider check.
* fix(knowledge): keep long-lived saved AWS keys per run and gate saved-credential edits on rollout
- Reuse a saved AWS credential without a session token for the whole run instead of reloading it on every page and hydration
- Hide the edit form's saved-credential replacement while saved-credential setup is disabled, matching the server gate
- Classify a connector whose credential service has no config as internal, not caller-fixable
- State in the v2 catalog that apiKey connectors with savedCredential accept credentialId
* docs(knowledge): describe the saved-credential provider as a service, not an OAuth service
* test(llm): mock AWS credentials through the central @sim/testing mock
|`--credential-id <value>`| No | OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types); omit it for `apiKey` connectors. |
1043
+
|`--credential-id <value>`| No | OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types), or, when this deployment enables it, a saved credential for an `apiKey` connector type that declares `auth.savedCredential` (such as Amazon S3 with a saved AWS credential); otherwise omit it for `apiKey` connectors. |
1044
1044
|`--api-key <value>`| No | Write-only API key for connector types whose `auth.mode` is `apiKey` (see connector types), or a personal access token for an OAuth connector that also accepts one, such as GitHub. Send it instead of `credentialId`. Pass a raw key, or a secret reference written as the whole value `{{SECRET_NAME}}`, which the server resolves; `$SECRET_NAME` is not a reference. |
1045
1045
|`--source-config <json\|@file>`| Yes | Connector-specific source selection and filtering configuration. (JSON, or @path / @- to read a file or stdin). |
1046
1046
|`--sync-interval-minutes <value>`| No | Scheduled synchronization interval in minutes; zero disables scheduling. Defaults to 1440. |
|`--credential-id <value>`| No | OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types); omit it for `apiKey` connectors. |
2648
+
|`--credential-id <value>`| No | OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types), or, when this deployment enables it, a saved credential for an `apiKey` connector type that declares `auth.savedCredential` (such as Amazon S3 with a saved AWS credential); otherwise omit it for `apiKey` connectors. |
2649
2649
|`--api-key <value>`| No | Write-only API key for connector types whose `auth.mode` is `apiKey` (see connector types), or a personal access token for an OAuth connector that also accepts one, such as GitHub. Send it instead of `credentialId`. Pass a raw key, or a secret reference written as the whole value `{{SECRET_NAME}}`, which the server resolves; `$SECRET_NAME` is not a reference. |
2650
2650
|`--source-config <json\|@file>`| Yes | Connector-specific source selection and filtering configuration. (JSON, or @path / @- to read a file or stdin). |
2651
2651
|`--sync-interval-minutes <value>`| No | Scheduled synchronization interval in minutes; zero disables scheduling. Defaults to 1440. |
Copy file name to clipboardExpand all lines: apps/docs/content/docs/knowledgebase/connectors.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ API-key and personal-access-token connections use the credential shown in their
46
46
| Azure DevOps | PAT with Project and Team Read, Wiki Read, Work Items Read, and Code Read. |
47
47
| GitLab | PAT with `read_api` and access to the selected project; permission-aware methods have additional requirements. |
48
48
| YouTube | YouTube Data API key from Google Cloud Console. |
49
-
| Amazon S3 | Secret Access Key; enter Access Key ID, region, and bucket as configuration fields. |
49
+
| Amazon S3 | Secret Access Key; enter Access Key ID, region, and bucket as configuration fields. Where enabled, **Authentication → Saved AWS credential** uses a workspace AWS credential instead (access keys, an assumed IAM role, or a keyless role trusted through Sim OIDC); it signs only for Amazon S3 in a commercial or GovCloud AWS region (not China or isolated regions), so it has no Access Key ID or custom endpoint. Either way, the identity needs `s3:ListBucket` on the bucket and `s3:GetObject` on the synced objects. |
50
50
| Sentry | Auth token with `project:read` and `event:read`. |
51
51
| PagerDuty | Create a [REST API key](https://support.pagerduty.com/main/docs/api-access-keys) under **Integrations → Developer Tools → API Access Keys**. |
52
52
| SFTP | Password or unencrypted private key, plus a required SHA-256 host-key fingerprint; enter host, port, username, and root path as configuration fields. |
Copy file name to clipboardExpand all lines: apps/docs/openapi-v2-knowledge.json
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6933,7 +6933,7 @@
6933
6933
"type": "null"
6934
6934
}
6935
6935
],
6936
-
"description": "OAuth credential identifier, or null for API-key and unauthenticated sources."
6936
+
"description": "OAuth credential identifier, or the saved credential an `apiKey` source syncs with (see `auth.savedCredential`); null for API-key and unauthenticated sources."
6937
6937
},
6938
6938
"sourceConfig": {
6939
6939
"type": "object",
@@ -7155,7 +7155,7 @@
7155
7155
"description": "Registered connector type."
7156
7156
},
7157
7157
"credentialId": {
7158
-
"description": "OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types); omit it for `apiKey` connectors.",
7158
+
"description": "OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types), or, when this deployment enables it, a saved credential for an `apiKey` connector type that declares `auth.savedCredential` (such as Amazon S3 with a saved AWS credential); otherwise omit it for `apiKey` connectors.",
7159
7159
"type": "string",
7160
7160
"minLength": 1,
7161
7161
"maxLength": 255
@@ -7331,7 +7331,7 @@
7331
7331
"type": "null"
7332
7332
}
7333
7333
],
7334
-
"description": "OAuth credential identifier, or null for API-key and unauthenticated sources."
7334
+
"description": "OAuth credential identifier, or the saved credential an `apiKey` source syncs with (see `auth.savedCredential`); null for API-key and unauthenticated sources."
Copy file name to clipboardExpand all lines: apps/docs/openapi-v2-resources.json
+23-3Lines changed: 23 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -21713,7 +21713,7 @@
21713
21713
"mode": {
21714
21714
"type": "string",
21715
21715
"const": "apiKey",
21716
-
"description": "Authenticates with a stored API key; pass `apiKey`, and no `credentialId`, when creating the connector."
21716
+
"description": "Authenticates with a stored API key; pass `apiKey` when creating the connector, or a saved `credentialId` instead when `savedCredential` is present."
21717
21717
},
21718
21718
"label": {
21719
21719
"description": "Label shown above the key field.",
@@ -21726,13 +21726,29 @@
21726
21726
"optional": {
21727
21727
"type": "boolean",
21728
21728
"description": "Whether the key may be left blank, for a source reachable without authentication."
21729
+
},
21730
+
"savedCredential": {
21731
+
"description": "When present, a saved credential of this service may be passed as `credentialId` instead of `apiKey`, once saved-credential setup is enabled on this deployment (until then it is refused with a validation error). Fields marked `apiKeyOnly` are then omitted.",
21732
+
"type": "object",
21733
+
"properties": {
21734
+
"provider": {
21735
+
"type": "string",
21736
+
"description": "Service the saved credential must authenticate with, e.g. `aws`."
21737
+
},
21738
+
"label": {
21739
+
"type": "string",
21740
+
"description": "Label for the saved-credential option."
21741
+
}
21742
+
},
21743
+
"required": ["provider", "label"],
21744
+
"additionalProperties": false
21729
21745
}
21730
21746
},
21731
21747
"required": ["mode", "optional"],
21732
21748
"additionalProperties": false
21733
21749
}
21734
21750
],
21735
-
"description": "How the connector authenticates against its source: `oauth` connectors take `credentialId` (GitHub also accepts a personal access token as `apiKey`), `apiKey` connectors take `apiKey`."
21751
+
"description": "How the connector authenticates against its source: `oauth` connectors take `credentialId` (GitHub also accepts a personal access token as `apiKey`), `apiKey` connectors take `apiKey` (or, when they declare `savedCredential`, a saved `credentialId`)."
21736
21752
},
21737
21753
"configFields": {
21738
21754
"type": "array",
@@ -21882,6 +21898,10 @@
21882
21898
"multi": {
21883
21899
"description": "When true the stored `sourceConfig` value is a `string[]`, not a `string`: a `selector` renders a multi-select picker and a `short-input` accepts a comma-separated list.",
21884
21900
"type": "boolean"
21901
+
},
21902
+
"apiKeyOnly": {
21903
+
"description": "When true the field describes the connector’s API key (such as its key ID or a custom host the key signs for). It is required as stated only with `apiKey`, and omitted when a saved `credentialId` is sent.",
21904
+
"type": "boolean"
21885
21905
}
21886
21906
},
21887
21907
"required": ["id", "title", "type"],
@@ -21910,7 +21930,7 @@
21910
21930
"mode": {
21911
21931
"type": "string",
21912
21932
"enum": ["oauth", "apiKey"],
21913
-
"description": "How the connector authenticates against its source: `oauth` connectors take `credentialId` (GitHub also accepts a personal access token as `apiKey`), `apiKey` connectors take `apiKey`."
21933
+
"description": "How the connector authenticates against its source: `oauth` connectors take `credentialId` (GitHub also accepts a personal access token as `apiKey`), `apiKey` connectors take `apiKey` (or, when they declare `savedCredential`, a saved `credentialId`)."
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/add-connector-modal/add-connector-modal.tsx
0 commit comments