Repository navigation
Commit ef7bc52
authored
feat(credentials): saved PostgreSQL, MySQL, and SQL Server connections (#9929)
* refactor(credentials): share the owner-scoped service-account secret read
Oracle Database's saved-connection lookup now reads its row through one
owner-scoped helper, so the saved database connections that follow bind
to their owner and provider the same way instead of copying the query.
* feat(credentials): saved PostgreSQL, MySQL, and SQL Server connections
Adds three service-account providers (postgresql-, mysql-, and
mssql-service-account) that store a database connection: host, port,
database, login, password, and the SSL mode or SQL Server encrypt and
trust-certificate settings. Saving proves the connection with SELECT 1
through each family's own query operation, so host validation and IP
pinning match a real run, and only then encrypts it; driver errors are
never surfaced. The connection is read back inside the tool operation,
bound to the run's workspace or organization, by
withSavedDatabaseConnection, which replaces every connection field in the
call so a caller or model cannot steer a shared credential.
One client-safe descriptor table drives the provider ids, required
fields, provider catalog, token resolvers, secret builders, and a shared
connect modal.
* feat(database-tools): run PostgreSQL, MySQL, and SQL Server tools on a saved connection
Every PostgreSQL, MySQL, and SQL Server tool now declares an optional
service-account credential policy (required: false), so its inline
connection fields keep working unchanged and a saved connection can stand
in for them. The executor authorizes the selected credential and passes
it through trusted context; the family's operation handler, wrapped by
withSavedDatabaseConnection, reads the stored connection bound to the
run's owner and replaces every connection field before parsing. The
providers resolve inside the operation, like AWS, so they join
OPERATION_RESOLVED_CREDENTIAL_PROVIDERS.
A real-Postgres integration test saves a connection (SELECT 1 through
the guarded path), refuses one the server rejects, runs a query on the
saved connection whatever fields the call carries, and refuses it to
another workspace and once revoked.
* feat(blocks): credential-only PostgreSQL, MySQL, and SQL Server blocks
postgresql_v2, mysql_v2, and mssql_v2 spread their legacy blocks and swap
the connection fields (host, port, database, username, password, and SSL
mode or SQL Server encrypt and trust-certificate settings) for a saved
connection picker through withSavedCredential. Their canvas sentences
drop the database clause the block no longer holds.
The legacy blocks change only by hideFromToolbar and a legacy sunset
pointing at the successor, so existing workflows keep their inline
connection fields and run exactly as before. Generated block successors,
docs, icon maps, and deployment metadata are regenerated.
* docs(integrations): set up saved PostgreSQL, MySQL, and SQL Server connections
Each page's intro now explains adding a saved connection, how Sim proves
it before saving, what every SSL mode or SQL Server TLS setting does in
the runtime's drivers, and that existing workflows keep their inline
connection fields.
* refactor(database-tools): wrap SQL families at registration and derive saved-connection schemas from the operations
- Register the PostgreSQL, MySQL, and SQL Server families through
registerSavedDatabaseFamily, which applies withSavedDatabaseConnection and
records each tool id's service. A registry test now fails when a tool that
names a saved database connection runs outside a wrapped family, the case
the saved-credential contract skips for operation-resolved providers.
- Build the stored connection schemas from each operation's own connection
schema (bounds tightened, strict), so the TLS values and defaults have one
source. Stored blobs decode exactly as before.
- Reuse the SQL Server default connection timeout instead of repeating it,
and parse a submitted connection once.
- Unit tests prove save-then-run round trips and drive refusals through the
run wrapper; the workspace and revocation cases stay in the integration
test, which now runs through the registered operation.
* fix(credentials): describe saved-connection TLS modes as the drivers apply them
- MySQL Required verifies the certificate chain but not the host name (like
VERIFY_CA), and both Preferred and Required refuse a server without TLS.
- SQL Server Encrypt connection requests TLS; a server that does not support
encryption gets an unencrypted session rather than an error.
- PostgreSQL Preferred can be downgraded by an on-path attacker, so the hint
and docs steer to Required when the server supports TLS.
- Picker options are keyed by each operation schema's value type, so a mode
the operations add or drop fails to compile instead of drifting.
* refactor(credentials): derive stored database connection fields and credential-supplied params from one list
The stored v1 schema now picks exactly the descriptor's login and TLS fields
out of each operation schema instead of extending the whole schema, and the
tools' credentialSuppliedParams come from the same list. An operation field
added later can no longer change the stored blob, get pinned on every run,
or stay visible on the credential-only block.
* fix(credentials): validate the saved-connection port in the form and carry TLS tradeoffs into the provider catalog
The connection modal now refuses a port that is not a whole number from 1 to
65535 and says so beside the field, instead of a generic verify failure. The
v2 provider catalog hint for saved PostgreSQL, MySQL, and SQL Server
connections now includes each transport-security field's tradeoff, so API
callers see what Preferred, Encrypt, and Trust server certificate give up.
The integration fixture decodes the database name from TEST_DATABASE_URL.
* docs(credentials): document the database connection provider id helpers
* fix(credentials): keep an encryption failure on a verified database connection a server error
* docs(credentials): document the database connection descriptor and id types
* docs(databases): describe the PostgreSQL, MySQL and SQL Server connection setting types1 parent 21e32d7 commit ef7bc52
60 files changed
Lines changed: 2008 additions & 218 deletions
File tree
- apps
- docs
- components/ui
- content/docs/integrations
- sim
- app/workspace/[workspaceId]/integrations/components/connect-service-account-modal
- blocks
- blocks
- lib
- block-metadata
- credentials
- __integration__
- application
- database-connections
- integrations
- internal
- mssql
- mysql
- postgresql
- tool-operations
- oauth
- permission-groups
- serializer
- tools
- generated
- mssql
- mysql
- postgresql
- packages/deployment-config/src
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
630 | 630 | | |
631 | 631 | | |
632 | 632 | | |
| 633 | + | |
633 | 634 | | |
| 635 | + | |
634 | 636 | | |
635 | 637 | | |
636 | 638 | | |
| |||
668 | 670 | | |
669 | 671 | | |
670 | 672 | | |
| 673 | + | |
671 | 674 | | |
672 | 675 | | |
673 | 676 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
14 | 24 | | |
15 | 25 | | |
16 | 26 | | |
| |||
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 67 | | |
72 | 68 | | |
73 | 69 | | |
| |||
94 | 90 | | |
95 | 91 | | |
96 | 92 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | 93 | | |
105 | 94 | | |
106 | 95 | | |
| |||
128 | 117 | | |
129 | 118 | | |
130 | 119 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | 120 | | |
139 | 121 | | |
140 | 122 | | |
| |||
161 | 143 | | |
162 | 144 | | |
163 | 145 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | 146 | | |
172 | 147 | | |
173 | 148 | | |
| |||
193 | 168 | | |
194 | 169 | | |
195 | 170 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | 171 | | |
204 | 172 | | |
205 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
16 | 27 | | |
17 | 28 | | |
18 | 29 | | |
| |||
31 | 42 | | |
32 | 43 | | |
33 | 44 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
| |||
88 | 87 | | |
89 | 88 | | |
90 | 89 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | 90 | | |
98 | 91 | | |
99 | 92 | | |
| |||
118 | 111 | | |
119 | 112 | | |
120 | 113 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | 114 | | |
128 | 115 | | |
129 | 116 | | |
| |||
147 | 134 | | |
148 | 135 | | |
149 | 136 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | 137 | | |
157 | 138 | | |
158 | 139 | | |
| |||
175 | 156 | | |
176 | 157 | | |
177 | 158 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | 159 | | |
185 | 160 | | |
186 | 161 | | |
| |||
0 commit comments