Skip to content

Instantly share code, notes, and snippets.

@luistar15
luistar15 / sg-security-use-sgs-encryption-key-constant.diff
Created July 17, 2023 04:39
Patch for SiteGround Security Plugin to use SGS_ENCRYPTION_KEY constant
diff --git a/wp-content/plugins/sg-security/core/Encryption_Service/Encryption_Service.php b/wp-content/plugins/sg-security/core/Encryption_Service/Encryption_Service.php
--- a/wp-content/plugins/sg-security/core/Encryption_Service/Encryption_Service.php
+++ b/wp-content/plugins/sg-security/core/Encryption_Service/Encryption_Service.php
@@ -48,6 +48,10 @@ class Encryption_Service {
* @since 1.3.6
*/
public function generate_encryption_file() {
+ if ( defined( 'SGS_ENCRYPTION_KEY' ) ) {
+ return true;
+ }
@luistar15
luistar15 / sg-security-parse-multiple-ips.diff
Last active April 20, 2023 16:21
Patch for SiteGround Security Plugin to allow parse multiple IPs
diff --git a/wp-content/plugins/sg-security/core/Helper/Helper.php b/wp-content/plugins/sg-security/core/Helper/Helper.php
--- a/wp-content/plugins/sg-security/core/Helper/Helper.php
+++ b/wp-content/plugins/sg-security/core/Helper/Helper.php
@@ -21,11 +21,20 @@ class Helper {
public static function get_current_user_ip() {
$keys = array( 'REMOTE_ADDR' );
- if (
- defined( 'SGS_HEADER' ) &&
- SGS_HEADER === 'X-Forwarded-For'