Skip to content

ext/pdo: Hide DSNs in connection exception traces - #448

Closed
iliaal wants to merge 1 commit into
masterfrom
fix/aph-pdo-dsn-sensitive-84
Closed

iliaal wants to merge 1 commit into
masterfrom
fix/aph-pdo-dsn-sensitive-84

Conversation

@iliaal

@iliaal iliaal commented Nov 2, 2026

Copy link
Copy Markdown
Owner

DSNs can contain passwords, but PDO only marks the separate password argument sensitive. Both PDO::__construct() and PDO::connect() now redact the DSN in their exception frames, including inherited calls.

The omission surfaced during PDO review and reproduces with CLI exception traces, including SQLite driver failures.

A DSN may embed a password (password=... for most drivers, PWD=... for odbc),
so mark the $dsn argument of PDO::__construct() and PDO::connect() sensitive,
as $password already is. The Pdo\* driver subclasses inherit both methods and
get the same redaction.
@iliaal
iliaal changed the base branch from PHP-8.4 to master November 7, 2026 16:57
@iliaal
iliaal force-pushed the fix/aph-pdo-dsn-sensitive-84 branch from eeb732a to 7c3ae11 Compare November 7, 2026 16:57
@iliaal

iliaal commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Promoted upstream as php#25290.

@iliaal iliaal closed this Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant