Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/anubis: add rule hashes for admin-configured denials #696

Merged
merged 2 commits into from
Mar 17, 2025

Conversation

Xe
Copy link
Owner

@Xe Xe commented Mar 17, 2025

Fixes #695 and addresses a Gnome infrastructure issue by giving users more information without revealing our hand too much.

@Xe Xe requested a review from Copilot March 17, 2025 05:13
@Xe Xe self-assigned this Mar 17, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds rule hash generation for admin-configured denial rules and updates the HTTP response handling based on the rule hash.

  • Added a loop in main to display rule error IDs by computing SHA256 hashes of denied rules.
  • Updated the check function to return both a CheckResult and a pointer to the matched Bot, and adjusted the reverse proxy logic accordingly.
  • Incremented the templ version in the index template file.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

File Description
cmd/anubis/main.go Adds rule hash printing and updates reverse proxy logic to use rule hashes for denied requests.
cmd/anubis/policy.go Introduces Bot.Hash and modifies the check function to return a Bot pointer.
cmd/anubis/index_templ.go Updates templ version to a newer release.

This won't actually happen in real life, but the code paths might change so we should be somewhat defensive.

Co-authored-by: Copilot <[email protected]>
@Xe Xe merged commit 2859f03 into master Mar 17, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant