Skip to content
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

Correctly remove password component from SQLAlchemy URLs, preventing … #132

Merged
merged 1 commit into from
Feb 16, 2019

Conversation

WFT
Copy link
Contributor

@WFT WFT commented Feb 15, 2019

…invalid characters in SQLAlchemy subsegment names

Issue #: #131

Description of changes:
The URL is parsed and the password stripped, but the old URL is assigned to safe_url. The method ParseResult._replace returns a new ParseResult but does not modify the initial ParseResult. This fixes the problem I described in the issue linked above where SQLAlchemy will replace the password component of SQLAlchemy URL with *** which is then used as a Xray subsegment name, despite being invalid characters.

This is not a new feature, but a small fix to existing code which seems intended to do this in the first place. It seems the sort of thing which should require a test, but I'm not really sure how to add one that tests this since all the tests I can see use sqlite:///:memory: which as far as I know cannot have a password.

When I run the tests locally before this patch I have 5 failures in tests/test_patcher.py, when running after this patch, I get the same 5 failures.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…invalid characters in SQLAlchemy subsegment names
@chanchiem
Copy link
Contributor

Thank you very much for your contribution! This looks good to me. Very nice find :)

Copy link
Contributor

@chanchiem chanchiem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@chanchiem chanchiem merged commit 237f8c7 into aws:master Feb 16, 2019
@chanchiem chanchiem added the bug label Feb 16, 2019
@WFT
Copy link
Contributor Author

WFT commented Feb 16, 2019

Thank you!

@WFT WFT deleted the fix-sqlalchemy-patching-url branch February 16, 2019 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants