Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@phosphorco/effect-sql-pg

Latest version: v4.1.0-phosphorco.1795945544.g8d98c831100f

Overview

Last scanned
29 Nov 2026
Published
29 Nov 2026
npm package Publisher: colel, its-rosetta
176 Versions
33.1K Downloads

Scan summary

@phosphorco/effect-sql-pg was last scanned on 29 Nov 2026 at version 4.1.0-phosphorco.1795945544.g8d98c831100f. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 176 versions; the latest 5 were published within 2 days (28 and 29 Nov 2026).
  • Findings: No rules fired in version 4.1.0-phosphorco.1795945544.g8d98c831100f.
  • Downloads: 33,142 downloads.

Versions

176 versions published
Versions and the rules that fired in each
VersionPublishedStatus
4.1.0-phosphorco.1795945544.g8d98c831100f LATEST 29 Nov 2026 No rules fired
4.1.0-phosphorco.1795923043.gadec8a4a20c1 29 Nov 2026 No rules fired
4.1.0-phosphorco.1795915758.g3238226f7f97 29 Nov 2026 No rules fired
4.1.0-phosphorco.1795904886.g1a5a0c7b0d4e 29 Nov 2026 Not shown
4.1.0-phosphorco.1795896519.gefa339219a6d 28 Nov 2026 Not shown

No rules fired in 4.1.0-phosphorco.1795945544.g8d98c831100f

Findings

Findings for v4.1.0-phosphorco.1795945544.g8d98c831100f. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 4.1.0-phosphorco.1795945544.g8d98c831100f; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

@effect/sql-pg

An Effect SQL client for PostgreSQL with a native wire-protocol driver.

Installation

npm install effect @effect/sql-pg

Links

  • Website: documentation, guides, and news.
  • Reference: API documentation for this package.
  • Discord: ask questions, share what you're building, and talk to the core team.
  • Community: meetups and events, or bring Effect to your own.
  • Issues: bug reports and feature requests.

Let's talk

Whether your team is considering Effect, rolling it out, or already running it in production, we'd love to hear from you: what you're building, what works, and what you need from Effect next.

  • Talk to the maintainers. Introduce your team on Discord or email contact@effectful.co. We're happy to connect privately on Slack or Discord for feedback and help with adoption.
  • Production support. We're exploring how to better support teams running Effect in production. If your organization has specific support needs, let's discuss them.
  • Adoption help. Our adoption partners offer implementation, consulting, team extension, training, and commercial support.

Session defaults

Use startupParameters to establish PostgreSQL session defaults when each physical connection opens, including replacement connections in a pool:

import * as PgClient from "@phosphorco/effect-sql-pg/PgClient"
import * as Redacted from "@phosphorco/effect/Redacted"

const PostgresLive = PgClient.layer({
  url: Redacted.make("postgres://user:password@localhost/app"),
  startupParameters: {
    statement_timeout: "5s",
    search_path: "app, public"
  },
  startupOptions: "-c lock_timeout=1000"
})

These settings are sent in the startup packet. PostgreSQL's RESET ALL restores the startup defaults after session-level changes. Both PgConnection.Config and PgClientConfig accept these fields, and pools inherit them.

Parameter names are normalized to lowercase. Empty names and NUL bytes in names or values are rejected before connecting. The names user, database, replication, and options are reserved; use username, database, and startupOptions on the config for identity and opaque options. Replication mode is not supported through startupParameters. The driver accepts only UTF8 or UTF-8 (case-insensitive) for client_encoding and sends the canonical value UTF8. PostgreSQL validates other settings and reports invalid names or values at connect time.

The startupOptions field is an opaque PostgreSQL options string. It can also come from the URL query, for example ?options=-c%20statement_timeout%3D5000. Explicit config startupOptions overrides URL options, including when the explicit value is empty. The URL query key and startup packet field are both named options. Named parameters and opaque options can be sent together, but callers must not set the same GUC in both. The driver does not parse -c flags, detect conflicts, or read PGOPTIONS.

The startup application_name is selected in this order:

  1. Explicit applicationName
  2. startupParameters.application_name
  3. URL application_name
  4. "@effect/sql-pg"

The driver does not extract application_name from the opaque options string.

User-defined types

Columns whose type OID has no codec are decoded as UTF-8 text, so user-defined enums read as plain strings:

import * as PgClient from "@phosphorco/effect-sql-pg/PgClient"
import * as Effect from "@phosphorco/effect/Effect"

// CREATE TYPE capability AS ENUM ('use_key', 'manage')
const program = Effect.gen(function*() {
  const sql = yield* PgClient.PgClient
  const rows = yield* sql`SELECT 'use_key'::capability AS capability`
  // rows[0].capability === "use_key"
})

Strings bind to enum columns without any setup; the server infers the type.

The fallback applies to every OID without a codec, not only enums, and it has two failure modes:

  • Invalid UTF-8 fails with PgTypes.CodecError, as it does for text. A codec failure while reading a row is fatal to the connection, not just to the query: the socket is destroyed, every other query pipelined on that connection fails, an open transaction is lost, LISTEN channels on it are torn down, and the pool replaces the connection. Columns of a binary user-defined type such as a composite, a PostGIS geometry, or a pgvector vector hold bytes that are usually not valid UTF-8, so register a codec before querying them.
  • Bytes that happen to be valid UTF-8 decode as garbled text without any error. Arrays of user-defined types, including enum arrays, land here: the array header is all low bytes, so a capability[] column reads as a string of control characters followed by the labels.

Register a codec for a scalar user-defined type with PgTypes.register(oid, codec); registered codecs take precedence over the fallback. PgTypes.register cannot attach an array type. For arrays, create a registry, register the element codec with its arrayOid, and pass the registry to the client as types. The registry builds the array codec from the element codec:

import * as PgClient from "@phosphorco/effect-sql-pg/PgClient"
import * as PgTypes from "@phosphorco/effect-sql-pg/PgTypes"
import * as Redacted from "@phosphorco/effect/Redacted"
import * as Result from "@phosphorco/effect/Result"

// SELECT oid, typarray FROM pg_type WHERE typname = 'capability'
declare const capabilityOid: number
declare const capabilityArrayOid: number

const decoder = new TextDecoder("utf-8", { fatal: true })

const utf8: PgTypes.Codec<string> = {
  encode: (value) => Result.succeed(new TextEncoder().encode(value)),
  decode: (bytes) => {
    try {
      return Result.succeed(decoder.decode(bytes))
    } catch {
      return Result.fail(new PgTypes.CodecError({ message: "Invalid UTF-8 in capability" }))
    }
  }
}

const types = PgTypes.makeRegistry()
types.register(capabilityOid, utf8, { arrayOid: capabilityArrayOid })

const PostgresLive = PgClient.layer({
  url: Redacted.make("postgres://user:password@localhost/app"),
  types
})

OIDs of user-defined types are assigned per database, so look them up in pg_type at startup rather than hard-coding them.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @phosphorco/effect-sql-pg

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

Frame 2085668439 (1)
Group 1261154229