70 Commits

Author SHA1 Message Date
Jason Cameron
77436207e6
feat: Add Open Graph tag support (#195)
* feat: Add Open Graph tag support (og-tags)

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* 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 <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* 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 <git@jasoncameron.dev>

* Delete CHANGELOG.md

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* feat: Add language attribute to HTML tag in template

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* fix(tests):  Fix nil pointer ref

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* style: fix line endings & indentation

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* style: add inspection comment for GoBoolExpressions in UnchangingCache

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* chore: Add changelog notes

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* fix: Improve stability of the target fetcher?

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* style: format files and remove deubg logs

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* feat: Allow twitter prefixed OG tags by default

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* chore: replace /tmp with /var

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* Update docs/docs/CHANGELOG.md

Co-authored-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Jason Cameron <jasoncameron.all@gmail.com>

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

Co-authored-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Jason Cameron <jasoncameron.all@gmail.com>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* 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 <git@jasoncameron.dev>

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

Co-authored-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Jason Cameron <jasoncameron.all@gmail.com>

* docs: remove og tags references

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* Update internal/ogtags/cache.go

Co-authored-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Jason Cameron <jasoncameron.all@gmail.com>

* Update internal/ogtags/cache.go

Co-authored-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Jason Cameron <jasoncameron.all@gmail.com>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* chore: sort installation docs alphabetically

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* style(tests): remove unused ok var

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* docs: convert to table fmt

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* chore: update generated templ's after format

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

This reverts commit 21a9d777

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* Fix: Simplify ogTags access in cache test.

Didn't know this was possible! wow!

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* 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 <git@jasoncameron.dev>

* Fix: make OG tags passthrough option function.

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* 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 <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

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

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

---------

Signed-off-by: Jason Cameron <git@jasoncameron.dev>
Signed-off-by: Jason Cameron <jasoncameron.all@gmail.com>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-04-06 20:02:12 -04:00
Xe Iaso
df27a96f1f
make a half-baked tarball (#221)
* make a half-baked tarball

Closes #217

Signed-off-by: Xe Iaso <me@xeiaso.net>

* make two tarballs: one with just the vendor, and one with vendor and npm

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-04-06 12:44:52 +00:00
Xe Iaso
95416dfe82
Makefile: fix subtle logic bug (#228)
Closes #226

Makefile dependencies are backwards, apparently.

Also add staticcheck as a `go tool` dependency.
2025-04-06 00:28:08 -04:00
Xe Iaso
e58abbe4de
web: add noindex to base HTML template (#229)
Closes #227

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-04-06 04:21:13 +00:00
Xe Iaso
878b37178d
implement packaging proof of concept with yeet (#194)
* implement packaging proof of concept with yeet

Signed-off-by: Xe Iaso <me@xeiaso.net>

* docs/developer: add local dev docs for yeet

Signed-off-by: Xe Iaso <me@xeiaso.net>

* apply review feedback

Signed-off-by: Xe Iaso <me@xeiaso.net>

* build package artifacts in CI

Signed-off-by: Xe Iaso <me@xeiaso.net>

* tell CI to fetch all git metadata

Signed-off-by: Xe Iaso <me@xeiaso.net>

* rename package builds job

Signed-off-by: Xe Iaso <me@xeiaso.net>

* upload each package individually

Signed-off-by: Xe Iaso <me@xeiaso.net>

* split package build CI jobs

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix code injection?

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix ci?

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix security alert

Signed-off-by: Xe Iaso <me@xeiaso.net>

* docs/local-dev: point people to yeet v1.13.3

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-04-04 08:15:04 -04:00
Xe Iaso
a230a58a1d
cmd/anubis: add --extract-resources flag to extract static assets to the filesystem (#216)
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-04-03 18:24:10 -04:00
dependabot[bot]
0bcc0a2429
build(deps): bump image-size from 1.2.0 to 1.2.1 in /docs (#210)
Bumps [image-size](https://github.com/image-size/image-size) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/image-size/image-size/releases)
- [Commits](https://github.com/image-size/image-size/compare/v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: image-size
  dependency-version: 1.2.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-03 12:53:21 +00:00
Xe Iaso
b14aa6a0c3
Add new Anubis mascot (#204)
* Add new Anubis mascot

Signed-off-by: Xe Iaso <me@xeiaso.net>

* web: add artist credit to footer

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-04-03 07:54:24 -04:00
Xe Iaso
21a9d77788
data/botPolicies: allow iMessage scraper by default (#178)
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-04-03 00:03:28 +00:00
Xe Iaso
266d8c0cc2
add a Makefile (#191)
* add a Makefile

Based on advice from IRC, a makefile helps downstream packagers
understand how to build the software.

Signed-off-by: Xe Iaso <me@xeiaso.net>

* Apply review suggestions

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-04-02 23:57:28 +00:00
Patrick Linnane
01c2e45843
dependabot: enable (#189)
* dependabot: enable

Signed-off-by: Patrick Linnane <patrick@linnane.io>

* dependabot: group updates

Signed-off-by: Patrick Linnane <patrick@linnane.io>

---------

Signed-off-by: Patrick Linnane <patrick@linnane.io>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-04-02 00:09:46 -04:00
Patrick Linnane
fc237a1690
workflows: fix zizmor findings (part 1) (#190)
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2025-04-01 22:33:44 +00:00
Patrick Linnane
6af7c5891f
ci: add zizmor (#188)
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2025-04-01 17:56:27 -04:00
Patrick Linnane
661d72474b
various: fix minor typos (#187)
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2025-04-01 17:14:02 +00:00
Talya Connor
2b28439137
docs: document ED25519_PRIVATE_KEY_HEX_FILE (#186) 2025-03-31 22:35:51 -04:00
Talya Connor
08bb7f953c
cmd/anubis: support ED25519_PRIVATE_KEY_HEX_FILE (#185) 2025-03-31 20:20:06 -04:00
Henri Vasserman
b4a2e1a6a0
lib/anubis: actually check the result with the correct difficulty (#180)
* cmd/anubis actually check the result with the correct difficulty

* chore: changelog

* test(cmd/anubis): make test check for difficulty

* lib: add regression test for CVE-2025-24369

Signed-off-by: Xe Iaso <me@xeiaso.net>

* bump VERSION and CHANGELOG

Tracks #181

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-31 18:42:12 -04:00
Cyra Westmere
28828a2e93
web/js: Added a wait with button continue + 30 second auto continue after 30s if you click "Why am I seeing this? (#166)
* web/js: update page to allow users to read the "Why am I seeing this?", complete with a button to send them through after challenge completed, and a 30s timeout that does the same.

* .gitignore: added .DS_store.

* docs/docs/CHANGELOG: added to the Unreleased section as requested in code quality guidelines

* web: pushing index_templ.go alongside this update.

* package.json: added postcss to dependencies list.

* package-lock: added postcss to dependencies

* Revert "package-lock: added postcss to dependencies"

This reverts commit bf02e7ba56e8bf8705821d4f4864c66b1ef614bf.

* Revert "package.json: added postcss to dependencies list."

This reverts commit 1a38c63049dc75099dc652ed725c7862eef4b3e4.

* web/js: OG comments are important

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-31 02:29:55 +00:00
Jason Cameron
feca1ddeea
Fix: Correct typo in challenge page title (main) (#174)
- Fixed a typo in the challenge page title, removing
  an unnecessary backslash.
- Updated the index page title to "Making sure
  you're not a bot!".

Signed-off-by: Jason Cameron <git@jasoncameron.dev>
2025-03-30 22:24:47 -04:00
Jason Cameron
eab62f7611
fix(tests): disable integration tests on Windows due to posix feature reliance (#169)
Signed-off-by: Jason Cameron <git@jasoncameron.dev>
2025-03-30 20:59:08 +00:00
Jason Cameron
5a07684f99
fix(logs): Correctly format listener address (#162)
* fix: Correctly format listener address (https://github.com/TecharoHQ/anubis/issues/93)

Handle addresses that include a hostname, not just ports.  If
the address starts with a colon, assume it's just a port and
prefix it with "http://localhost".  Otherwise, prefix the
entire address with "http://".  This ensures that the listener
URL is correctly formatted regardless of whether it includes
a hostname or just a port.

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

* chore(docs): add changelog entry

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

---------

Signed-off-by: Jason Cameron <git@jasoncameron.dev>
2025-03-29 23:51:13 -04:00
Fijxu
4bc00e5a65
web/js: Add LibreJS banner to Anubis JavaScript to allow LibreJS users to run the challenge (#161)
* web/js: add project license in the JavaScript used by Anubis

This will allow LibreJS users to pass the captcha without problems
without having to whitelist anubis manually.

* Update docs/docs/CHANGELOG.md

Co-authored-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Fijxu <fijxu@nadeko.net>

---------

Signed-off-by: Fijxu <fijxu@nadeko.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-29 23:48:12 -04:00
jae beller
5237291072
Debug tool for benchmarking proof-of-work algorithms (#155)
* cmd/anubis: add a debug option for benchmarking hashrate

Having the ability to benchmark different proof-of-work implementations
is useful for extending Anubis. This adds a flag `--debug-benchmark-js`
(and its associated environment variable `DEBUG_BENCHMARK_JS`) for
serving a tool to do so.

Internally, a there is a new policy action, "DEBUG_BENCHMARK", which
serves the benchmarking tool instead of a challenge. The flag then
replaces all bot rules with a special rule matching every request
to that action. The benchmark page makes heavy use of inline styles,
because currently all global styles are shared across all pages. This
could be fixed, but I wanted to avoid major changes to the templates.

* web/js: add signal for aborting an active proof-of-work algorithm

Both proof-of-work algorithms now take an optional `AbortSignal`, which
immediately terminates all workers and returns `false` if aborted before
the challenge is complete.

* web/js: add algorithm comparison to the benchmark page

"Compare:" is added to the benchmark page for testing the relative
performance between two algorithms. Since benchmark runs generally have
high variance, it may take a while for the averages to converge on a
stable difference.

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-29 23:38:12 -04:00
Jason Cameron
0f41388bd7
Add periodic cleanup job for DecayMap (#8) (#158)
* Add periodic cleanup job for DecayMap

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

* Refactor: Improve DecayMap cleanup tests and add Len method

- Refactored DecayMap cleanup tests to use the new Len method
  for more precise assertions.
- Added a Len method to DecayMap to retrieve the number of
  entries.
- Simplified conditional checks in Get method.

* chore(changelog): add entry

* fix(tests): Use Impl.expire for decaymap cleanup

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

---------

Signed-off-by: Jason Cameron <git@jasoncameron.dev>
2025-03-29 23:24:06 -04:00
Fijxu
052316ba25
cmd/containerbuild: use TrimSuffix instead of TrimRight (#157)
Using TrimRight will remove all characters from `*dockerRepo` from right
to left that match a character contained on `"/"+filepath.Base(*dockerRepo)`
(the cutset) until it doesn't matches anymore.

So for example, if `dockerRepo` is `example.com/fijxu/anubis`, and
`"/"+filepath.Base(*dockerRepo)` is `/anubis`, it will remove
`u/anubis` and not just `/anubis` from `dockerRepo` because `u` is a character inside the
cutoff.
2025-03-29 23:12:19 -04:00
Xe Iaso
db5143ae7a
docs/developer/building-anubis: fix syntax
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-29 22:18:45 -04:00
jae beller
3771a3b627
Show a progress bar for the probability of completing the proof of work challenge (#87)
Since the challenge is done off of the main thread, there is no simple
way to report the progress done towards completing it. This change
adds a callback parameter, `progressCallback`, which is called with
the most recently attempted nonce every ~1024 iterations (should this
be configurable?). For the single-threaded "slow" algorithm, this is
exactly every 1024 iterations. For the multi-threaded "fast" algorithm,
threads take turns reporting in a round-robin as then notice they
have passed a multiple of 1024. This complexity is to avoid individual
threads falling behind their siblings due to the overhead of messaging
the main thread. To minimize this overhead as much as possible, a
regular number is sent instead of an object.

With the new information provided by the callback, a hash rate display
is added to the challenge page. This display is updated at most once
per second and set with tabular numbers to avoid the constantly changing
value being too visually distracting.

* web: show a progress bar based on completion probability

To provide more feedback to the user, the spinner is replaced with a
progress bar of the probability the challenge is complete. Since it
looks a little weird that a progress bar would fill up a quarter of the
way and then jump to the end (even though the probability would make
that happen 1 in 4 times), the bar is mapped with a quadratic easing
function to move faster at the beginning and then slow down as the
probability of redirection increases. If the probability exceeds 90%,
a message appears letting the user know things are taking longer than
expected and to continue being patient.

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-29 21:24:58 -04:00
Jason Cameron
3683f95933
Add middleware to set Cache-Control header for challenge HTML (#132)
* Add middleware to set Cache-Control header for challenge HTML

* Add `NoStoreCache` middleware function in `internal/headers.go` to set Cache-Control: no-store header
* Apply `NoStoreCache` middleware in `cmd/anubis/main.go` to set Cache-Control header for challenge HTML

* docs: Add no-cache header information for challenge page

* docs: Update changelog to reflect no-store Cache-Control header addition for challenge page

* refactor: rename variable for clarity and update caching middleware in RenderIndex

* chore: move changes to the unreleased section

Signed-off-by: Jason Cameron <git@jasoncameron.dev>

---------

Signed-off-by: Jason Cameron <jasoncameron.all@gmail.com>
Signed-off-by: Jason Cameron <git@jasoncameron.dev>
2025-03-29 21:15:50 -04:00
Xe Iaso
168329fff0
docs/developer: add build directions for manually building Anubis (#154)
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-29 20:12:35 -04:00
Xe Iaso
6b2ae30bae
web/js: show more errors when some probable error cases happen (#151)
Closes #150

This should hopefully make Anubis more self-describing when errors do
happen so users can self-service.
2025-03-28 15:47:18 -04:00
Xe Iaso
937f1dd330
all: do not commit generated JS/CSS to source control (#148)
Closes #125
Closes #40

Among other things, this moves all of the asset generation to run within
the context of an npm script. Developer documentation stubs have been
added so that people can get started more easily.

The top-level Dockerfile (which is no longer used in production) has
been removed as its presence has been causing confusion. This changeset
will break it anyways.

These changes will make for less "repo churn" as the static assets are
built and rebuilt, at the cost of making the build step more complicated
for downstream packagers. If this becomes a burden, we can explore
making a "release tarball" that contains pre-massaged outputs.
2025-03-28 14:55:25 -04:00
Henri Vasserman
38d62eeb56
Hide directory browsing on the static content (#85)
* Hide directory browsing on the static content

* update changelog
2025-03-28 13:52:14 -04:00
Henri Vasserman
57c3e9f1b2
Change how to make Anubis work without a reverse proxy (#86)
* Change how to make Anubis work without a reverse proxy

* Apply suggestions from code review

Co-authored-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Henri Vasserman <henv@hot.ee>

* add support for unix sockets.

* add env var docs

* lib: fix tests

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Henri Vasserman <henv@hot.ee>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-28 13:38:34 -04:00
Xe Iaso
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 <me@xeiaso.net>
2025-03-28 07:39:14 -04:00
Xe Iaso
a3c026977f
version 1.15.0 (#144)
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-27 16:31:41 -04:00
Xe Iaso
7d4be0dcec
Apply bits of the cookie settings PR one by one (#140)
Enables uses to change the cookie domain and partitioned flags.

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-27 15:24:03 -04:00
Hans5958
d1d63d9c18
docs: fix broken link to default policy file (#137) 2025-03-27 08:43:37 -04:00
Xe Iaso
ecc6b47f90
Revert "lib/anubis: support setting extended cookie flags (#120)" (#134)
This reverts commit e7cbd349f3ff96788dc7a8540d29808ca72e1c44.
2025-03-26 20:50:54 -04:00
Xe Iaso
e7cbd349f3
lib/anubis: support setting extended cookie flags (#120)
* lib/anubis: support setting extended cookie flags

Signed-off-by: Xe Iaso <me@xeiaso.net>

* lib: use cookie name consistently

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-26 19:04:18 -04:00
Henri Vasserman
07bb5f63f9
fix(docs): Make dark mode diff lines readable (#130)
* fix(docs): Make dark mode diff lines readable

If using dark mode, these lines are not legible at all. I separated the colors into variables and added
more contrasting colors for the dark mode.

* chore: add to changelog
2025-03-26 15:44:20 -04:00
Xe Iaso
4155719422
cmd/anubis: allow setting key bytes in flag/envvar (#97)
* cmd/anubis: allow setting key bytes in flag/envvar

Docs are updated to generate a random key on load and when people press
the recycle button.

Signed-off-by: Xe Iaso <me@xeiaso.net>

* review feedback fixups

Signed-off-by: Xe Iaso <me@xeiaso.net>

* Update cmd/anubis/main.go

Signed-off-by: Xe Iaso <me@xeiaso.net>

* Apply suggestions from code review

Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
2025-03-25 17:02:48 -04:00
Yulian Kuncheff
f29a200f09
Linting and staticcheck fixes. (#101)
* Fix linting and staticcheck issues

* Add changelog update

* Remove SetNext
2025-03-25 10:02:05 -04:00
soopyc
18cd8a66a2
docs: minor updates (#98)
* use _ instead of * for italicized text by convention

* remove mention of the `anubis` tag from /x/
2025-03-23 23:49:12 -04:00
Xe Iaso
725e11d3a6
lib: fix default difficulty (#96)
Before this did not respect the difficulty flag and instead used
difficulty 4. This has been fixed.

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-23 18:46:01 -04:00
Yulian Kuncheff
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 <me@xeiaso.net>

* internal/test: install deps

Signed-off-by: Xe Iaso <me@xeiaso.net>

* .github/workflows: verbose go tests?

Signed-off-by: Xe Iaso <me@xeiaso.net>

* internal/test: sleep 2

Signed-off-by: Xe Iaso <me@xeiaso.net>

* internal/test: nix this test so CI works

Signed-off-by: Xe Iaso <me@xeiaso.net>

* internal/test: warmup per browser?

Signed-off-by: Xe Iaso <me@xeiaso.net>

* internal/test: disable for now :(

Signed-off-by: Xe Iaso <me@xeiaso.net>

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

Closes #83

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-22 18:44:49 -04:00
Valentin Anger
af6f05554f
internal/test: introduce integration tests using Playwright (#81) 2025-03-22 16:36:27 -04:00
Dennis ten Hoove
1509b06cb9
Cleanup regex (#66)
* Cleanup regex

Were were going overkill on the escape characters

* Update docs/docs/CHANGELOG.md

Co-authored-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Dennis ten Hoove <36002865+dennis1248@users.noreply.github.com>

---------

Signed-off-by: Dennis ten Hoove <36002865+dennis1248@users.noreply.github.com>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-22 13:52:14 -04:00
Christian F. Coors
15d801be7d
fix: installation instructions and example (#75) 2025-03-22 07:45:32 -04:00
Xe Iaso
5f7942faca
cmd/anubis: delete example RSS reader rule (#67)
The example/default bot policy document had a rule to allow RSS readers
through based on paths that end with ".rss", ".xml", ".atom", or
".json". Frameworks like Rails will treat these specially, meaning that
going to /things/12345-whateverhaha.json could bypass Anubis.

I checked the history of this rule and it was present in the original
example policy file in Xe/x. This rule is likely a mistake and it has
been removed. I think it was for making my blog still work with RSS
readers.

Thanks to Graham Sutherland for reporting this over email.

Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-03-21 17:20:17 -04:00
Dennis ten Hoove
869e46a4cc
Add MojeekBot (#64)
* Add MojeekBot

* Update docs/docs/CHANGELOG.md

Co-authored-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Dennis ten Hoove <36002865+dennis1248@users.noreply.github.com>

---------

Signed-off-by: Dennis ten Hoove <36002865+dennis1248@users.noreply.github.com>
Co-authored-by: Xe Iaso <me@xeiaso.net>
2025-03-21 16:59:42 -04:00