Skip to content

Security: RustedBytes/pg-phone

Security

docs/SECURITY.md

Security model

  • Phone parser input is limited to 256 bytes.
  • Extensions are limited to 32 ASCII digits.
  • Extraction input is limited to 1 MiB and 10,000 returned matches. Rejected candidates are capped at 10,000 for fixed-region extraction and 1,000 for the more CPU-intensive automatic-region extraction.
  • Binary payloads are limited to 256 bytes and validated before storage.
  • Invalid text uses SQLSTATE 22P02; invalid binary uses 22P03.
  • There is no network access, background worker, dynamic metadata loading, external carrier API, or SQL assembled from raw user text.
  • Network-catalog relation names are PostgreSQL regclass values and are schema-qualified with PostgreSQL's identifier-quoting routine before SPI use.
  • Catalog values are passed as typed SPI parameters.
  • Explicit unsafe code is confined to reading PostgreSQL-owned StringInfoData in the binary receive function; its pointer and length invariants are documented and bounded locally.

Five cargo-fuzz targets cover text, extensions, binary decoding plus subsequent operations, format selection, and regions. CI runs each target as a smoke test. The PostgreSQL upgrade test additionally feeds malformed binary COPY input and checks that the backend remains available.

Report security issues privately to the repository maintainers rather than opening a public issue containing exploit details.

There aren't any published security advisories