Blockbot: Reworked user agent parsing #1500

Merged
MrPetovan merged 1 commit from heluecht/friendica-addons:blockbot-2 into develop 2024-05-04 15:09:55 +02:00
Owner

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.

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.
heluecht added 1 commit 2024-04-30 14:43:31 +02:00
heluecht added the
2024.06
label 2024-04-30 14:43:48 +02:00
MrPetovan requested changes 2024-05-01 03:06:21 +02:00
Dismissed
@ -109,2 +71,2 @@
$agents = array_merge($agents, $good_agents);
} elseif (blockbot_match($good_agents)) {
if (empty($parts)) {
logger::debug('Known frontend found', $logdata);
Owner

logger should read Logger across the file.

`logger` should read `Logger` across the file.
Author
Owner

Done

Done
@ -183,0 +171,4 @@
return;
}
$ressource = dba_open(System::getTempPath() . '/' . $database, 'cl');
Owner

$resource.

`$resource`.
Author
Owner

Done

Done
@ -188,0 +721,4 @@
$part = substr($part, 0, $pos1 - 1) . substr($part, $pos2 + 1);
}
$part = trim(preg_replace('=(.*) [\d\.]+=', '$1', $part), ' +,-;­');
Owner

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.

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.
Author
Owner

Is changed

Is changed
heluecht force-pushed blockbot-2 from f5f8f9566f to a5500c41a5 2024-05-03 04:53:42 +02:00 Compare
heluecht force-pushed blockbot-2 from a5500c41a5 to 822d205879 2024-05-04 03:17:20 +02:00 Compare
heluecht force-pushed blockbot-2 from 822d205879 to 74349cc701 2024-05-04 03:21:49 +02:00 Compare
heluecht force-pushed blockbot-2 from 74349cc701 to 67b464cc47 2024-05-04 03:23:43 +02:00 Compare
MrPetovan approved these changes 2024-05-04 15:09:50 +02:00
MrPetovan merged commit 38b75b6529 into develop 2024-05-04 15:09:55 +02:00
heluecht deleted branch blockbot-2 2024-05-05 04:01:32 +02:00
Sign in to join this conversation.
No description provided.