mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 11:42:24 -05:00
[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
This commit is contained in:
parent
2ca234f42e
commit
570fa7c359
8 changed files with 243 additions and 92 deletions
|
|
@ -58,6 +58,18 @@ func (suite *AccountTestSuite) TestGetAccountByIDWithExtras() {
|
|||
suite.NotEmpty(account.HeaderMediaAttachment.URL)
|
||||
}
|
||||
|
||||
func (suite *AccountTestSuite) TestGetAccountByUsernameDomain() {
|
||||
testAccount1 := suite.testAccounts["local_account_1"]
|
||||
account1, err := suite.db.GetAccountByUsernameDomain(context.Background(), testAccount1.Username, testAccount1.Domain)
|
||||
suite.NoError(err)
|
||||
suite.NotNil(account1)
|
||||
|
||||
testAccount2 := suite.testAccounts["remote_account_1"]
|
||||
account2, err := suite.db.GetAccountByUsernameDomain(context.Background(), testAccount2.Username, testAccount2.Domain)
|
||||
suite.NoError(err)
|
||||
suite.NotNil(account2)
|
||||
}
|
||||
|
||||
func (suite *AccountTestSuite) TestUpdateAccount() {
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue