-
-
Notifications
You must be signed in to change notification settings - Fork 75
Reverse proxy fix #191
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
Reverse proxy fix #191
Changes from all commits
79743da
416dc27
8abce99
1624b2e
0ece38c
287f620
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 |
|---|---|---|
|
|
@@ -397,6 +397,12 @@ public function has_correct_dns() { | |
|
|
||
| $domain_url = $this->get_domain(); | ||
|
|
||
| $domain_manager = \WP_Ultimo\Managers\Domain_Manager::get_instance(); | ||
|
|
||
| if ($domain_manager->verify_domain_with_loopback_request($this)) { | ||
| return true; | ||
| } | ||
|
|
||
|
Comment on lines
+400
to
+405
Contributor
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. Loopback short-circuit is fine; ensure TLS verification is actually enforced This path depends on Domain_Manager::verify_domain_with_loopback_request(). In that method, the “HTTPS with SSL verification” variant currently uses sslverify tied to https_local_ssl_verify with a default false. That disables certificate verification by default and invites MITM. Proposed fix in inc/managers/class-domain-manager.php: - 'sslverify' => apply_filters('https_local_ssl_verify', false),
+ 'sslverify' => apply_filters('https_local_ssl_verify', true),Also ensure the log label matches behavior (i.e., only claim “with SSL verification” when sslverify is true). |
||
| $network_ip_address = Helper::get_network_public_ip(); | ||
|
|
||
| $results = \WP_Ultimo\Managers\Domain_Manager::dns_get_record($domain_url); | ||
|
|
@@ -600,7 +606,7 @@ public static function get_by_site($site) { | |
| * @since 2.0.0 | ||
| * | ||
| * @param array|string $domains Domain names to search for. | ||
| * @return object | ||
| * @return static | ||
| */ | ||
| public static function get_by_domain($domains) { | ||
|
|
||
|
|
@@ -633,7 +639,7 @@ public static function get_by_domain($domains) { | |
| $placeholders_in = implode(',', $placeholders); | ||
|
|
||
| // Prepare the query | ||
| $query = "SELECT * FROM {$wpdb->wu_dmtable} WHERE domain IN ($placeholders_in) AND active = 1 ORDER BY primary_domain DESC, active DESC, secure DESC LIMIT 1"; | ||
| $query = "SELECT * FROM {$wpdb->wu_dmtable} WHERE domain IN ($placeholders_in) ORDER BY primary_domain DESC, active DESC, secure DESC LIMIT 1"; | ||
|
|
||
| $query = $wpdb->prepare($query, $domains); // phpcs:ignore | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1679,7 +1679,11 @@ public function save() { | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| $user_id = $customer->get_user_id(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| add_user_to_blog($this->get_id(), $user_id, $role); | ||||||||||||||||||||||
| // only add user to blog if they are not already a member, or we are downgrading their role. | ||||||||||||||||||||||
| // Without this check the user could lose additional roles added manually or with hooks. | ||||||||||||||||||||||
| if ('administrator' !== $role || ! is_user_member_of_blog($user_id, $this->get_id())) { | ||||||||||||||||||||||
| add_user_to_blog($this->get_id(), $user_id, $role); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+1682
to
+1686
Contributor
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. 🛠️ Refactor suggestion Guard add_user_to_blog when user_id is empty. If get_user_id() returns 0/false, add_user_to_blog may misbehave. Add a truthy check. Apply this diff: - if ('administrator' !== $role || ! is_user_member_of_blog($user_id, $this->get_id())) {
- add_user_to_blog($this->get_id(), $user_id, $role);
- }
+ if ($user_id && ('administrator' !== $role || ! is_user_member_of_blog($user_id, $this->get_id()))) {
+ add_user_to_blog($this->get_id(), $user_id, $role);
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| } elseif ($this->get_type() !== Site_Type::CUSTOMER_OWNED && $original_customer_id) { | ||||||||||||||||||||||
| $user_id = wu_get_customer($original_customer_id)->get_user_id(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
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.
🛠️ Refactor suggestion
Avoid role update when customer has no WP user_id.
Prevent accidental calls with a falsy user_id; minor perf win by not repeating get_user_id().
Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents