[backend/core] Validate actor public key host
This commit is contained in:
parent
cabe5d52e7
commit
25a50ef9eb
1 changed files with 2 additions and 1 deletions
|
@ -113,9 +113,10 @@ public class UserService(
|
||||||
|
|
||||||
if (actor.Id != uri)
|
if (actor.Id != uri)
|
||||||
throw GracefulException.UnprocessableEntity("Uri doesn't match id of fetched actor");
|
throw GracefulException.UnprocessableEntity("Uri doesn't match id of fetched actor");
|
||||||
|
|
||||||
if (actor.PublicKey?.Id == null || actor.PublicKey?.PublicKey == null)
|
if (actor.PublicKey?.Id == null || actor.PublicKey?.PublicKey == null)
|
||||||
throw GracefulException.UnprocessableEntity("Actor has no valid public key");
|
throw GracefulException.UnprocessableEntity("Actor has no valid public key");
|
||||||
|
if (new Uri(actor.PublicKey.Id).Host != new Uri(actor.Id).Host)
|
||||||
|
throw GracefulException.UnprocessableEntity("Actor public key id host doesn't match actor id host");
|
||||||
|
|
||||||
var host = AcctToTuple(acct).Host ?? throw new Exception("Host must not be null at this stage");
|
var host = AcctToTuple(acct).Host ?? throw new Exception("Host must not be null at this stage");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue