-
Notifications
You must be signed in to change notification settings - Fork 274
Fix handling of mysql passwords with weird characters in it #2660
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
Open
eldering
wants to merge
10
commits into
main
Choose a base branch
from
fix-mysql-password
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
169aa03
to
ba630f7
Compare
vmcj
reviewed
Aug 25, 2024
ba630f7
to
0dc1deb
Compare
0dc1deb
to
9f12b77
Compare
0cb10aa
to
e371261
Compare
Closed
281bcfa
to
23b48a9
Compare
Merged
25b2a01
to
712afd2
Compare
nickygerritsen
approved these changes
Nov 27, 2024
See for reference: - https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri - https://symfony.com/doc/current/doctrine.html but note that we must use `rawurlencode` instead of `urlencode` which differ in how they encode a space (as tested). Fixes: #2651 Closes: #2502 as this is likely fixed but I couldn't reproduce it
Use URL encoding in DATABASE_URL and return mysql_options as an array (via ugly global variable), so each element in it can be separately added to the command line using `@` for expansion. Because of changing the script to bash, also reverts some of the changes in 483200a.
The domjudge mysql user should be created by our setup scripts, so that we test these and need to set the password only in one place. Also don't explicitly pass root user/password to dj_setup_database script. It will infer it from `~/.my.cnf`. Rename mysql_root to mysql_log helper to clarify behaviour.
This is consistent with all the other functions.
712afd2
to
ba598f9
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
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.
The password is passed inside the environment variable
DATABASE_URL
which is URI-like. However, it must be URL encoded there if it contains any strange characters, like a space,%
, etc.Also add a handy command
dj_setup_database update-password
that reset the MySQL database user password to what it currently inetc/dbpassword.secret
, and handle weird passwords in this script. This script is now bash, and should probably be rewritten in PHP or so.