Commit Graph
53 Commits
Author SHA1 Message Date
dependabot[bot]andGitHub 9f479f578a build(deps): bump github.com/go-jose/go-jose/v3 from 3.0.4 to 3.0.5 (#1629)
Signed-off-by: dependabot[bot] <[email protected]>
2026-05-14 14:07:24 -04:00
Jason CameronandGitHub 2aaee6c348 Revert "build(deps): bump the gomod group across 1 directory with 3 updates (…" (#1386) 2026-01-04 00:13:45 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Jason Cameron
ebad69a4e1 build(deps): bump the gomod group across 1 directory with 3 updates (#1370)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jason Cameron <[email protected]>
2026-01-03 19:06:05 -05:00
Xe IasoandGitHub 122e4bc072 feat: first implementation of honeypot logic (#1342)
* feat: first implementation of honeypot logic

This is a bit of an experiment, stick with me.

The core idea here is that badly written crawlers are that: badly
written. They look for anything that contains `<a href="whatever" />`
tags and will blindly use those values to recurse. This takes advantage
of that by hiding a link in a `<script>` tag like this:

```html
<script type="ignore"><a href="/bots-only">Don't click</a></script>
```

Browsers will ignore it because they have no handler for the "ignore"
script type.

This current draft is very unoptimized (it takes like 7 seconds to
generate a page on my tower), however switching spintax libraries will
make this much faster.

The hope is to make this pluggable with WebAssembly such that we force
administrators to choose a storage method. First we crawl before we
walk.

The AI involvement in this commit is limited to the spintax in
affirmations.txt, spintext.txt, and titles.txt. This generates a bunch
of "pseudoprofound bullshit" like the following:

> This Restoration to Balance & Alignment
>
> There's a moment when creators are being called to realize that the work
> can't be reduced to results, but about energy. We don't innovate products
> by pushing harder, we do it by holding the vision. Because momentum can't
> be forced, it unfolds over time when culture are moving in the same
> direction. We're being invited into a paradigm shift in how we think
> about innovation. [...]

This is intended to "look" like normal article text. As this is a first
draft, this sucks and will be improved upon.

Assisted-by: GLM 4.6, ChatGPT, GPT-OSS 120b
Signed-off-by: Xe Iaso <[email protected]>

* fix(honeypot/naive): optimize hilariously

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

* feat(honeypot/naive): attempt to automatically filter out based on crawling

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

* fix(lib): use mazeGen instead of bsGen

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

* docs: add honeypot docs

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

* chore(test): go mod tidy

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

* chore: fix spelling metadata

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

* chore: spelling

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

---------

Signed-off-by: Xe Iaso <[email protected]>
2025-12-16 04:14:29 -05:00
cb91145352 build(deps): bump the gomod group across 1 directory with 6 updates (#1341)
Co-authored-by: Jason Cameron <[email protected]>
2025-12-15 02:43:18 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Jason Cameron
cb689ee55b build(deps): bump the gomod group with 5 updates (#1316)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jason Cameron <[email protected]>
2025-12-01 03:14:20 +00:00
Xe IasoandGitHub f032d5d0ac feat: writing logs to the filesystem with rotation support (#1299)
* refactor: move lib/policy/config to lib/config

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

* refactor: don't set global loggers anymore

Ref #864

You were right @kotx, it is a bad idea to set the global logger
instance.

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

* feat(config): add log sink support

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

* chore: update spelling

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

* chore(test): go mod tidy

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

* chore: update spelling

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

* docs(admin/policies): add logging block documentation

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

* docs: update CHANGELOG

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

* fix(cmd/anubis): revert this change, it's meant to be its own PR

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

* chore: go mod tidy

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

* test: add file logging smoke test

Assisted-by: GLM 4.6 via Claude Code
Signed-off-by: Xe Iaso <[email protected]>

* fix: don't expose the old log file time format string

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

---------

Signed-off-by: Xe Iaso <[email protected]>
2025-11-21 11:46:00 -05:00
26fd86bb9a build(deps): bump github.com/testcontainers/testcontainers-go (#1288)
Co-authored-by: Jason Cameron <[email protected]>
2025-11-16 23:47:41 +00:00
Jason CameronandGitHub 0258f6b59c build(deps): bump go deps (#1287) 2025-11-16 23:41:20 +00:00
df217d61c8 build(deps): bump the gomod group across 1 directory with 18 updates (#1237)
Co-authored-by: Jason Cameron <[email protected]>
2025-11-03 01:24:26 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
ff33982ee9 build(deps): bump github.com/docker/docker (#1131)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 28.3.2+incompatible to 28.3.3+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v28.3.2...v28.3.3)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-version: 28.3.3+incompatible
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-27 14:29:07 -04:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
ec90a8b87d build(deps): bump github.com/ulikunitz/xz from 0.5.12 to 0.5.14 (#1132)
Bumps [github.com/ulikunitz/xz](https://github.com/ulikunitz/xz) from 0.5.12 to 0.5.14.
- [Commits](https://github.com/ulikunitz/xz/compare/v0.5.12...v0.5.14)

---
updated-dependencies:
- dependency-name: github.com/ulikunitz/xz
  dependency-version: 0.5.14
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-27 13:46:23 -04:00
Xe IasoandGitHub 98945fb56f feat(lib/store): add s3api storage backend (#1089)
* feat(lib/store): add s3api storage backend

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

* docs(store/s3api): replace fake S3 API keys with the bee movie script

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

* docs(store/s3api): fix spelling sin

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

* fix(store/s3api): remove vestigal experiment

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

* chore: spelling

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

* chore: spelling

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

* chore(store/s3api): support IsPersistent call

Ref #1088

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

* chore: spelling

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

* chore(test): go mod tidy

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

---------

Signed-off-by: Xe Iaso <[email protected]>
2025-09-07 09:24:14 -04:00
Xe Iaso 987c1d7410 chore(go.mod): depend on at least go 1.24.2
Signed-off-by: Xe Iaso <[email protected]>
2025-07-29 04:06:16 +00:00
826433e8be build(deps): bump the gomod group (#931)
* build(deps): bump the gomod group

* chore: spelling

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

* chore: npm run assets

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

---------

Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: Xe Iaso <[email protected]>
2025-07-28 23:47:18 -04:00
Jason CameronandGitHub dce7ed2405 Revert "build(deps): bump the gomod group with 6 updates (#873)" (#874) 2025-07-21 01:22:40 +00:00
03758405d3 build(deps): bump the gomod group with 6 updates (#873)
Co-authored-by: Jason Cameron <[email protected]>
2025-07-21 00:57:00 +00:00
Xe IasoandGitHub 132b2ed853 feat(cmd/anubis): capture ja4h fingerprints (#834)
This is not used yet, but it will be part of a larger strategy around
adding/removing weight based on JA4H (and other) fingerprint matches
with Thoth.

Signed-off-by: Xe Iaso <[email protected]>
2025-07-14 23:31:33 -04:00
61ce581f36 build(deps): bump the gomod group with 3 updates (#823)
Bumps the gomod group with 3 updates: [github.com/gaissmai/bart](https://github.com/gaissmai/bart), [golang.org/x/net](https://github.com/golang/net) and [golang.org/x/text](https://github.com/golang/text).


Updates `github.com/gaissmai/bart` from 0.20.4 to 0.20.5
- [Release notes](https://github.com/gaissmai/bart/releases)
- [Commits](https://github.com/gaissmai/bart/compare/v0.20.4...v0.20.5)

Updates `golang.org/x/net` from 0.41.0 to 0.42.0
- [Commits](https://github.com/golang/net/compare/v0.41.0...v0.42.0)

Updates `golang.org/x/text` from 0.26.0 to 0.27.0
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.26.0...v0.27.0)

---
updated-dependencies:
- dependency-name: github.com/gaissmai/bart
  dependency-version: 0.20.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: golang.org/x/net
  dependency-version: 0.42.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: golang.org/x/text
  dependency-version: 0.27.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Jason Cameron <[email protected]>
2025-07-13 20:41:26 -04:00
1ea1157cd7 build(deps): bump github.com/shirou/gopsutil/v4 in the gomod group (#771)
Bumps the gomod group with 1 update: [github.com/shirou/gopsutil/v4](https://github.com/shirou/gopsutil).


Updates `github.com/shirou/gopsutil/v4` from 4.25.1 to 4.25.6
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v4.25.1...v4.25.6)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v4
  dependency-version: 4.25.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Jason Cameron <[email protected]>
2025-07-06 21:21:14 -04:00
Xe IasoandGitHub 4ea0add50d feat(lib/policy/expressions): add system load average to bot expression inputs (#766)
* feat(lib/policy/expressions): add system load average to bot expression inputs

This lets Anubis dynamically react to system load in order to
increase and decrease the required level of scrutiny. High load? More
scrutiny required. Low load? Less scrutiny required.

* docs: spell system correctly

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

* Update metadata

check-spelling run (pull_request) for Xe/load-average

Signed-off-by: check-spelling-bot <[email protected]>
on-behalf-of: @check-spelling <[email protected]>

* fix(default-config): don't enable low load average feature by default

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

---------

Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: check-spelling-bot <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
2025-07-06 20:13:50 +00:00
Xe IasoandGitHub dff2176beb feat(lib): use new challenge creation flow (#749)
* feat(decaymap): add Delete method

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

* chore(lib/challenge): refactor Validate to take ValidateInput

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

* feat(lib): implement store interface

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

* feat(lib/store): all metapackage to import all store implementations

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

* chore(policy): import all store backends

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

* feat(lib): use new challenge creation flow

Previously Anubis constructed challenge strings from request metadata.
This was a good idea in spirit, but has turned out to be a very bad idea
in practice. This new flow reuses the Store facility to dynamically
create challenge values with completely random data.

This is a fairly big rewrite of how Anubis processes challenges. Right
now it defaults to using the in-memory storage backend, but on-disk
(boltdb) and valkey-based adaptors will come soon.

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

* chore(decaymap): fix documentation typo

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

* chore(lib): fix SA4004

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

* test(lib/store): make generic storage interface test adaptor

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

* chore: spelling

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

* fix(decaymap): invert locking process for Delete

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

* feat(lib/store): add bbolt store implementation

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

* chore: spelling

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

* chore: go mod tidy

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

* chore(devcontainer): adapt to docker compose, add valkey service

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

* fix(lib): make challenges live for 30 minutes by default

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

* feat(lib/store): implement valkey backend

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

* test(lib/store/valkey): disable tests if not using docker

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

* test(lib/policy/config): ensure valkey stores can be loaded

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

* Update metadata

check-spelling run (pull_request) for Xe/store-interface

Signed-off-by: check-spelling-bot <[email protected]>
on-behalf-of: @check-spelling <[email protected]>

* chore(devcontainer): remove port forwards because vs code handles that for you

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

* docs(default-config): add a nudge to the storage backends section of the docs

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

* chore(docs): listen on 0.0.0.0 for dev container support

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

* docs(policy): document storage backends

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

* docs: update CHANGELOG and internal links

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

* docs(admin/policies): don't start a sentence with as

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

* chore: fixes found in review

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

---------

Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: check-spelling-bot <[email protected]>
2025-07-04 20:42:28 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1820649987 build(deps): bump the gomod group with 2 updates (#736)
---
updated-dependencies:
- dependency-name: github.com/a-h/templ
  dependency-version: 0.3.906
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: sigs.k8s.io/yaml
  dependency-version: 1.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-29 21:32:56 -04:00
ad5430612f feat: implement localization system (#716)
* lib/localization: implement localization system

Locale files are placed in lib/localization/locales/. If you add a
locale, update manifest.json with available locales.

* Exclude locales from check spelling

* tests(lib/localization): add comprehensive translations test

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

* fix(challenge/metarefresh): enable localization

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

* fix: use simple syntax for localization in templ

Also localize CELPHASE into French according to the wishes of the
artist.

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

* chore: spelling

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

* chore:(js): fix forbidden patterns

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

* chore: add goi18n to tools

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

* test(lib/localization): dynamically determine the list of supported languages

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

---------

Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: Xe Iaso <[email protected]>
2025-06-27 17:49:15 +00:00
Jason CameronandGitHub 1562f88c35 chore: Remove unused/dead code (#703)
* chore(xess): remove unused xess templates

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

* chore(checker): remove unused staticHashChecker implementation

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

* feat: add pinact and deadcode to go tools (pinact is used for the gha pinning)

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

* chore: update Docker and kubectl actions to latest versions

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

* chore: update Homebrew action from master to main in workflow files

See  https://github.com/Homebrew/actions/commit/df537ec97fb77a615dc06a860b3d5b6d9c256cdb

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

* chore: remove unused go-colorable and tools dependencies from go.sum

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

* chore: update postcss-import and other dependencies to latest versions

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

* chore: update Docusaurus dependencies to version 3.8.1

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

* chore: downgrade playwright and playwright-core to version 1.52.0

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

---------

Signed-off-by: Jason Cameron <[email protected]>
2025-06-25 09:31:33 -04:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1ca531b930 build(deps): bump the gomod group with 4 updates (#709)
Bumps the gomod group with 4 updates: [github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus](https://github.com/grpc-ecosystem/go-grpc-middleware), [github.com/grpc-ecosystem/go-grpc-middleware/v2](https://github.com/grpc-ecosystem/go-grpc-middleware), [google.golang.org/grpc](https://github.com/grpc/grpc-go) and [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery).


Updates `github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus` from 1.0.1 to 1.1.0
- [Release notes](https://github.com/grpc-ecosystem/go-grpc-middleware/releases)
- [Commits](https://github.com/grpc-ecosystem/go-grpc-middleware/compare/providers/prometheus/v1.0.1...v1.1.0)

Updates `github.com/grpc-ecosystem/go-grpc-middleware/v2` from 2.1.0 to 2.3.2
- [Release notes](https://github.com/grpc-ecosystem/go-grpc-middleware/releases)
- [Commits](https://github.com/grpc-ecosystem/go-grpc-middleware/compare/v2.1.0...v2.3.2)

Updates `google.golang.org/grpc` from 1.72.2 to 1.73.0
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.72.2...v1.73.0)

Updates `k8s.io/apimachinery` from 0.33.1 to 0.33.2
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.33.1...v0.33.2)

---
updated-dependencies:
- dependency-name: github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus
  dependency-version: 1.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: github.com/grpc-ecosystem/go-grpc-middleware/v2
  dependency-version: 2.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: google.golang.org/grpc
  dependency-version: 1.73.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: k8s.io/apimachinery
  dependency-version: 0.33.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-23 15:59:08 -04:00
Jason CameronandGitHub b2b2679bae perf: replace cidranger with bart for significant performance improvements (#675)
* feat: replace cidranger with bart improving performance by 3-20x

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

* perf: replace cidranger with bart for IP range checking

- Replace cidranger.Ranger with bart.Lite in RemoteAddrChecker
- Use netip.ParsePrefix instead of net.ParseCIDR for modern IP handling
- Improve performance: 3-20x faster lookups with zero heap allocations
- Update imports to use github.com/gaissmai/bart and net/netip
- Remove cidranger dependency from go.mod

Benchmark results:
- IPv4 lookups: 4x faster (15.58ns vs 63.25ns, 0 vs 2 allocs)
- IPv6 lookups: 3x faster (26.51ns vs 76.96ns, 0 vs 2 allocs)
- Insertions: 20x faster (976ns vs 19,191ns)
- Large tables: 14x faster (5.2ns vs 74.85ns)

* docs: clarify CHANGELOG to not give false impressions

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

* perf: optimize string concatenation in RemoteAddrChecker hash generation

Replace fmt.Fprintln with strings.Join for 7x faster performance:
- Before: 935.1 ns/op, 784 B/op, 22 allocs/op
- After: 133.2 ns/op, 192 B/op, 1 alloc/op

The hash is used for JWT cookie validation and error code generation.
Comma separation provides the same deterministic uniqueness as newlines
but with significantly better performance during policy initialization.

* chore: remove accidentally commited string benchmark

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

* style: apply Copilot suggestions

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

* fix: reference the right var name

i cannot write a merge commit

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

---------

Signed-off-by: Jason Cameron <[email protected]>
2025-06-17 11:57:55 -04:00
Jason CameronandGitHub e2b46fc5e7 perf: Replace internal SHA256 hashing with xxhash for 4-6x performance improvement (#676)
* perf(internal): Use FastHash for internal hashing
docs: Add xxhash performance improvement to changelog entry
feat(hash): Add fast non-cryptographic hash function

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

* test(hash): add xxhash benchmarks and collision tests

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

* Update metadata

check-spelling run (pull_request) for json/hash

Signed-off-by: check-spelling-bot <[email protected]>
on-behalf-of: @check-spelling <[email protected]>

---------

Signed-off-by: Jason Cameron <[email protected]>
Signed-off-by: check-spelling-bot <[email protected]>
2025-06-16 22:53:53 -04:00
Xe IasoandGitHub e3826df3ab feat: implement a client for Thoth, the IP reputation database for Anubis (#637)
* feat(internal): add Thoth client and simple ASN checker

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

* feat(thoth): cached ip to asn checker

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

* chore: go mod tidy

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

* fix(thoth): minor testing fixups, ensure ASNChecker is Checker

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

* feat(thoth): make ASNChecker instances

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

* feat(thoth): add GeoIP checker

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

* feat(thoth): store a thoth client in a context

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

* chore: refactor Checker type to its own package

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

* test(thoth): add thoth mocking package, ignore context deadline exceeded errors

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

* feat(thoth): pre-cache private ranges

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

* feat(lib/policy/config): enable thoth ASNs and GeoIP checker parsing

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

* chore(thoth): refactor to move checker creation to the checker files

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

* feat(policy): enable thoth checks

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

* feat(thothmock): test helper function for loading a mock thoth instance

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

* feat: wire up Thoth, make thoth checks part of the default config

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

* chore: spelling

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

* fix(thoth): mend staticcheck errors

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

* docs(admin): add Thoth docs

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

* chore(policy): update Thoth links in error messages

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

* docs: update CHANGELOG

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

* chore: spelling

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

* chore(docs/manifest): enable Thoth

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

* chore: add THOTH_INSECURE for contacting Thoth over plain TCP in extreme circumstances

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

* test(thoth): use mock thoth when credentials aren't detected in the environment

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

* chore: spelling

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

* fix(cmd/anubis): better warnings for half-configured Thoth setups

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

* docs(botpolicies): link to Thoth geoip docs

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

---------

Signed-off-by: Xe Iaso <[email protected]>
2025-06-16 11:57:32 -04:00
e0781e4560 feat: add robots2policy CLI to convert robots.txt to Anubis CEL (#657)
* feat: add robots2policy CLI utility to convert robots.txt to Anubis challenge policies

* feat: add documentation for robots2policy CLI tool

* feat: implement crawl delay handling as weight adjustment in Anubis rules

* feat: add various robots.txt and YAML configurations for user agent handling and crawl delays

* test: add comprehensive tests for robots2policy conversion and parsing

* fix: update example URL in usage instructions for robots2policy CLI

* Update metadata

check-spelling run (pull_request) for json/robots2policycli

Signed-off-by: check-spelling-bot <[email protected]>
on-behalf-of: @check-spelling <[email protected]>

* docs: add crawl delay weight adjustment and deny user agents option to robots2policy CLI

* Update cmd/robots2policy/main.go

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

* Update cmd/robots2policy/main.go

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

* fix(robots2policy): use sigs.k8s.io/yaml

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

* feat(config): properly marshal bot policy rules

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

* chore(yeetfile): expose robots2policy in libexec

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

* fix(yeetfile): put robots2policy in $PATH

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

* Update metadata

check-spelling run (pull_request) for json/robots2policycli

Signed-off-by: check-spelling-bot <[email protected]>
on-behalf-of: @check-spelling <[email protected]>

* style: reorder imports

* refactor: use preexisting structs in config

* fix: correct flag check in main function

* fix: reorder fields in AnubisRule struct for better alignment

* style: improve alignment of struct fields in AnubisRule and OGTagCache

* Update metadata

check-spelling run (pull_request) for json/robots2policycli

Signed-off-by: check-spelling-bot <[email protected]>
on-behalf-of: @check-spelling <[email protected]>

* fix: add validation for generated Anubis rules from robots.txt

* feat: add batch processing for robots.txt files to generate Anubis CEL policies

* fix: improve usage message and error handling for input file requirement

* refactor: update AnubisRule structure to use ExpressionOrList for improved expression handling

* refactor: reorganize policy definitions in YAML files for consistency and clarity

* fix: correct indentation in blacklist and complex YAML files for consistency

* test: enhance output comparison in robots2policy tests for YAML and JSON formats

* Revert "fix: improve usage message and error handling for input file requirement"

This reverts commit ddcde1f2a3.

* fix: improve usage message and error handling in robots2policy

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

---------

Signed-off-by: check-spelling-bot <[email protected]>
Signed-off-by: Jason Cameron <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Jason Cameron <[email protected]>
Co-authored-by: Xe Iaso <[email protected]>
2025-06-14 23:41:00 -04:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
988fc0941b build(deps): bump github.com/cloudflare/circl from 1.6.0 to 1.6.1 (#650)
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-version: 1.6.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-11 16:52:10 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
6eaf0e13a2 build(deps): bump the gomod group with 2 updates (#634)
Bumps the gomod group with 2 updates: [github.com/a-h/templ](https://github.com/a-h/templ) and [golang.org/x/net](https://github.com/golang/net).


Updates `github.com/a-h/templ` from 0.3.887 to 0.3.898
- [Release notes](https://github.com/a-h/templ/releases)
- [Changelog](https://github.com/a-h/templ/blob/main/.goreleaser.yaml)
- [Commits](https://github.com/a-h/templ/compare/v0.3.887...v0.3.898)

Updates `golang.org/x/net` from 0.40.0 to 0.41.0
- [Commits](https://github.com/golang/net/compare/v0.40.0...v0.41.0)

---
updated-dependencies:
- dependency-name: github.com/a-h/templ
  dependency-version: 0.3.898
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: golang.org/x/net
  dependency-version: 0.41.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-08 20:44:25 -04:00
Jason CameronandGitHub 9539668049 style: Some minor fixes (#548)
* chore(deps): update dependencies in go.mod and go.sum

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

* refactor: rename variables for clarity in anubis.go and main.go

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

* fix(checker): handle error when inserting IP range in ranger

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

* fix(tests): simplify boolean checks in header and URL value tests

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

* refactor(api): remove unused /test-error endpoint and restrict /make-challenge to development

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

* build(deps): update golang-set to v2.8.0 in go.sum

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

* Update metadata

check-spelling run (pull_request) for json/stuff

Signed-off-by: check-spelling-bot <[email protected]>
on-behalf-of: @check-spelling <[email protected]>

---------

Signed-off-by: Jason Cameron <[email protected]>
Signed-off-by: check-spelling-bot <[email protected]>
2025-06-07 18:21:22 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
b496c90e86 build(deps): bump github.com/a-h/templ in the gomod group (#601)
Bumps the gomod group with 1 update: [github.com/a-h/templ](https://github.com/a-h/templ).


Updates `github.com/a-h/templ` from 0.3.865 to 0.3.887
- [Release notes](https://github.com/a-h/templ/releases)
- [Changelog](https://github.com/a-h/templ/blob/main/.goreleaser.yaml)
- [Commits](https://github.com/a-h/templ/compare/v0.3.865...v0.3.887)

---
updated-dependencies:
- dependency-name: github.com/a-h/templ
  dependency-version: 0.3.887
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-01 23:39:42 -04:00
Xe Iaso 3bc9040a96 chore: bump yeet to v0.6.0
Gives us many nice things like:

* Windows support for yeet (modulo TecharoHQ/yeet#29)
* Removes the dependency on /bin/sh or /bin/bash thanks to
  mvdan.cc/sh/v3
* Checksum-compliant reproducible builds by default

Signed-off-by: Xe Iaso <[email protected]>
2025-06-01 16:33:08 -04:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
6c247cdec8 build(deps): bump k8s.io/apimachinery in the gomod group (#524)
Bumps the gomod group with 1 update: [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery).


Updates `k8s.io/apimachinery` from 0.33.0 to 0.33.1
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.33.0...v0.33.1)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-version: 0.33.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-28 09:41:25 -04:00
Xe IasoandGitHub a0805cad16 chore(go.mod): move yeet to be a go tool (#485)
This means that yeet's version will be managed by `go.mod` and
auto-bumped with dependabot. This removes human error from the equation
and ensures that Anubis is always built with the newest version of yeet.

This also makes it trivial to make your own local packages for testing:

```text
go tool yeet
```

Signed-off-by: Xe Iaso <[email protected]>
2025-05-09 18:33:44 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Xe Iaso
2e54e839f1 build(deps): bump the gomod group across 1 directory with 4 updates (#457)
* build(deps): bump the gomod group across 1 directory with 4 updates

Bumps the gomod group with 4 updates in the / directory: [github.com/a-h/templ](https://github.com/a-h/templ), [github.com/playwright-community/playwright-go](https://github.com/playwright-community/playwright-go), [golang.org/x/net](https://github.com/golang/net) and [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery).


Updates `github.com/a-h/templ` from 0.3.857 to 0.3.865
- [Release notes](https://github.com/a-h/templ/releases)
- [Changelog](https://github.com/a-h/templ/blob/main/.goreleaser.yaml)
- [Commits](https://github.com/a-h/templ/compare/v0.3.857...v0.3.865)

Updates `github.com/playwright-community/playwright-go` from 0.5101.0 to 0.5200.0
- [Release notes](https://github.com/playwright-community/playwright-go/releases)
- [Commits](https://github.com/playwright-community/playwright-go/compare/v0.5101.0...v0.5200.0)

Updates `golang.org/x/net` from 0.39.0 to 0.40.0
- [Commits](https://github.com/golang/net/compare/v0.39.0...v0.40.0)

Updates `k8s.io/apimachinery` from 0.32.3 to 0.33.0
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.32.3...v0.33.0)

---
updated-dependencies:
- dependency-name: github.com/a-h/templ
  dependency-version: 0.3.865
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/playwright-community/playwright-go
  dependency-version: 0.5200.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: golang.org/x/net
  dependency-version: 0.40.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: k8s.io/apimachinery
  dependency-version: 0.33.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore: go mod tidy && npm run assets

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

* ci: use playwright managed by npm

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

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xe Iaso <[email protected]>
2025-05-07 17:48:10 -04:00
Xe IasoandGitHub 16412a8bf9 ci: add govulncheck (#456)
This is intended to catch low-hanging fruit.

Signed-off-by: Xe Iaso <[email protected]>
2025-05-06 14:07:55 +00:00
Xe IasoandGitHub 865d513e35 feat(checker): add CEL for matching complicated expressions (#421)
* feat(lib/policy): add support for CEL checkers

This adds the ability for administrators to use Common Expression
Language[0] (CEL) for more advanced check logic than Anubis previously
offered.

These can be as simple as:

```yaml
- name: allow-api-routes
  action: ALLOW
  expression:
    and:
    - '!(method == "HEAD" || method == "GET")'
    - path.startsWith("/api/")
```

or get as complicated as:

```yaml
- name: allow-git-clients
  action: ALLOW
  expression:
    and:
    - userAgent.startsWith("git/") || userAgent.contains("libgit") || userAgent.startsWith("go-git") || userAgent.startsWith("JGit/") || userAgent.startsWith("JGit-")
    - >
      "Git-Protocol" in headers && headers["Git-Protocol"] == "version=2"
```

Internally these are compiled and evaluated with cel-go[1]. This also
leaves room for extensibility should that be desired in the future. This
will intersect with #338 and eventually intersect with TLS fingerprints
as in #337.

[0]: https://cel.dev/
[1]: https://github.com/google/cel-go

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

* feat(data/apps): add API route allow rule for non-HEAD/GET

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

* docs: document expression syntax

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

* fix: fixes in review

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

---------

Signed-off-by: Xe Iaso <[email protected]>
2025-05-03 14:26:54 -04:00
301c7a42bd refactor(lib): Split up anubis.go into some smaller files. (#379)
* refactor(logging): centralize logger creation in GetLogger function

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

* refactor(logging): rename GetLogger to GetRequestLogger for clarity

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

* refactor: streamline error handling and response methods

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

* refactor(lib): Split anubis.go up into some smaller specialized methods

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

* refactor(http): simplify error response handling by using respondWithStatus

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

* chore(lib): run goimports

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

---------

Signed-off-by: Jason Cameron <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: Xe Iaso <[email protected]>
2025-04-27 13:36:39 +00:00
d40b5cfdab lib: move config to yaml (#307)
* lib: move config to yaml

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

* web: run go generate

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

* Add Haiku to known instances (#304)

Signed-off-by: Asmodeus <[email protected]>

* Add headers bot rule (#300)

* Closes #291: add headers support to bot policy rules

* Fix config validator

* update docs for JSON -> YAML

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

* docs: document http header based actions

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

* lib: add missing test

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

* Apply suggestions from code review

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

---------

Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Asmodeus <[email protected]>
Co-authored-by: Asmodeus <[email protected]>
Co-authored-by: Neur0toxine <[email protected]>
Co-authored-by: Copilot <[email protected]>
2025-04-21 00:09:27 +00:00
Ryan CaoandGitHub f844dba3dc perf: embed challenge data in HTML (#279) 2025-04-18 00:06:37 -04:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Xe Iaso
2ebce26709 build(deps): bump the gomod group with 3 updates (#265)
* build(deps): bump the gomod group with 3 updates

Bumps the gomod group with 3 updates: [github.com/playwright-community/playwright-go](https://github.com/playwright-community/playwright-go), [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) and [golang.org/x/net](https://github.com/golang/net).


Updates `github.com/playwright-community/playwright-go` from 0.5001.0 to 0.5101.0
- [Release notes](https://github.com/playwright-community/playwright-go/releases)
- [Commits](https://github.com/playwright-community/playwright-go/compare/v0.5001.0...v0.5101.0)

Updates `github.com/prometheus/client_golang` from 1.21.1 to 1.22.0
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.21.1...v1.22.0)

Updates `golang.org/x/net` from 0.38.0 to 0.39.0
- [Commits](https://github.com/golang/net/compare/v0.38.0...v0.39.0)

---
updated-dependencies:
- dependency-name: github.com/playwright-community/playwright-go
  dependency-version: 0.5101.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: github.com/prometheus/client_golang
  dependency-version: 1.22.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: golang.org/x/net
  dependency-version: 0.39.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <[email protected]>

* internal/test: bump playwright version

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

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xe Iaso <[email protected]>
2025-04-15 05:55:50 -04:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Xe Iaso
0928c3c830 build(deps): bump the gomod group across 1 directory with 2 updates (#233)
* build(deps): bump the gomod group across 1 directory with 2 updates

Bumps the gomod group with 2 updates in the / directory: [github.com/a-h/templ](https://github.com/a-h/templ) and [golang.org/x/net](https://github.com/golang/net).


Updates `github.com/a-h/templ` from 0.3.833 to 0.3.857
- [Release notes](https://github.com/a-h/templ/releases)
- [Changelog](https://github.com/a-h/templ/blob/main/.goreleaser.yaml)
- [Commits](https://github.com/a-h/templ/compare/v0.3.833...v0.3.857)

Updates `golang.org/x/net` from 0.37.0 to 0.38.0
- [Commits](https://github.com/golang/net/compare/v0.37.0...v0.38.0)

---
updated-dependencies:
- dependency-name: github.com/a-h/templ
  dependency-version: 0.3.857
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: golang.org/x/net
  dependency-version: 0.38.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <[email protected]>

* run go generate

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

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xe Iaso <[email protected]>
2025-04-07 14:21:29 +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 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
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
9d68e73d03 build(deps): bump github.com/go-jose/go-jose/v3 from 3.0.3 to 3.0.4 (#89)
Bumps [github.com/go-jose/go-jose/v3](https://github.com/go-jose/go-jose) from 3.0.3 to 3.0.4.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Changelog](https://github.com/go-jose/go-jose/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-jose/go-jose/compare/v3.0.3...v3.0.4)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-22 21:18:02 -04:00
Valentin AngerandGitHub af6f05554f internal/test: introduce integration tests using Playwright (#81) 2025-03-22 16:36:27 -04:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
c66305904b build(deps): bump github.com/golang-jwt/jwt/v5 from 5.2.1 to 5.2.2 (#74)
Bumps [github.com/golang-jwt/jwt/v5](https://github.com/golang-jwt/jwt) from 5.2.1 to 5.2.2.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v5.2.1...v5.2.2)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-21 20:41:19 -04:00