Repository navigation
feat(credentials): saved PostgreSQL, MySQL, and SQL Server connections - #9929
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no blocking findings remain. SummaryAdds saved PostgreSQL, MySQL, and SQL Server connections with server-side reads and connection pickers.
|
There was a problem hiding this comment.
1 issue found across 58 files
Confidence score: 4/5
database-connection.integration.tsignores the host inTEST_DATABASE_URL, so valid IPv6 test environments may not run reliably. Derive the connection host and egress allowlist fromdatabaseUrl.hostname.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/credentials/__integration__/database-connection.integration.ts">
<violation number="1" location="apps/sim/lib/credentials/__integration__/database-connection.integration.ts:27">
P3: This fixture ignores the host from `TEST_DATABASE_URL`, so valid IPv6 test environments cannot run it reliably. Derive the connection host and the egress allowlist from `databaseUrl.hostname` (and preserve the URL’s bracketed IPv6 form).</violation>
</file>
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
5142237 to
63ff5a5
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
63ff5a5 to
b6854c7
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 59 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
b6854c7 to
73b1e58
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 60 files
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Turn on auto-fix | Re-trigger cubic
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 60 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Turn on auto-fix | Re-trigger cubic
…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.
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.
…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.
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.
…nnections 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.
…e 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.
…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.
…redential-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.
…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.
…onnection a server error
980a0e5 to
471705c
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 60 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Turn on auto-fix | Re-trigger cubic
…tion setting types
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 60 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Turn on auto-fix | Re-trigger cubic
Summary
postgresql-service-account,mysql-service-account,mssql-service-account). A connection stores host, port, database, login and password, plus the SSL mode (or SQL Server's encrypt and trust-certificate settings). It is modeled on the existing Oracle Database credential.SELECT 1through each family's own guarded connection path, sovalidateDatabaseHost, IP pinning and TLS match a real run. The connection is encrypted only after the database answers. Driver errors are never shown, and there is no connection cache.databaseConnectionFieldIds: the login fields plus the descriptor's TLS fields) says what a saved connection holds. The stored schema picks exactly those fields from the operation's own connection schema, with tighter bounds, and is strict. The tools'credentialSuppliedParamscome from the same list. The TLS values and defaults therefore have one source, and the modal's options are keyed by the same value types. A field added to an operation later (like SQL Server's per-block connection timeout) never enters the stored blob and is never pinned by a saved connection.withSavedDatabaseConnection), bound to the run's workspace or organization. It replaces every connection field in the call, so a caller or model cannot point a shared credential at another host. The three families are wrapped when they are registered (registerSavedDatabaseFamily, likeregisterAwsFamily). A registry test fails if any tool that names a saved database connection runs outside a wrapped family.postgresql_v2,mysql_v2andmssql_v2blocks offer only the connection picker. The legacy blocks keep their inline inputs and run unchanged; they are hidden from the toolbar and marked as replaced.Compatibility
postgresql_*,mysql_*andmssql_*tools now declare an optional saved credential. Besides gaining an optionalcredentialId, their Copilot and v2 schemas no longer list the connection fields (host, port, database, username, password, ssl or encrypt/trustServerCertificate) asrequired. Those fields are now checked at runtime byenforceCopilotCredentialSelection, which refuses a call that has neither acredentialIdnor the inline fields. This is the repo's documented hybrid-tool pattern.Product update (if relevant)
Workspace and organization admins can save a database connection once in Integrations and share it across workflows and agents, so the password no longer sits in block fields. Setup is documented on the PostgreSQL, MySQL and SQL Server integration pages, including what each TLS mode actually guarantees.
Type of Change
Testing
lib/credentials/database-connections/server.test.ts:SELECT 1, and a later run gets that login plus the stored TLS defaults.lib/internal/tool-operations/registry.server.test.ts: every tool whose provider is a saved-database service is registered in a wrapped family for that service. Revert proof: registering MySQL without the wrapper turns it red.lib/credentials/__integration__/database-connection.integration.tsruns against real Postgres through the registeredpostgresql_queryoperation. It checks that:check-block-registryagainst staging (saved-credential contract).withSavedDatabaseConnection(field override and owner binding) and the TLS hints, which describe Sim's driver mapping:VERIFY_CA), and Preferred never falls back to plaintext.NOT_SUP.Checklist
Screenshots/Videos