Commit Graph
8 Commits
Author SHA1 Message Date
a40c5e99fc Add more AI user agent in botPolicies.json (#249)
* Add more IA user agent in bot policies

* Update data/botPolicies.json

Signed-off-by: Xe Iaso <[email protected]>

* Fix trailling pipe that deny all requests

---------

Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: Xe Iaso <[email protected]>
2025-04-18 22:28:56 +00:00
af831f0d7f Add 'Opera' to 'generic-browser' bot policy rule (#220)
After deploying Anubis bot traffic is drastically reduced but I still
see a lot of requests from User-Agents that claim to be 'Opera' like so:

"Opera/9.90.(Windows NT 6.0; mt-MT) Presto/2.9.173 Version/10.00"
"Opera/8.46.(X11; Linux i686; fo-FO) Presto/2.9.161 Version/11.00"

Add 'Opera' to the generic-browser rule to also challenge them.

Signed-off-by: Michael Jeanson <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: Xe Iaso <[email protected]>
2025-04-18 17:57:02 +00:00
095e18d0c8 Allow ranges from the Internet Archive (AS7941) (#276)
* Allow ranges from the Internet Archive (AS7941)

* Updated changelog

* Update data/botPolicies.json

Signed-off-by: Xe Iaso <[email protected]>

* Removed overlapping CIDR for internet-archive in botPolicies.json

---------

Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: Xe Iaso <[email protected]>
2025-04-18 04:13:01 +00:00
81307bcb5c feat: update botPolicies for DuckDuckGo web crawler (#250)
- updates botPolicies with ips from the website
- adds the updated information to the `CHANGELOG.md` file

Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: Xe Iaso <[email protected]>
2025-04-12 02:13:38 +00:00
77436207e6 feat: Add Open Graph tag support (#195)
* feat: Add Open Graph tag support (og-tags)

Signed-off-by: Jason Cameron <[email protected]>

* Fix: Prevent nil pointer dereference in test (og-tags)

Signed-off-by: Jason Cameron <[email protected]>

* feat!: Implement Open Graph tag caching and passthrough functionality (WIP)

I'm going to sleep. currently tags are passed to renderIndex.

see https://github.com/TecharoHQ/anubis/issues/131

Signed-off-by: Jason Cameron <[email protected]>

* feat: Add configuration for air tool with build and logger settings

Signed-off-by: Jason Cameron <[email protected]>

* feat: Move OG tags to base template (og-tags)

Moves the Open Graph (OG) tags from the index template to
the base template. This allows OG tags to be set on any
page, not just the index.  Also adds a
BaseWithOGTags function to the web package to allow
passing OG tags to the base template.  Removes the
ogTags parameter from the Index function and template.

Signed-off-by: Jason Cameron <[email protected]>

* Delete CHANGELOG.md

Signed-off-by: Jason Cameron <[email protected]>

* feat: Add language attribute to HTML tag in template

Signed-off-by: Jason Cameron <[email protected]>

* fix(tests):  Fix nil pointer ref

Signed-off-by: Jason Cameron <[email protected]>

* feat(og-tags): Add timeout to http client (og-tags)

Signed-off-by: Jason Cameron <[email protected]>

* style: fix line endings & indentation

Signed-off-by: Jason Cameron <[email protected]>

* style: add inspection comment for GoBoolExpressions in UnchangingCache

Signed-off-by: Jason Cameron <[email protected]>

* feat(og-tags): Implement Open Graph tag fetching and caching

Signed-off-by: Jason Cameron <[email protected]>

* fix(og-tags): Simplify Open Graph tag extraction logic

Signed-off-by: Jason Cameron <[email protected]>

* fix(og-tags): Add nil check in isOGMetaTag and enhance test cases

Signed-off-by: Jason Cameron <[email protected]>

* feat(og-tags): Add approved tags and prefixes for Open Graph extraction

Signed-off-by: Jason Cameron <[email protected]>

* test(og-tags): Update tests with approved tags and improve clarity

Signed-off-by: Jason Cameron <[email protected]>

* chore: Add changelog notes

Signed-off-by: Jason Cameron <[email protected]>

* fix: Improve stability of the target fetcher?

Signed-off-by: Jason Cameron <[email protected]>

* fix: Update template error handling and improve Open Graph tag integration

Signed-off-by: Jason Cameron <[email protected]>

* style: format files and remove deubg logs

Signed-off-by: Jason Cameron <[email protected]>

* feat: Credit CELPHASE for mascot design (og-tags)

Signed-off-by: Jason Cameron <[email protected]>

* feat: Credit CELPHASE for mascot design (og-tags)

Signed-off-by: Jason Cameron <[email protected]>

* feat: Allow twitter prefixed OG tags by default

Signed-off-by: Jason Cameron <[email protected]>

* chore: replace /tmp with /var

Signed-off-by: Jason Cameron <[email protected]>

* Update docs/docs/CHANGELOG.md

Co-authored-by: Xe Iaso <[email protected]>
Signed-off-by: Jason Cameron <[email protected]>

* Update docs/docs/admin/configuration/open-graph.mdx

Co-authored-by: Xe Iaso <[email protected]>
Signed-off-by: Jason Cameron <[email protected]>

* chore: add fediverse to default prefixes (#og-tags)

Signed-off-by: Jason Cameron <[email protected]>

* feat(og-tags): Remove og-query-distinct flag

This commit removes the `og-query-distinct` flag and
associated logic.  URLs with different query parameters
will now always be treated as the same cache key for Open
Graph tags.  This simplifies the caching logic and
improves performance.

Additionally, the http client used for fetching OG tags
is now a member of the OGTagCache struct, rather than a
global variable. This improves testability and allows
for more flexible configuration in the future.

Signed-off-by: Jason Cameron <[email protected]>

* Update docs/docs/admin/configuration/open-graph.mdx

Co-authored-by: Xe Iaso <[email protected]>
Signed-off-by: Jason Cameron <[email protected]>

* docs: remove og tags references

Signed-off-by: Jason Cameron <[email protected]>

* refactor: rename url > u to not overlap package name

Signed-off-by: Jason Cameron <[email protected]>

* Update internal/ogtags/cache.go

Co-authored-by: Xe Iaso <[email protected]>
Signed-off-by: Jason Cameron <[email protected]>

* Update internal/ogtags/cache.go

Co-authored-by: Xe Iaso <[email protected]>
Signed-off-by: Jason Cameron <[email protected]>

* fix(tests): Don't use network when network access is disabled

Signed-off-by: Jason Cameron <[email protected]>

* Fix: Handle nil URL in GetOGTags (og-tags)

Signed-off-by: Jason Cameron <[email protected]>

* chore: sort installation docs alphabetically

Signed-off-by: Jason Cameron <[email protected]>

* fix(tests): validate that no duplicate requests are made

Signed-off-by: Jason Cameron <[email protected]>

* style(tests): remove unused ok var

Signed-off-by: Jason Cameron <[email protected]>

* docs: convert to table fmt

Signed-off-by: Jason Cameron <[email protected]>

* feat(og-tags): Enhance OG tag fetching and caching

Adds additional approved OG tags (`keywords`, `author`), improves

Signed-off-by: Jason Cameron <[email protected]>

* chore: update generated templ's after format

Signed-off-by: Jason Cameron <[email protected]>

* fix(tests): update integration_test.go to reflect the new behavior of fetchHTMLDocument

Signed-off-by: Jason Cameron <[email protected]>

* Revert "data/botPolicies: allow iMessage scraper by default (#178)"

This reverts commit 21a9d777

Signed-off-by: Jason Cameron <[email protected]>

* Fix: Simplify ogTags access in cache test.

Didn't know this was possible! wow!

Signed-off-by: Jason Cameron <[email protected]>

* Fix: Handle request timeouts when fetching OG tags (#og-tags)

Cache a nil result for half the TTL to avoid repeatedly
requesting a timed-out URL.

Signed-off-by: Jason Cameron <[email protected]>

* Fix: make OG tags passthrough option function.

Signed-off-by: Jason Cameron <[email protected]>

* Fix: Handle timeouts and non-200 responses when fetching OG tags (og-tags)

- Cache empty results for timeouts and non-200 status codes
  to avoid spamming the server.
- Use a non-nil empty map to represent empty results in the
  cache, as nil would be a cache miss.

Signed-off-by: Jason Cameron <[email protected]>

* feat(og-tags): switch to http.MaxBytesReader

Signed-off-by: Jason Cameron <[email protected]>

* chore(og-tags): add noindex, nofollow meta tag and update error line numbers

Signed-off-by: Jason Cameron <[email protected]>

---------

Signed-off-by: Jason Cameron <[email protected]>
Signed-off-by: Jason Cameron <[email protected]>
Co-authored-by: Xe Iaso <[email protected]>
2025-04-06 20:02:12 -04:00
Xe IasoandGitHub 21a9d77788 data/botPolicies: allow iMessage scraper by default (#178)
Signed-off-by: Xe Iaso <[email protected]>
2025-04-03 00:03:28 +00:00
Xe IasoandGitHub e9a6ebffbb data: disable DroneBL lookups by default (#147)
Closes #109

This was a hack I did on stream. I thought this would have a positive
effect, but a combination of real-world testing from people using Anubis
in prod and gray-hat testing has proven this is an unfeature and is
probably causing more harm than good at this stage.

In the future I'll probably make the `dnsbl` block more flexible so that
you can specify your own lists and rules around them.

Signed-off-by: Xe Iaso <[email protected]>
2025-03-28 07:39:14 -04:00
6156d3d729 Refactor and split out things into cmd and lib (#77)
* Refactor anubis to split business logic into a lib, and cmd to just be direct usage.

* Post-rebase fixes.

* Update changelog, remove unnecessary one.

* lib: refactor this

This is mostly based on my personal preferences for how Go code should
be laid out. I'm not sold on the package name "lib" (I'd call it anubis
but that would stutter), but people are probably gonna import it as
libanubis so it's likely fine.

Packages have been "flattened" to centralize implementation with area of
concern. This goes against the Java-esque style that many people like,
but I think this helps make things simple.

Most notably: the dnsbl client (which is a hack) is an internal package
until it's made more generic. Then it can be made external.

I also fixed the logic such that `go generate` works and rebased on
main.

* internal/test: run tests iff npx exists and DONT_USE_NETWORK is not set

Signed-off-by: Xe Iaso <[email protected]>

* internal/test: install deps

Signed-off-by: Xe Iaso <[email protected]>

* .github/workflows: verbose go tests?

Signed-off-by: Xe Iaso <[email protected]>

* internal/test: sleep 2

Signed-off-by: Xe Iaso <[email protected]>

* internal/test: nix this test so CI works

Signed-off-by: Xe Iaso <[email protected]>

* internal/test: warmup per browser?

Signed-off-by: Xe Iaso <[email protected]>

* internal/test: disable for now :(

Signed-off-by: Xe Iaso <[email protected]>

* lib/anubis: do not apply bot rules if address check fails

Closes #83

---------

Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: Xe Iaso <[email protected]>
2025-03-22 18:44:49 -04:00