MagicStack / MagicStack/asyncpg
.pgpass file support handles backslash escapes incorrectly; should de-escape values
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 8.1k
- Forks
- 468
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
https://www.postgresql.org/docs/current/libpq-pgpass.html isn't fully explicit about how to handle backslash escapes in the `.pgpass` file, however it's reasonably clear from the phrasing that backslashes serve only to escape backslashes and colons and therefore aren't considered part of the value they're used in. E.g., a `.pgpass` row of …
```
*:*:test\:db:test\\:password from pgpass with escapes
```
conveys:
- a database name of `test:db`, not `test\:db`
- a user name of `test\`, not `test\\`
I ran into this problem because I have a password of `4:K1…`, encoded as `4\:K1…`, and it works with `psql` but not `asyncpg`. Once I remove the backslash from `.pgpass`, it starts working with `asyncpg` but failing with `psql`.
I would've provided a failing test and even a code change, but I can't get `python setup.py test` or `pip install -e .[test]` to work in a run-of-the-mill Python 3.12 virtualenv on my run-of-the-mill MacOS.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das für `python setup.py test` oder `pip install -e .[test]` gemeldete Problem bei der Einrichtung der Python-3.12-Tests zu beheben, und ermittle anschließend die Verarbeitung von `.pgpass` in asyncpg. Füge Tests für maskierte Doppelpunkte und umgekehrte Schrägstriche hinzu, und betrachte das Issue als abgeschlossen, sobald diese Werte konsistent mit `psql` unmaskiert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- postgresql, python
- Bereich
- databases
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100