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 — fix: reject trailing data in IPv6 DSN hosts by henricop · Pull Request #1404 · MagicStack/asyncpg

Conversation

@henricop

@henricop henricop commented Nov 7, 2026

Copy link
Copy Markdown

Bracketed IPv6 DSN hosts now validate the complete host/port specification. For example, postgresql://user@[::1]:5432trailing/database previously matched only [::1]:5432, so the driver silently connected using the valid prefix. A nonnumeric port or a second port suffix could similarly fall back to the default or first port.

The host parser now uses re.fullmatch(). An empty port remains valid and selects the default: postgresql://user@[::1]:/database continues to work. This leaves valid-DSN query-port precedence unchanged; that is the separate scope of #1377.

The three malformed-host regressions fail on master, while the empty-port control passes there. The public asyncpg.connect() API also rejects each malformed URI with ClientConfigurationError.

Validation on macOS arm64 / Python 3.13.18 and native PostgreSQL 18.6:

  • make test PYTHON=.venv/bin/python: all three complete suites passed — asyncio debug, default asyncio, and uvloop. Each ran 380 cases with six skipped and no failures (120.677s / 112.217s / 110.770s).
  • Full Flake8 and mypy checks passed (27 source files); the complete test suites also run the repository's code-quality tests.

The first local full run exposed a missing pg_resetwal test utility in the isolated PostgreSQL installation. After providing it, the large-OID test passed and all three complete suites above passed. The skipped tests retain the suite's platform/dependency conditions.

Sorry, something went wrong.

Uh oh!

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

All reactions
@henricop
fix: reject trailing data in IPv6 DSN hosts
9477002

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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

@henricop
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.