[backend/federation] Reject activities with mismatching activity & actor id hosts
This commit is contained in:
parent
489941adcc
commit
c30dac0210
1 changed files with 3 additions and 0 deletions
|
@ -50,6 +50,9 @@ public class ActivityHandlerService(
|
||||||
if (resolvedActor.Id != authFetchUserId && authFetchUserId != null)
|
if (resolvedActor.Id != authFetchUserId && authFetchUserId != null)
|
||||||
throw GracefulException
|
throw GracefulException
|
||||||
.UnprocessableEntity($"Authorized fetch user id {authFetchUserId} doesn't match resolved actor id {resolvedActor.Id}");
|
.UnprocessableEntity($"Authorized fetch user id {authFetchUserId} doesn't match resolved actor id {resolvedActor.Id}");
|
||||||
|
if (new Uri(activity.Actor.Id).Host != new Uri(activity.Id).Host)
|
||||||
|
throw GracefulException
|
||||||
|
.UnprocessableEntity($"Activity identifier ({activity.Actor.Id}) host doesn't match actor identifier ({activity.Id}) host");
|
||||||
if (resolvedActor.Host == null || resolvedActor.Uri == null)
|
if (resolvedActor.Host == null || resolvedActor.Uri == null)
|
||||||
throw new Exception("resolvedActor.Host and resolvedActor.Uri must not be null at this stage");
|
throw new Exception("resolvedActor.Host and resolvedActor.Uri must not be null at this stage");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue