-
Notifications
You must be signed in to change notification settings - Fork 610
Preserve literal passwords in PostgreSQL service files #1631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,6 +22,9 @@ Features: | |||||||||
|
|
||||||||||
| Bug fixes: | ||||||||||
| ---------- | ||||||||||
| * Preserve hashes, percent signs, commas and quotes in service-file passwords, | ||||||||||
| matching libpq. Quotes around service-file values are now literal; remove | ||||||||||
| quotes previously added solely to escape ConfigObj syntax. | ||||||||||
|
Comment on lines
+25
to
+27
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would make it clearer that it's a breaking change. Also, I would not reference
Suggested change
@j-bennet: it's a (small) breaking change, I think it would warrant a new minor version (from 4.6.0 to 4.7.0). Do you agree? |
||||||||||
| * Fix special commands being broken while explain mode (F5) is on. Every input | ||||||||||
| was prefixed with ``EXPLAIN (...)`` and sent to the server as SQL, including | ||||||||||
| backslash commands and the bare words ``exit``/``quit``, so ``\q``, ``\d``, | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||
| from zoneinfo import ZoneInfoNotFoundError | ||||||
| from configobj import ConfigObj, ParseError | ||||||
| from configparser import ConfigParser | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd love to drop the |
||||||
| from pgspecial.namedqueries import NamedQueries | ||||||
| from .config import skip_initial_comment | ||||||
|
|
||||||
|
|
@@ -2213,14 +2213,13 @@ def parse_service_info(service): | |||||
| return None, service_file | ||||||
| with open(service_file, newline="") as f: | ||||||
| skipped_lines = skip_initial_comment(f) | ||||||
| try: | ||||||
| service_file_config = ConfigObj(f) | ||||||
| except ParseError as err: | ||||||
| err.line_number += skipped_lines | ||||||
| raise err | ||||||
| # libpq treats values literally: hashes, commas, quotes and percent | ||||||
| # signs are part of the value, not ConfigObj comments or syntax. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It makes sense in the diff, but it looks odd to reference
Suggested change
|
||||||
| service_file_config = ConfigParser(interpolation=None, delimiters=("=",), comment_prefixes=("#",)) | ||||||
| service_file_config.read_file(itertools.chain(itertools.repeat("\n", skipped_lines), f), source=service_file) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the use of |
||||||
| if service not in service_file_config: | ||||||
| return None, service_file | ||||||
| service_conf = service_file_config.get(service) | ||||||
| service_conf = service_file_config[service] | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This changes the behaviour: previously, The previous behaviour should be kept. |
||||||
| return service_conf, service_file | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the empty line above this line. Also, the "Codex-assisted" comment is not warranted. I appreciate that you mentioned it in the pull request description. But here in the changelog it's... you: I suppose that you do have an existence outside Codex. And who knows, maybe you could contribute without Codex, someday! ;)
(I suppose that Codex wrote that comment. That makes me a bit sad, actually.)