FalsePositivesProcessor
in package
Put in a list of `ScanEntry`'s and sort out false-positives and deduplicate. Keep in mind, that this processor can also touch your `ScanEntry` properties as well!
Table of Contents
Properties
- $blockableScanner : mixed
- $entries : mixed
Methods
- __construct() : mixed
- C'tor.
- canExternalUrlBeBypassed() : mixed
- Example: A blocked form does not have reCAPTCHA, got found as "CleverReach". The `form[action]` does not need to get blocked due to the fact the server is only contacted through submit-interaction (a privacy policy needs to be linked / checkbox).
- convertExternalUrlsCoveredByTemplate() : mixed
- Convert external URLs which got covered by a template. When is this the case? When using a `SelectorSyntaxBlocker` with e.g. `link[href=""]` (for example WordPress emojis).
- convertStandaloneLinkRelTemplateToExternalUrl() : mixed
- Convert a found `link[rel="preconnect|dns-prefetch"]` within a template and stands alone within this template to an external URL as a DNS-prefetch and preconnect **must** be loaded in conjunction with another script.
- convertTemplatesWithNonMatchingGroupsToExternalUrl() : mixed
- Remove all entries when there is not a scan entry with the needed host and convert it to an external URL.
- deduplicate() : mixed
- Deduplicate coexisting templates. Examples:
- getEntries() : mixed
- Getter.
- process() : mixed
- Prepare the passed results and do some optimizations on them (e.g. remove duplicates).
- removeDuplicateScannedItems() : mixed
- Example: We have the following markup:
- removeExternalUrlsWithTemplateDuplicate() : mixed
- Remove external URLs which are duplicated as template, too.
- alreadyExistsInOtherFoundTemplate() : false|ScanEntry
- Check if a given template already exists in another scan result.
Properties
$blockableScanner
private
mixed
$blockableScanner
$entries
private
mixed
$entries
Methods
__construct()
C'tor.
public
__construct(BlockableScanner $blockableScanner, array<string|int, ScanEntry> $entries) : mixed
Parameters
- $blockableScanner : BlockableScanner
- $entries : array<string|int, ScanEntry>
Tags
canExternalUrlBeBypassed()
Example: A blocked form does not have reCAPTCHA, got found as "CleverReach". The `form[action]` does not need to get blocked due to the fact the server is only contacted through submit-interaction (a privacy policy needs to be linked / checkbox).
public
canExternalUrlBeBypassed(ScanEntry $entry) : mixed
Parameters
- $entry : ScanEntry
convertExternalUrlsCoveredByTemplate()
Convert external URLs which got covered by a template. When is this the case? When using a `SelectorSyntaxBlocker` with e.g. `link[href=""]` (for example WordPress emojis).
public
convertExternalUrlsCoveredByTemplate([array<string|int, ScanEntry> $entries = null ]) : mixed
Parameters
- $entries : array<string|int, ScanEntry> = null
-
The entries to check, defaults to current instance entries
convertStandaloneLinkRelTemplateToExternalUrl()
Convert a found `link[rel="preconnect|dns-prefetch"]` within a template and stands alone within this template to an external URL as a DNS-prefetch and preconnect **must** be loaded in conjunction with another script.
public
convertStandaloneLinkRelTemplateToExternalUrl() : mixed
convertTemplatesWithNonMatchingGroupsToExternalUrl()
Remove all entries when there is not a scan entry with the needed host and convert it to an external URL.
public
convertTemplatesWithNonMatchingGroupsToExternalUrl() : mixed
deduplicate()
Deduplicate coexisting templates. Examples:
public
deduplicate() : mixed
- CF7 with reCaptcha over Google reCaptcha
- MonsterInsights > Google Analytics (
extended
)
getEntries()
Getter.
public
getEntries() : mixed
Tags
process()
Prepare the passed results and do some optimizations on them (e.g. remove duplicates).
public
process() : mixed
removeDuplicateScannedItems()
Example: We have the following markup:
public
removeDuplicateScannedItems() : mixed
<link rel="stylesheet" id="everest-forms-google-fonts-css" href="https://fonts.googleapis.com/css?family=Josefin+Sans&ver=1.1.6" />
And a content blocker for everest forms with the following rules:
*fonts.googleapis.com*
link[id="everest-forms-google-fonts-css"]
This would lead to duplicate entries in the scanner result list. Never show double-scanned elements when they e.g. caught by two rules
and a rerun through Utils::preg_replace_callback_recursive
. In this case, we will modify the already existing scan entries' found expressions.
removeExternalUrlsWithTemplateDuplicate()
Remove external URLs which are duplicated as template, too.
public
removeExternalUrlsWithTemplateDuplicate() : mixed
alreadyExistsInOtherFoundTemplate()
Check if a given template already exists in another scan result.
protected
alreadyExistsInOtherFoundTemplate(ScanEntry $scanEntry) : false|ScanEntry
Parameters
- $scanEntry : ScanEntry
Return values
false|ScanEntry —The found entry which better suits this template