这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@unixfox
Copy link
Contributor

@unixfox unixfox commented Apr 30, 2025

Related to #3965.

Check that the browsers checked do support the feature Sec-Fetch before blocking them based on this factor.

Avoiding blocking legitimate users using ancient browsers that do not support these headers.

Reasoning explained: #3965 (comment)

@unixfox unixfox requested a review from return42 April 30, 2025 09:14
@unixfox unixfox force-pushed the Sec-Fetch-Mode-improved branch from deaf06b to ce2cb8b Compare April 30, 2025 09:19
@unixfox unixfox changed the title botdetection: HTTP Fetch Metadata Request Headers [mod] botdetection: HTTP Fetch Metadata Request Headers - improved Apr 30, 2025
@unixfox unixfox force-pushed the Sec-Fetch-Mode-improved branch from ce2cb8b to 399a31f Compare April 30, 2025 09:24
Copy link
Member

@Bnyro Bnyro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that some bots use Firefox user agents, so this should be helpful for such.

I'm not sure if the general impact is as good as with @return42's PR because many bots will probably use other user agents than the common ones (or rotate different ones) - we'll have to see how it performs in production.

@unixfox
Copy link
Contributor Author

unixfox commented Apr 30, 2025

@return42 could you try on your searxng instance please :)?

@unixfox
Copy link
Contributor Author

unixfox commented May 2, 2025

@return42 did you see any change in efficiency between PR #3965 and #4696 on your server?

@return42
Copy link
Member

return42 commented May 2, 2025

@unixfox please give me some more time ..

I'm not sure if the general impact is as good as with @return42's PR because many bots will probably use other user agents than the common ones (or rotate different ones) - we'll have to see how it performs in production.

I want to implement an option for the SearXNG admins to switch additional browser tests from 399a31f on or off ...

@unixfox
Copy link
Contributor Author

unixfox commented May 2, 2025

What do you mean? I'm not following you.

All the browsers in https://github.com/searxng/searxng/pull/4696/files#diff-ab6d5589d48207e72a940dbaa37d671093e2e1e7bc9849faed4e3163ed72a1e7R41-R76 match all the browsers that exist and support this Sec-Fetch headers. Firefox, Chrome, Safari.

@return42
Copy link
Member

return42 commented May 2, 2025

Sorry, I quoted the wrong paragraph 🤦 .. I fixed my comment above to:

I'm not sure if the general impact is as good as with @return42's PR because many bots will probably use other user agents than the common ones (or rotate different ones) - we'll have to see how it performs in production.

@unixfox
Copy link
Contributor Author

unixfox commented May 2, 2025

I want to implement an option for the SearXNG admins to switch additional browser tests from 399a31f on or off ...

Again I'm not following what you want to do. This is not clear whenever you want to implement an option to enable the feature "HTTP Fetch Metadata Request Headers" from PR #4696 or #3965. Or give the ability to add more browsers to check against "HTTP Fetch Metadata Request Headers".

If it's the latter one: why? Only the browsers checked in https://github.com/searxng/searxng/pull/4696/files#diff-ab6d5589d48207e72a940dbaa37d671093e2e1e7bc9849faed4e3163ed72a1e7R41-R76, do support Sec-Fetch. Why giving the ability to configure more? If there are more later on, then we can add them in the code.

@return42
Copy link
Member

return42 commented May 2, 2025

many bots will probably use other user agents

The PR #3965 doesn't care UA header and blocks when Sec header is missed, while this PR looks at UA header and blocks only when UA header and Sec header do not fit together .. I want to implement an option, so admin can decide if he wants to care UA header or not.

@unixfox
Copy link
Contributor Author

unixfox commented May 2, 2025

I want to implement an option, so admin can decide if he wants to care UA header or not.

I'm sorry I do not want this option. Here is why:

I do not want all the public instances of SearXNG to only work on these browsers:

  • Chrome >= 80
  • Firefox >= 90
  • Safari >= 16.4

Feel free to do that in your fork, on your instance, but I do not want such thing in the general SearXNG core.

Even if this is going to not be a default option, public instances owners will enable it because they want the best protection, and they will not understand the damages this is going to do.

My PR as it is a good balance to block based on one more factor (that remember, can always be found by reading the source code) and avoid blocking legitimate users.

So please, test it on your instance, give me some feedback for the efficiency in blocking bots (not legitimate users, if that can be analyzed).

@return42
Copy link
Member

return42 commented May 3, 2025

Even if this is going to not be a default option, public instances owners will enable it because they want the best protection, and they will not understand the damages this is going to do.

There will be documentation that clearly describes what the disadvantages can be.

@unixfox
Copy link
Contributor Author

unixfox commented May 3, 2025

I'm reiterating what I said, I'm not adding such feature. The built-in bot protection was created to reduce bots while fully knowing that anyone can bypass it by reading the source code, but I'm not turning it into a tool for restricting the access to a class of browsers family.

There are a myriad of other factors to catch bots, this PR is not the only ultimate factor to block bots or reduce the effects from bots:

By the end of next week, I'm merging this PR as is, feel free to give me some feedback in case you test it.

Copy link
Member

@return42 return42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improved version of #3965 which check for the browser version before checking the Sec-Fetch headers.

In my opinion, this PR is a weakening of the protection we got through PR #3965, if you think this weakening is necessary, then (rebase and) merge this PR.

@unixfox unixfox force-pushed the Sec-Fetch-Mode-improved branch from 399a31f to 7373429 Compare May 4, 2025 08:07
@unixfox unixfox changed the title [mod] botdetection: HTTP Fetch Metadata Request Headers - improved fix: check if the browser supports Sec-Fetch headers May 4, 2025
@unixfox unixfox changed the title fix: check if the browser supports Sec-Fetch headers [fix] botdetection: check if the browser supports Sec-Fetch headers May 4, 2025
@unixfox unixfox merged commit 19b116f into master May 4, 2025
7 checks passed
@return42 return42 deleted the Sec-Fetch-Mode-improved branch May 4, 2025 10:47
return42 added a commit to return42/searxng that referenced this pull request May 20, 2025
…#4696)"

This reverts commit 19b116f.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request May 20, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
@return42
Copy link
Member

return42 commented May 20, 2025

I think that some bots use Firefox user agents, so this should be helpful for such.

I'm not sure if the general impact is as good as with @return42's PR because many bots will probably use other user agents than the common ones (or rotate different ones) - we'll have to see how it performs in production.

See my DRAFT:

return42 added a commit to return42/searxng that referenced this pull request May 20, 2025
…#4696)"

This reverts commit 19b116f.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request May 20, 2025
…#4696)"

This reverts commit 19b116f.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request May 23, 2025
…#4696)"

This reverts commit 19b116f.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request May 23, 2025
…#4696)"

This reverts commit 19b116f.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request May 23, 2025
…#4696)"

This reverts commit 19b116f.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request May 29, 2025
…#4696)"

This reverts commit 19b116f.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Jun 3, 2025
…#4696)"

This reverts commit 19b116f.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Bnyro pushed a commit to Bnyro/searxng that referenced this pull request Jun 25, 2025
return42 added a commit to return42/searxng that referenced this pull request Jun 28, 2025
…#4696)"

This reverts commit 19b116f.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Jun 30, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Jun 30, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Jun 30, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Jul 9, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Jul 28, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Aug 11, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Sep 1, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Sep 28, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Oct 6, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Oct 19, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Oct 20, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Oct 27, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Nov 4, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Nov 8, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this pull request Nov 11, 2025
…earxng#4696)"

Many bots will probably use other user agents than the common ones (or rotate
different ones)[1].

On my instance I can observe how bots with other UA headers are no longer
stopped with the patch of PR searxng#4696.

This reverts PR searxng#4696 commit 19b116f.

[1] searxng#4696 (review)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants