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 encode password in ServerSettingsModel #359

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

rmunn
Copy link
Contributor

@rmunn rmunn commented Feb 10, 2025

The x-www-form-urlencoded MIME type says that we're URL-encoding the password, so we need to actually URL-encode the password if we want it to be handled correctly at the other end.

Fixes #324.


This change is Reviewable

The x-www-form-urlencoded MIME type says that we're URL-encoding the
password, so we need to actually URL-encode the password if we want it
to be handled correctly at the other end.
@rmunn rmunn self-assigned this Feb 10, 2025
Copy link

github-actions bot commented Feb 10, 2025

Test Results

       8 files  ±0     333 suites  ±0   2h 23m 2s ⏱️ -9s
   988 tests ±0     932 ✔️ ±0    56 💤 ±0  0 ±0 
3 145 runs  ±0  3 022 ✔️ ±0  123 💤 ±0  0 ±0 

Results for commit 225c299. ± Comparison against base commit 49493f8.

♻️ This comment has been updated with latest results.

@imnasnainaec
Copy link

@rmunn
Copy link
Contributor Author

rmunn commented Feb 14, 2025

Testing this is proving a bit more difficult than anticipated. Because the buggy code is in ServerSettingsModel, which is only used in the "login" part of the Chorus GUI, the buggy code path is only used when logging into production Lexbox. However, when you try to set someone's password on Lexbox to something with & or + in it (there are only a few characters that trigger the bug), the frontend code doesn't allow you to do it. I can create a test user in my local dev instance of Lexbox (by temporarily disabling the frontend check that forbids those characters), but then to do S/R in FieldWorks I have to check the "Custom URL" checkbox and that won't go through the buggy codepath.

To test this, I'll need to create a test user on Lexbox, then edit their data by hand in Postgres to set their password (and salt) to the password and salt that were created for my test user in local dev. Which I'm running out of time to do today.

@rmunn
Copy link
Contributor Author

rmunn commented Feb 14, 2025

I have now tested it and proven that it works. Using the characters & or + is now safe in passwords with this bugfix. I created a test account with the password a&b+c d and Chorus failed to log in with that password before the bugfix, but succeeded after I applied this bugfix PR to my local copy of LibChorus.dll. (I have since changed the password on that test account, so I'm not revealing any active credentials here).

Once we fix the GHA build issues (which I suspect are because ubuntu-latest has just been switched to ubuntu-24.04 which no longer offers Python 2 as an installable package), then this can be safely merged with confidence that it is tested and working.

We still need a python2 package which 24.04 no longer offers, so run
this on 22.04 until the need for the python2 package goes away.
Copy link

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @rmunn)

@imnasnainaec
Copy link

Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @rmunn)

I reviewed all the files, but I don't have permission in this repo to "approve".

@rmunn rmunn requested review from jasonleenaylor and ermshiperete and removed request for ermshiperete February 14, 2025 20:05
@rmunn rmunn enabled auto-merge (squash) February 14, 2025 20:37
@rmunn
Copy link
Contributor Author

rmunn commented Feb 14, 2025

Note that I changed ubuntu-latest to ubuntu-22.04 in this PR so that the python2 package would be available (it was removed in ubuntu-24.04), as it's still needed for testing Mercurial 3.3 builds of Chorus. That change also needs a corresponding change to the repo's checks, which are currently waiting for a test report from "build-and-test (ubuntu-latest, net8.0)" when they should instead be waiting for "build-and-test (ubuntu-22.04, net8.0)". I don't have the repo permissions to make that particular change.

@rmunn rmunn requested a review from hahn-kev February 14, 2025 23:00
@rmunn rmunn disabled auto-merge February 17, 2025 01:33
@rmunn rmunn enabled auto-merge (squash) February 17, 2025 01:33
@rmunn
Copy link
Contributor Author

rmunn commented Feb 17, 2025

@hahn-kev - Looks like it's not auto-merging until the required status has been reported green — and it won't be reported green, because the status is looking for ubuntu-latest but the test is now running on ubuntu-22.04 instead (because 24.04 removed python2, and our CI build still tries to install a python2 package).

@hahn-kev hahn-kev disabled auto-merge February 19, 2025 02:12
@hahn-kev hahn-kev merged commit 51c25ac into master Feb 19, 2025
8 checks passed
@hahn-kev hahn-kev deleted the bug/password-encoding branch February 19, 2025 02:12
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.

Password encoding is wrong in ServerSettingsModel.LogIn
3 participants