Conversation
Backup (objects), Restore, Maintenance and Import/Export passed the target database in PGDATABASE, which libpq ranks below a dbname set in the server's service file, so with such a service file every job ran against the service file's database rather than the one selected. Pass it instead as --dbname "dbname='<name>'". libpq never expands a dbname given inside a connection string, so the protection against connection-string injection is kept, and an explicit --dbname takes precedence over the service file. Closes pgadmin-org#10463
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pgadmin-org/pgadmin4/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review. WalkthroughBackup, import/export, maintenance, and restore jobs pass the selected database as a quoted ChangesUtility database selection
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The utility jobs now explicitly target the selected database while preserving service-file settings. No actionable merge risk remains evident. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The selected database now takes precedence over the service file, while the database name is quoted to prevent it from supplying other connection settings. No introduced security issue was established, but execution and display behavior were not fully verified. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…hange. pgadmin.utils is imported by the documentation build, where libpq is not installed, so import psycopg's make_conninfo lazily. The database name is shown in the utility command again, so the XSS feature test once more checks that it is escaped there, rather than that it is absent.
Backup (objects), Restore, Maintenance and Import/Export passed the selected database in
PGDATABASE, but libpq ranks adbnamein the server's service file above that variable, so with such a service file every job silently ran against the service file's database.This passes the database as
--dbname "dbname='<name>'"instead, built by a newdatabase_conninfo()helper using psycopg'smake_conninfo(). libpq never expands adbnamegiven inside a connection string, so the connection-string injection protection from 5082834 is kept, whilst an explicit--dbnamebeats the service file.Test plan
--dbnameargument (including the injection payload cases).utils/tests/test_database_conninfo.py: round-trips awkward names (spaces, quotes, backslashes,host=..., URIs) through libpq's parser, and connects with a service file whosedbnamediffers to confirm the chosen database wins.backup,restore,maintenanceandimport_exporttest packages pass locally against PostgreSQL 18.Closes #10463
Summary by CodeRabbit