Skip to content

DATAMONGO-2016 fixing issue where question mark in password broke option extraction #578

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

Closed
wants to merge 2 commits into from

Conversation

steve-thousand
Copy link
Contributor

@steve-thousand steve-thousand commented Jul 1, 2018

I tried to follow the guidelines, but I can't seem to figure out how to create a bug for this issue in the JIRA. This is actually my first attempt at a contribution so I'm sure I'm missing something. I did search the JIRA for an issue with credentials and "?" characters but couldn't find one.

The issue I've run into is that if a mongo password contains a "?" character, but no auth-mechanism option, then the MongoCredentialPropertyEditor will throw an ArrayIndexOutOfBoundsException. I've done some research on mongo password rules and there doesn't seem to be any limit on using a "?" in the password.

  • You have read the Spring Data contribution guidelines.
  • There is a ticket in the bug tracker for the project in our JIRA. was not sure how to actually create an issue
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

@pivotal-issuemaster
Copy link

@steve-thousand Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@@ -164,7 +165,7 @@ private static String extractDB(String text) {
private static Properties extractOptions(String text) {

int optionsSeparationIndex = text.lastIndexOf(OPTIONS_DELIMITER);
int dbSeparationIndex = text.lastIndexOf(OPTIONS_DELIMITER);
int dbSeparationIndex = text.lastIndexOf(DATABASE_DELIMITER);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this line in the source jumped out at me as a possible copy/paste error. changing the delimiter we check for fixed the issue

@pivotal-issuemaster
Copy link

@steve-thousand Thank you for signing the Contributor License Agreement!

@mp911de
Copy link
Member

mp911de commented Jul 2, 2018

I filed https://jira.spring.io/browse/DATAMONGO-2016 to track this issue. Please go to https://jira.spring.io/secure/Signup!default.jspa and create a user account so we can collaborate on the ticket. Please attach a stack trace to the mentioned ticket as comment.

@steve-thousand steve-thousand changed the title fixing issue where question mark in password broke option extraction DATAMONGO-2016 fixing issue where question mark in password broke option extraction Jul 2, 2018
@steve-thousand
Copy link
Contributor Author

steve-thousand commented Jul 2, 2018

Thanks @mp911de I've attached the stacktrace to the ticket, added the ticket number to the tests I added, and updated the pull request title to include the ticket number.

mp911de pushed a commit that referenced this pull request Jul 4, 2018
…ropertyEditor.

MongoCredentialPropertyEditor inspects now the connection URI for the appropriate delimiter tokens. Previously, inspection used the char questionmark for username/password delimiter inspection.

Original pull request: #578.
mp911de added a commit that referenced this pull request Jul 4, 2018
Fail gracefully if query string parameter has no value. Reformat test. Convert assertions to AssertJ.

Original pull request: #578.
mp911de pushed a commit that referenced this pull request Jul 4, 2018
…ropertyEditor.

MongoCredentialPropertyEditor inspects now the connection URI for the appropriate delimiter tokens. Previously, inspection used the char questionmark for username/password delimiter inspection.

Original pull request: #578.
mp911de added a commit that referenced this pull request Jul 4, 2018
Fail gracefully if query string parameter has no value. Reformat test. Convert assertions to AssertJ.

Original pull request: #578.
mp911de pushed a commit that referenced this pull request Jul 4, 2018
…ropertyEditor.

MongoCredentialPropertyEditor inspects now the connection URI for the appropriate delimiter tokens. Previously, inspection used the char questionmark for username/password delimiter inspection.

Original pull request: #578.
mp911de added a commit that referenced this pull request Jul 4, 2018
Fail gracefully if query string parameter has no value. Reformat test.

Original pull request: #578.
@mp911de
Copy link
Member

mp911de commented Jul 4, 2018

Thanks a lot for your contribution. That's merged, polished, and backported now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants