fix(anubis): improve challenge handling and error reporting (#645)

This commit is contained in:
Jason Cameron 2025-06-11 12:47:06 -04:00 committed by GitHub
parent 6e2eeb9e65
commit bbdee34f37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 10 deletions

View file

@ -67,6 +67,9 @@ func LoadPoliciesOrDefault(fname string, defaultDifficulty int) (*policy.ParsedC
}(fin)
anubisPolicy, err := policy.ParseConfig(fin, fname, defaultDifficulty)
if err != nil {
return nil, fmt.Errorf("can't parse policy file %s: %w", fname, err)
}
var validationErrs []error
for _, b := range anubisPolicy.Bots {
@ -154,7 +157,7 @@ func New(opts Options) (*Server, error) {
// make-challenge is only used in tests. Only enable while version is devel
registerWithPrefix(anubis.APIPrefix+"make-challenge", http.HandlerFunc(result.MakeChallenge), "POST")
}
for _, implKind := range challenge.Methods() {
impl, _ := challenge.Get(implKind)
impl.Setup(mux)