-
Notifications
You must be signed in to change notification settings - Fork 4
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
CDN Headers Checker #276
Merged
Merged
CDN Headers Checker #276
Changes from 17 commits
Commits
Show all changes
93 commits
Select commit
Hold shift + click to select a range
8c4645f
Fix. SecFW. Schema updated.
Glomberg f92c27e
Fix. SecFW. Updating separated by v4 and v6.
Glomberg d8c371b
Merge remote-tracking branch 'origin/dev' into IP-schema-separated
Glomberg 27bed7a
Fix. Code. Code style and psalm fixed.
Glomberg 607a41d
Main logic done.
alexandergull fba8f47
Mod. Settings. Known headers taken from IP::$known_headers.
alexandergull e8512e2
New. RC implemented.
alexandergull 7d9a579
Psalm/PHPunit/PHPCS fixes.
alexandergull 40c5c84
Fix. Header get.
alexandergull e71298c
Fix. FireWall. Networks data selecting (SQL) fixed.
Glomberg 6fc699f
Fix. FireWall. Stats tab - networks counts stored in the database fixed.
Glomberg 274796d
Fix. Code. Code style fixed.
Glomberg 73e86a5
Merge remote-tracking branch 'origin/dev' into IP-schema-separated
Glomberg 41e592f
Fix. FireWall. Updater implemented for new DB structures.
Glomberg 1f807f4
Version: 2.124.1-fix.
Glomberg dd8c6cc
Fix. PHP 8.2 deprecated notice fixed (creation of dynamic property ::…
alexandergull 729fb65
Merge remote-tracking branch 'origin/dev' into IP-schema-separated
Glomberg 0402590
Fix. FireWall. `privateRecordsAdd`, `privateRecordsDelete` implemente…
Glomberg 28658ca
Fix. PHP 8.2 deprecated notice fixed (creation of dynamic property ::…
alexandergull 6cdca07
Merge remote-tracking branch 'origin/fix' into fix
alexandergull d3b5e83
Code. Phpcs fix.
alexandergull c729e27
Merge branch 'dev' into cdn_self_check.ag
alexandergull 84b115e
Mod. Ip::get(). Get automatic search if no IP provided in selected he…
alexandergull 56ce5fd
Ref. Layout HTML logic rebuilt to template-like.
alexandergull ea9c1b9
Mod. Docs and refs.
alexandergull 6d6ee69
New. Autotests.
alexandergull 7d8a582
Mod. Now use request check neither response check.
alexandergull 5dd381a
Merge branch 'dev' into cdn_self_check.ag
alexandergull 76328f4
Fix. After dev merge.
alexandergull 7c56c44
New logic to filter known CDN headers from other (like x-forwarded-for)
alexandergull ed0d499
Do not show changes if the new settings is the same as old.
alexandergull 5faae32
Fix. Scan. Added check for signatures count.
svfcode 68246f6
Settings changed. Do new CDN check call on settings save.
alexandergull 1e38fd4
Psalm fixes.
alexandergull 22e90a4
Revert "Upd.Gulp.Delete gulp-sass"
alexandergull 8b45d1a
Revert "Upd.Lib.Adaptive table and drop-down line"
alexandergull dd76e56
Revert "Fix. Lib. Delete variable"
alexandergull 1e35210
Upd.Gulp.Delete gulp-sass
AntonV1211 d2e7806
Merge branch 'fix' into dev
alexandergull 23db725
Js reminify.
alexandergull 6844e68
Fix. Lib. Change headers logic for adaptive
AntonV1211 ad7c6e0
Fix. Lib. Merge
AntonV1211 424052f
Partial revert LIst Table
alexandergull df48246
Fix. Lib. Localization global style
AntonV1211 53d573c
Fix. Lib. Merge dev
AntonV1211 def9d35
Version 2.125 and readme updated.
alexandergull ac20e10
Fix. Lib. Fixs merge dev, delete js func
AntonV1211 6bac4d5
Merge branch 'dev' of https://github.com/CleanTalk/security-malware-f…
AntonV1211 a65e1db
New. UploadChecker.php. Extracted from WAF logic.
alexandergull dfbf30b
Fix. Remove middle action to skip duplicated loggin called in Firewal…
alexandergull 7f97257
Fix. PHP 8.2 Tokens. Magic calls prevented.
alexandergull 78ec220
Version: 2.125.1-dev
alexandergull 63ff708
Version: 2.125.1-fix
alexandergull a1a6342
Upd. Settings. Remove btn Delete from Approved
AntonV1211 0f2bae8
Merge branch 'dev' of https://github.com/CleanTalk/security-malware-f…
AntonV1211 eff4ef9
Merge branch 'adaptive_table-av' of https://github.com/CleanTalk/secu…
AntonV1211 12583fa
Ref. SecFW. Added last update log.
svfcode 03f4f87
Merge branch 'dev' of https://github.com/CleanTalk/security-malware-f…
AntonV1211 643c982
Fix. Lib. Add-remove class
AntonV1211 5377d31
Reminfy.
alexandergull 8514235
Fix. Merge dev
AntonV1211 127c06e
Restore all accordeons changes from the zip.
alexandergull 4f47773
Fix. Scanner. SQL request for pages selector.
alexandergull 564e860
Fix. Scanner. File sending. Fix DTO and results merging.
alexandergull 0215190
Fix. Arr. mergeWithSavingNumericKeysRecursive() fixed.
alexandergull ae45090
Fix. DTO test fixed.
alexandergull 2bb208f
Fix. Scanner. SQL request for pages selector.
alexandergull d4d347e
Fix. Scanner. File sending. Fix DTO and results merging.
alexandergull b580e3a
Fix. Arr. mergeWithSavingNumericKeysRecursive() fixed.
alexandergull 1c72d06
Fix. DTO test fixed.
alexandergull 10b0f0c
Fix. Accordions. Red dot status fixed.
alexandergull 3eb2935
Fix. Accordions. Red dot status fixed.
alexandergull 85b5524
Merge pull request #282 from CleanTalk/upload_checker.ag
alexandergull f298845
New. UploadChecker. Checking archive in media uploader.
svfcode 02714e3
Merge branch 'dev' into IP-schema-separated
svfcode 8b6d10f
Fix. Added separated tables to Deactivator.
svfcode 8239e5b
Merge pull request #277 from CleanTalk/IP-schema-separated
svfcode a08f17f
Fix. Remove redundant code.
svfcode ec19dc6
Cron. Restored cron.
alexandergull bce4622
Merge pull request #285 from CleanTalk/check-uploaded-zip
alexandergull b3c96f1
New. Scanner. Send suspicious files to cloud.
svfcode 4a3f825
Merge branch 'dev' into accordeons_logic_improvements.ag
alexandergull a1b7ebc
Merge pull request #289 from CleanTalk/accordeons_logic_improvements.ag
alexandergull 97c71cf
Merge pull request #283 from CleanTalk/changes_btn_settings_av
alexandergull a3a2621
Merge branch 'dev' into adaptive_table-av
alexandergull 6d9a991
Code. JS reminify.
alexandergull d2f2d9f
Merge pull request #281 from CleanTalk/adaptive_table-av
alexandergull cd51fca
Merge pull request #284 from CleanTalk/queue-logs
alexandergull 56e2e97
Merge pull request #286 from CleanTalk/send-suspicious-to-cloud
alexandergull 039b206
Merge branch 'fix' into dev
alexandergull 5077a3e
Code. Version 2.125.1-dev.
alexandergull 4838a22
Fix. Settings. Changed the period in the message
antonV3737 a40e905
Merge remote-tracking branch 'origin/cdn_self_check.ag' into cdn_self…
alexandergull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<?php | ||
|
||
use CleantalkSP\SpbctWP\HTTP\CDNHeadersChecker; | ||
use CleantalkSP\SpbctWP\Scanner\ScanningLog\ScanningLogFacade; | ||
use CleantalkSP\Variables\Post; | ||
use CleantalkSP\Variables\Server; | ||
|
@@ -536,6 +537,12 @@ function spbc_settings__register() | |
'options' => spbc_settings_field__secfw__get_ip__get_labels(), | ||
'title' => __('Get visitors IP from additional headers', 'security-malware-firewall'), | ||
'description' => spbc_settings_field__secfw__get_ip__get_description(), | ||
'long_description' => true, | ||
), | ||
'secfw__get_ip__enable_cdn_auto_self_check' => array( | ||
'type' => 'field', | ||
'title' => __('Enable automatic CDN headers checker', 'security-malware-firewall'), | ||
'description' => CDNHeadersChecker::getOptionDescriptionText(), | ||
), | ||
), | ||
), | ||
|
@@ -1649,6 +1656,16 @@ function spbc_field_statistics() | |
: __('Unknown last PHP log sending time.', 'security-malware-firewall')); | ||
} | ||
|
||
echo '<br/>'; | ||
|
||
|
||
//cdn checker data | ||
add_filter('safe_style_css', function ($styles) { | ||
$styles[] = 'display'; | ||
return $styles; | ||
}); | ||
echo Escape::escKsesPreset(CDNHeadersChecker::getSummaryBlockHTML(), 'spbc_cdn_checker_table'); | ||
|
||
echo '<br/>'; | ||
echo 'Plugin version: ' . SPBC_VERSION; | ||
echo '</div>'; | ||
|
@@ -4721,6 +4738,10 @@ function spbc_settings__get_description() | |
'desc' => __('The file hash is in denied list. It means that the Security analysts have marked this file | ||
as critically dangerous early. We do recommend you to order the Security Audit service.', 'security-malware-firewall') | ||
), | ||
'secfw__get_ip' => array( | ||
'title' => IP::getOptionLongDescriptionArray()['title'], | ||
'desc' => IP::getOptionLongDescriptionArray()['desc'], | ||
), | ||
'no_description' => array( | ||
'title' => esc_html($setting_id), | ||
'desc' => __('No description provided yet for this item. We are sorry about this. Please, contact [email protected] for further help.', 'security-malware-firewall'), | ||
|
@@ -4995,6 +5016,16 @@ function spbc__send_local_settings_to_api($settings) | |
API::methodSendLocalSettings($api_key, $hostname, $settings); | ||
} | ||
|
||
add_action('spbc_before_returning_settings', 'spbc_cdn_checker__run_check_on_settings_change'); | ||
|
||
function spbc_cdn_checker__run_check_on_settings_change($settings) | ||
{ | ||
if ( isset($settings['secfw__get_ip__enable_cdn_auto_self_check']) && $settings['secfw__get_ip__enable_cdn_auto_self_check'] != 0) { | ||
CDNHeadersChecker::sendCDNCheckerRequest(); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -5037,24 +5068,10 @@ function spbc_settings_field__secfw__get_ip__get_description() | |
|
||
function spbc_settings_field__secfw__get_ip__get_labels() | ||
{ | ||
$available_header = array( | ||
2 => array('slug' => 'remote_addr', 'name' => 'Remote Addr'), | ||
3 => array('slug' => 'x_forwarded_for', 'name' => 'X-Forwarder-For'), | ||
4 => array('slug' => 'x_real_ip', 'name' => 'X-Real-Ip'), | ||
5 => array('slug' => 'incapsula', 'name' => 'Incap-Client-Ip'), | ||
6 => array('slug' => 'ico_x_forwarded_for', 'name' => 'Ico-X-Forwarded-For'), | ||
7 => array('slug' => 'stackpath', 'name' => 'X-Sp-Forwarded-Ip'), | ||
8 => array('slug' => 'x_forwarded_by', 'name' => 'X-Client-Ip'), | ||
9 => array('slug' => 'sucury', 'name' => 'X-Sucuri-Clientip'), | ||
10 => array('slug' => 'ezoic', 'name' => 'X-Middleton-Ip'), | ||
11 => array('slug' => 'gtranslate', 'name' => 'X-Gt-Viewer-Ip'), | ||
12 => array('slug' => 'cloud_flare', 'name' => 'Cf-Connecting-Ip'), | ||
13 => array('slug' => 'ovh', 'name' => 'Remote-Ip'), | ||
); | ||
$options = array(); | ||
$options[] = array('val' => 1, 'label' => __('Auto', 'security-malware-firewall'),); | ||
|
||
foreach ( $available_header as $key => $header ) { | ||
foreach (IP::$known_headers_collection as $key => $header ) { | ||
IP::get($header['slug'], [], true); | ||
$option_value = $header['name']; | ||
$option_value .= isset(IP::getInstance()->ips_stored[$header['slug']]) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
jQuery(document).ready(function(){ | ||
console.log('TAB - SUMMARY'); | ||
}); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Please, clone these changes into the HTTP library