Implement server whitelist

This commit is contained in:
enaix 2025-01-16 12:31:37 +03:00
parent add73ec866
commit b2ecd5648c
14 changed files with 332 additions and 0 deletions

View file

@ -86,6 +86,10 @@ func (a *FederationInternalAPI) QueryServerKeys(
}
util.GetLogger(ctx).WithField("server", req.ServerName).WithError(err).Warn("notary: failed to satisfy keys request entirely from cache, hitting direct")
if !a.IsWhitelistedOrAny(req.ServerName) {
return nil
}
serverKeys, err := a.fetchServerKeysDirectly(ctx, req.ServerName)
if err != nil {
// try to load as much as we can from the cache in a best effort basis