Skip to content

feat(fips): system-OpenSSL backend for sqlx Postgres authentication #6225

Backlog

Description

@akram

Part of the FIPS 140-3 umbrella (#6224).

Context

OpenShell talks to Postgres through sqlx. Depending on the server configuration, three code paths in sqlx-postgres perform crypto outside any validated module:

  • md5 password authentication (legacy servers): the password hash is computed with the RustCrypto md-5 crate.
  • SCRAM-SHA-256 authentication (the Postgres default): the SCRAM exchange uses the RustCrypto sha2 and hmac crates.
  • Advisory-lock session token: sqlx derives a per-connection token with HKDF, again over sha2/hmac.

Problem

These crates are unconditional dependencies of sqlx-postgres, so any FIPS-oriented build pulls non-module crypto into its production graph. The algorithms themselves (SHA-256, HMAC-SHA-256, HKDF, and even MD5 as required by the md5 auth protocol) are all available in the system OpenSSL module; only the implementation routing is missing.

Proposed approach

An additive, opt-in openssl feature on sqlx that routes the three code paths through the openssl crate (EVP interfaces):

  • default behavior and the default dependency graph unchanged,
  • when the feature is enabled, md-5, sha2 and hmac leave the graph of a consumer that enables it,
  • no API change.

The design is deliberately conservative: earlier discussions in transact-rs/sqlx favored keeping the default implementations untouched, and this change is invisible unless the feature is enabled.

Current state

A validated implementation exists at akram/sqlx, branch feat/openssl-md5-password. It has been exercised inside the OpenShell FIPS proof of feasibility: with the feature enabled, the gateway's production graph contains none of the RustCrypto crates above and the binary links the system libcrypto. An upstream PR based on this branch is being prepared.

Activity

  1. added
    state:triage-needed
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:triage-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions