Blockbot: Reworked user agent parsing #1500
No reviewers
Labels
No labels
2018.09
2019.01
2019.03
2019.06
2019.09
2019.12
2020.03
2020.06
2020.09
2020.12
2021.03
2021.07
2021.09
2022.02
2022.06
2022.09
2022.12
2023.04
2023.05
2023.09
2024.03
2024.06
2024.09
2024.12
dependencies
Hackathon 2021
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: friendica/friendica-addons#1500
Loading…
Reference in a new issue
No description provided.
Delete branch "heluecht/friendica-addons:blockbot-2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a complete rework of the addon. There had been many issues with the way, the user agent had been parsed. There is now a sophisticated user gent string parser that had been tested with more than 22,000 entries, gathered from my servers and from public lists. Also included is some simple threat protection. The system will now reject any access to some critical paths like the login for any user agent that doesn't appear to be a regular browser.
@ -109,2 +71,2 @@
$agents = array_merge($agents, $good_agents);
} elseif (blockbot_match($good_agents)) {
if (empty($parts)) {
logger::debug('Known frontend found', $logdata);
logger
should readLogger
across the file.Done
@ -183,0 +171,4 @@
return;
}
$ressource = dba_open(System::getTempPath() . '/' . $database, 'cl');
$resource
.Done
@ -188,0 +721,4 @@
$part = substr($part, 0, $pos1 - 1) . substr($part, $pos2 + 1);
}
$part = trim(preg_replace('=(.*) [\d\.]+=', '$1', $part), ' +,-;');
There's a warning that says "This line has invisible Unicode characters" in the
trim()
character list, is this intended?If yes please use the
\u{00AD}
notation in double quotes.Is changed
f5f8f9566f
toa5500c41a5
a5500c41a5
to822d205879
822d205879
to74349cc701
74349cc701
to67b464cc47