Skip to content
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

feat: remove support for facebookexternalhit UA string #24

Merged
merged 9 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Please find a script named `fake-bot-report.sh` in the util folder.

## License

Copyright (c) 2022-2024 OWASP CRS project. All rights reserved.
Copyright (c) 2022-2025 OWASP CRS project. All rights reserved.

The OWASP CRS and its official plugins are distributed
under Apache Software License (ASL) version 2. Please see the enclosed LICENSE
Expand Down
4 changes: 2 additions & 2 deletions plugins/fake-bot-after.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ------------------------------------------------------------------------
# OWASP CRS Plugin
# Copyright (c) 2022-2024 CRS project. All rights reserved.
# Copyright (c) 2022-2025 CRS project. All rights reserved.
#
# The OWASP CRS plugins are distributed under
# Apache Software License (ASL) version 2
Expand Down Expand Up @@ -29,7 +29,7 @@ SecRule TX:FAKE-BOT-PLUGIN_WHITELIST_BROKEN_APPLE_DEVICES "@streq 1" \
chain"
SecRule REQUEST_HEADERS:User-Agent "@endsWith facebookexternalhit/1.1 Facebot Twitterbot/1.0"

SecRule REQUEST_HEADERS:User-Agent "@pm amazonbot applebot bingbot linkedinbot facebookbot facebookcatalog facebookexternalhit googlebot twitterbot" \
SecRule REQUEST_HEADERS:User-Agent "@pm amazonbot applebot bingbot linkedinbot facebookbot facebookcatalog googlebot twitterbot" \
"id:9504120,\
phase:1,\
block,\
Expand Down
2 changes: 1 addition & 1 deletion plugins/fake-bot-before.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ------------------------------------------------------------------------
# OWASP CRS Plugin
# Copyright (c) 2022-2024 CRS project. All rights reserved.
# Copyright (c) 2022-2025 CRS project. All rights reserved.
#
# The OWASP CRS plugins are distributed under
# Apache Software License (ASL) version 2
Expand Down
2 changes: 1 addition & 1 deletion plugins/fake-bot-config.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ------------------------------------------------------------------------
# OWASP CRS Plugin
# Copyright (c) 2022-2024 CRS project. All rights reserved.
# Copyright (c) 2022-2025 CRS project. All rights reserved.
#
# The OWASP CRS plugins are distributed under
# Apache Software License (ASL) version 2
Expand Down
8 changes: 4 additions & 4 deletions plugins/fake-bot.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- -----------------------------------------------------------------------
-- OWASP CRS Plugin
-- Copyright (c) 2022-2024 CRS project. All rights reserved.
-- Copyright (c) 2022-2025 CRS project. All rights reserved.
--
-- The OWASP CRS plugins are distributed under
-- Apache Software License (ASL) version 2
Expand Down Expand Up @@ -52,9 +52,9 @@ function main(matched_bot)
-- https://developers.google.com/search/docs/advanced/crawling/verifying-googlebot
bot_domains = {".googlebot.com", ".google.com"}
bot_name = "Googlebot"
elseif matched_bot == "facebookexternalhit" or matched_bot == "facebookcatalog" or matched_bot == "facebookbot" then
-- https://developers.facebook.com/docs/sharing/webmasters/crawler/
-- https://developers.facebook.com/docs/sharing/bot/
-- We can no longer support 'facebookexternalhit' UA string as Facebook started to use IP addresses without reverse record in DNS.
elseif matched_bot == "facebookcatalog" or matched_bot == "facebookbot" then
-- https://developers.facebook.com/docs/sharing/webmasters/web-crawlers
bot_domains = {".facebook.com", ".fbsv.net"}
bot_name = "Facebookbot"
elseif matched_bot == "bingbot" then
Expand Down
24 changes: 4 additions & 20 deletions tests/regression/fake-bot-plugin/9504120.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,6 @@ tests:
output:
log_contains: id "9504120"
- test_title: 9504120-3
desc: Check for blocking of fake Facebookbot
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: "OWASP CRS test agent: facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: GET
version: HTTP/1.1
uri: /get
output:
log_contains: id "9504120"
- test_title: 9504120-4
desc: Check for blocking of fake Bingbot
stages:
- stage:
Expand All @@ -69,7 +53,7 @@ tests:
uri: /get
output:
log_contains: id "9504120"
- test_title: 9504120-5
- test_title: 9504120-4
desc: Check for blocking of fake Twitterbot
stages:
- stage:
Expand All @@ -85,7 +69,7 @@ tests:
uri: /get
output:
log_contains: id "9504120"
- test_title: 9504120-6
- test_title: 9504120-5
desc: Check for blocking of fake Applebot
stages:
- stage:
Expand All @@ -101,7 +85,7 @@ tests:
uri: /get
output:
log_contains: id "9504120"
- test_title: 9504120-7
- test_title: 9504120-6
desc: Check for blocking of fake LinkedInBot
stages:
- stage:
Expand All @@ -117,7 +101,7 @@ tests:
uri: /get
output:
log_contains: id "9504120"
- test_title: 9504120-8
- test_title: 9504120-7
desc: Check for blocking of fake Amazonbot
stages:
- stage:
Expand Down
Loading