-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(mysql): require TLS for SPIFFE users (#5929) #6059
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,6 +178,7 @@ | |
| } | ||
| #endif | ||
| uint64_t hash1, hash2; | ||
| bool effective_use_ssl = use_ssl; | ||
| SpookyHash myhash; | ||
| myhash.Init(1,2); | ||
| myhash.Update(username,strlen(username)); | ||
|
|
@@ -306,7 +307,19 @@ | |
| // FIXME: if the password is a clear text password, automatically generate sha1_pass and clear_text_password | ||
| } | ||
|
|
||
| ad->use_ssl=use_ssl; | ||
| if (ad->attributes && strlen(ad->attributes)) { | ||
|
Check warning on line 310 in lib/MySQL_Authentication.cpp
|
||
| try { | ||
| nlohmann::json valid=nlohmann::json::parse(ad->attributes); | ||
| if (valid.find("spiffe_id") != valid.end()) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: The TLS-forcing path runs for every credential type, not only frontend users. In ProxySQL_Admin.cpp the LOAD MYSQL USERS handler calls Prompt for AI agents |
||
| effective_use_ssl = true; | ||
| } | ||
| } | ||
| catch(nlohmann::json::exception&) { | ||
| // Invalid attributes do not require TLS. | ||
| } | ||
| } | ||
|
|
||
| ad->use_ssl=effective_use_ssl; | ||
| ad->default_hostgroup=default_hostgroup; | ||
| ad->schema_locked=schema_locked; | ||
| ad->transaction_persistent=transaction_persistent; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: This re-parses
ad->attributesthat was just parsed and validated a few lines above in the sameadd()call (in both the new-account and attribute-change branches). Everyadd()for a user with non-empty attributes now parses the same JSON twice. The spiffe check could reuse the already-validated JSON instead of parsing again; as-is it's redundant work done on every user load (e.g.LOAD MYSQL USERS TO RUNTIMEiterating many users).Prompt for AI agents