mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 13:32:25 -05:00
[bugfix] Ensure activities sender always = activities actor (#2608)
This commit is contained in:
parent
aa396c78d3
commit
b6fe8e7a5b
6 changed files with 147 additions and 15 deletions
|
|
@ -19,6 +19,8 @@ package federatingdb
|
|||
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
"slices"
|
||||
|
||||
"codeberg.org/gruf/go-logger/v2/level"
|
||||
"github.com/superseriousbusiness/activity/streams/vocab"
|
||||
|
|
@ -39,11 +41,25 @@ func (f *federatingDB) Announce(ctx context.Context, announce vocab.ActivityStre
|
|||
l.Debug("entering Announce")
|
||||
}
|
||||
|
||||
receivingAccount, _, internal := extractFromCtx(ctx)
|
||||
receivingAccount, requestingAccount, internal := extractFromCtx(ctx)
|
||||
if internal {
|
||||
return nil // Already processed.
|
||||
}
|
||||
|
||||
// Ensure requestingAccount is among
|
||||
// the Actors doing the Announce.
|
||||
//
|
||||
// We don't support Announce forwards.
|
||||
actorIRIs := ap.GetActorIRIs(announce)
|
||||
if !slices.ContainsFunc(actorIRIs, func(actorIRI *url.URL) bool {
|
||||
return actorIRI.String() == requestingAccount.URI
|
||||
}) {
|
||||
return gtserror.Newf(
|
||||
"requestingAccount %s was not among Announce Actors",
|
||||
requestingAccount.URI,
|
||||
)
|
||||
}
|
||||
|
||||
boost, isNew, err := f.converter.ASAnnounceToStatus(ctx, announce)
|
||||
if err != nil {
|
||||
return gtserror.Newf("error converting announce to boost: %w", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue