GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(credentials): saved PostgreSQL, MySQL, and SQL Server connections by waleedlatif1 · Pull Request #9929 · simstudioai/sim

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds saved database connections for PostgreSQL, MySQL and SQL Server under three new service-account provider ids (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.
  • Saving runs SELECT 1 through each family's own guarded connection path, so validateDatabaseHost, 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.
  • One list per provider (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' credentialSuppliedParams come 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.
  • The tools read the connection server-side inside the operation (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, like registerAwsFamily). A registry test fails if any tool that names a saved database connection runs outside a wrapped family.
  • New postgresql_v2, mysql_v2 and mssql_v2 blocks 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.
  • The Oracle lookup now goes through the shared owner-scoped secret read. Its behavior is unchanged.
  • Out of scope, with design notes: MongoDB, ClickHouse, Neo4j and IAM database auth (RDS, Cloud SQL, Entra).

Compatibility

  • Existing provider ids, stored secrets and legacy blocks are untouched. The new stored blobs keep their v1 shape, and the stored schemas accept the same fields and defaults as before.
  • The 18 postgresql_*, mysql_* and mssql_* tools now declare an optional saved credential. Besides gaining an optional credentialId, their Copilot and v2 schemas no longer list the connection fields (host, port, database, username, password, ssl or encrypt/trustServerCertificate) as required. Those fields are now checked at runtime by enforceCopilotCredentialSelection, which refuses a call that has neither a credentialId nor 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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • Unit tests in lib/credentials/database-connections/server.test.ts:
    • For each engine, a saved connection round-trips: save proves the exact login with SELECT 1, and a later run gets that login plus the stored TLS defaults.
    • For each engine, a run on a saved connection replaces exactly the params its tools declare as credential-supplied. A block-set SQL Server connection timeout is kept. Revert proof: building the SQL Server stored schema from the whole operation schema, or dropping a TLS field from the declared params, turns it red.
    • Invalid input is refused without connecting, and driver errors are kept out of messages.
    • A call without a credential passes through, and a credential for another service is ignored.
    • These return 403 without running: another engine's row, an organization row, a foreign blob type, an unknown stored field.
    • Abort is honored.
  • Saved-credential version cases were added for all three blocks.
  • 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.
  • Integration test lib/credentials/__integration__/database-connection.integration.ts runs against real Postgres through the registered postgresql_query operation. It checks that:
    • a valid save is accepted, and a save of a missing database is refused;
    • a run uses the saved connection despite bogus inline fields;
    • runs are refused in another workspace and after revocation.
  • Revert proof: weakening the field override or the service guard turns the matching tests red.
  • Checks run: biome, a type-check of the changed files, block-successors, tool-metadata, deployment-config, docs, boundaries, client-boundary, egress-boundary, tool-registry-boundary, unused-exports, explicit-any, source-conventions, file-names, utils, comment-hygiene, test-patterns, and check-block-registry against staging (saved-credential contract).
  • Reviewers should look at withSavedDatabaseConnection (field override and owner binding) and the TLS hints, which describe Sim's driver mapping:
    • MySQL Required checks the certificate chain but not the host name (like VERIFY_CA), and Preferred never falls back to plaintext.
    • SQL Server Encrypt requests TLS, but tedious continues unencrypted when the server answers NOT_SUP.
    • PostgreSQL Preferred can be downgraded by an on-path attacker.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
waleedlatif1 added 8 commits November 11, 2026 19:16
@waleedlatif1
refactor(credentials): share the owner-scoped service-account secret …
5685042
…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.
@waleedlatif1
feat(credentials): saved PostgreSQL, MySQL, and SQL Server connections
c26fded
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.
@waleedlatif1
feat(database-tools): run PostgreSQL, MySQL, and SQL Server tools on …
f0200f9
…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.
@waleedlatif1
feat(blocks): credential-only PostgreSQL, MySQL, and SQL Server blocks
b24abfe
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.
@waleedlatif1
docs(integrations): set up saved PostgreSQL, MySQL, and SQL Server co…
2352ecf
…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.
@waleedlatif1
refactor(database-tools): wrap SQL families at registration and deriv…
ba3661c
…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.
@waleedlatif1
fix(credentials): describe saved-connection TLS modes as the drivers …
895601a
…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.
@waleedlatif1
refactor(credentials): derive stored database connection fields and c…
ebb8686
…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.
@vercel

vercel Bot commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Nov 12, 2026 12:25pm UTC

Request Review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[High impact] Saved database credentials now reach PostgreSQL, MySQL, and SQL Server workflows.

The connection paths appear sound, but the required API documentation must be added before merging.

Findings

  1. P2 Provider helpers lack documentation ▶

Summary

Adds encrypted saved connections for PostgreSQL, MySQL, and SQL Server.

  • Admins can save PostgreSQL, MySQL, and SQL Server connections for reuse.
  • Database tools can run with saved logins or their existing inline fields.
  • New database blocks let workflow builders choose saved connections.
  • Oracle database credentials use the shared owner-scoped secret reader.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Connection details] --> B[Parse and check fields]
  B --> C[Guarded SELECT 1]
  C --> D[Encrypt and save]
  E[Workflow or tool call] --> F[Authorize credential]
  F --> G[Read live owner-scoped secret]
  D --> G
  G --> H[Replace connection fields]
  H --> I[Run database operation]
Loading

Reviews (2) · Last reviewed commit: "fix(credentials): validate the saved-con..." · Reviewed by Greptile

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Nov 12, 2026
View reviewed changes
Comment thread .../integrations/components/connect-service-account-modal/database-connection-account-modal.tsx Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview November 12, 2026 11:53
View deployment
cubic-dev-ai[bot]
cubic-dev-ai Bot reviewed Nov 12, 2026
View reviewed changes

@cubic-dev-ai cubic-dev-ai Bot left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 58 files

Confidence score: 4/5

  • database-connection.integration.ts ignores the host in TEST_DATABASE_URL, so valid IPv6 test environments may not run reliably. Derive the connection host and egress allowlist from databaseUrl.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>

Turn on auto-fix | Re-trigger cubic

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread apps/sim/lib/credentials/database-connections/descriptors.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/lib/credentials/application/provider-catalog.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/lib/credentials/__integration__/database-connection.integration.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/lib/credentials/__integration__/database-connection.integration.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

waleedlatif1 added 2 commits November 12, 2026 04:17
@waleedlatif1
Merge remote-tracking branch 'origin/staging' into feat/saved-databas…
506307d
…e-connections

# Conflicts:
#	apps/sim/tools/generated/tool-metadata.ts
@waleedlatif1
fix(credentials): validate the saved-connection port in the form and …
5142237
…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.
@vercel
vercel Bot deployed to Preview November 12, 2026 12:25
View deployment
@waleedlatif1

waleedlatif1 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1

waleedlatif1 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

cubic-dev-ai[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cubic-dev-ai[bot]
cubic-dev-ai Bot reviewed Nov 12, 2026
View reviewed changes

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 59 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
greptile-apps[bot]
greptile-apps Bot reviewed Nov 12, 2026
View reviewed changes
Comment thread apps/sim/lib/credentials/database-connections/descriptors.ts
Comment on lines +156 to +158
export function isDatabaseConnectionProviderId(
value: string | null | undefined
): value is DatabaseConnectionProviderId {

@greptile-apps greptile-apps Bot Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Provider helpers lack documentation

The new exported helpers isDatabaseConnectionProviderId and getDatabaseConnectionDescriptor have no TSDoc. The repository requires TSDoc on exported APIs, so this requirement must be satisfied before merging. Add short comments explaining which IDs they accept and what they return for missing or unknown IDs.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

This branch was successfully deployed

1 active deployment
Preview — 51422372 Deployed Nov 12, 2026 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@greptile-apps greptile-apps[bot] greptile-apps[bot] left review comments
@cubic-dev-ai cubic-dev-ai[bot] cubic-dev-ai[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@waleedlatif1
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.