From 570fa7c3598118ded6df7ced0a5326f54e7a43e2 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sat, 20 Aug 2022 22:47:19 +0200 Subject: [bugfix] Fix potential dereference of accounts on own instance (#757) * add GetAccountByUsernameDomain * simplify search * add escape to not deref accounts on own domain * check if local + we have account by ap uri --- internal/cache/account_test.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/cache/account_test.go') diff --git a/internal/cache/account_test.go b/internal/cache/account_test.go index ff882cc3d..a6d3c6b7d 100644 --- a/internal/cache/account_test.go +++ b/internal/cache/account_test.go @@ -69,6 +69,10 @@ func (suite *AccountCacheTestSuite) TestAccountCache() { if account.URL != "" && !ok && !accountIs(account, check) { suite.Fail("Failed to fetch expected account with URL: %s", account.URL) } + check, ok = suite.cache.GetByUsernameDomain(account.Username, account.Domain) + if !ok && !accountIs(account, check) { + suite.Fail("Failed to fetch expected account with username/domain: %s/%s", account.Username, account.Domain) + } } } -- cgit v1.2.3