Skip to content

[SECURITY] Make unauthenticated pgwire exposure an explicit operator choice #814

Open

Description

@jeffreyaven

Related upstream work

The TLS negotiation ticket is related work, not a prerequisite for safe bind defaults or explicit unauthenticated exposure. No blocked-by relationship is added for this link.

Constituent of #769. Reviewed current main at 1de4135 on 2026-10-08; this issue proposes work, no implementation is included.

CWEs: CWE-306, CWE-1188.

Source: GitHub Security Lab finding 21530, originally tested at adc0956, plus current-code review and the validation below. Credit: GitHub Security Lab Taskflow Agent, GitHub Secure Open Source Fund, reported by @JarLob.

Finding and evidence

stackql srv defaults to 0.0.0.0 and accepts arbitrary startup usernames without a password exchange. Server TLS alone does not authenticate clients; mTLS is enforced only when clientCAs is configured.

Current-build loopback probe sent a PostgreSQL startup packet with user=made-up-user, received AuthenticationOk without a challenge, and successfully executed SELECT 1. The listener was deliberately bound to loopback for this test; the all-interface default was verified in source. Reachable clients run provider calls under the operator's credentials.

Required outcome

  • Default to loopback and require configured client authentication, or explicit unauthenticated opt-in, for wider exposure. Define handling of wildcard, hostname, IPv4 and IPv6 binds without a string-only loopback test.
  • Keep existing mTLS deployments working. If password authentication is added, require protected transport and avoid passwords in arguments/logs; a new authentication mechanism is not required merely to fix defaults.
  • Update the Docker default command and server/audit examples consistently. A compose service bound only to loopback cannot serve sibling containers; use authentication or a clearly documented explicit opt-in on that network.

Validation and acceptance

Add black-box pgwire tests for default bind, anonymous/wrong-credential refusal when authentication is required, mTLS success/failure, explicit insecure opt-in, and IPv4/IPv6/hostname configuration. Verify container startup and document migration for existing deployments.

Scope and related work

This is connection authentication and exposure, not per-user authorization (#312). #366 addresses additional TLS behaviors. The image's non-root user is a separate hardening item. PR #804 improved README guidance but left this behavior unchanged.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions