-
Notifications
You must be signed in to change notification settings - Fork 417
WIP: Add Testing Failcase for DSN Parsing #1159
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No 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? No Sign in to your account
Closed
ranchodeluxe
wants to merge
4
commits into
MagicStack:master
from
ranchodeluxe:gc/bad_characters_in_password
Closed
WIP: Add Testing Failcase for DSN Parsing #1159
ranchodeluxe
wants to merge
4
commits into
MagicStack:master
from
ranchodeluxe:gc/bad_characters_in_password
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to get this test passing locally using the testing infrastructure I had to:
revised passing test {
'name': 'dsn_bad_characters_maybe',
'dsn': 'postgres://eoapi:a2Vw%3Ayk%3D%29CdSis%5Bfek%5DtW%3D@eoapi-primary.default.svc:5432/eoapi',
'result': ([('eoapi-primary.default.svc', 5432)], {
'user': 'eoapi',
'password': 'a2Vw:yk=)CdSis[fek]tW=',
'database': 'eoapi',
'ssl': True,
'sslmode': SSLMode.prefer
,
'target_session_attrs': 'any'})
}, |
I see we have a _validate_port_spec. If passwords don't allow certain characters should we validate and raise too? |
thanks @elprans : will close this $ pytest tests/test_connect.py -k TestConnectParams
tests/test_connect.py ✓✓✓✓✓✓✓✓✓✓ 100% ██████████
Results (0.09s):
10 passed
41 deselected |
ranchodeluxe
added a commit
to ranchodeluxe/stac-fastapi-pgstac
that referenced
this pull request
Jun 7, 2024
`asyncpg` doesn't work well for all US-ASCII characters, we need to use `quote_plus` instead MagicStack/asyncpg#1159
4 tasks
vincentsarago
added a commit
to stac-utils/stac-fastapi-pgstac
that referenced
this pull request
Jun 27, 2024
* use quote_plus instead of quote `asyncpg` doesn't work well for all US-ASCII characters, we need to use `quote_plus` instead MagicStack/asyncpg#1159 * make it fail * fix test * one more quote --------- Co-authored-by: ranchodeluxe <greg.corradini@gmail.com> Co-authored-by: vincentsarago <vincent.sarago@gmail.com>
No Sign up for free
to join this conversation on GitHub.
Already have an account?
No Sign in to comment
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.
Problem
Crunchydata Postgresql Operator creates passwords by default using the
US-ASCII
spec. Some of them with special characters in it including@
,[
,]
,/
that seem to cause problems forasyncpg
host parsing even after runningurllib.parse.quote
on the password.The error below shows it return the password assuming it's the port from an example app:
Test output (from this PR) running locally: