[backend/federation] Add extra guard clauses to UserService
This should be caught by WebFingerService, but more checks are always a good idea.
This commit is contained in:
parent
d36fa802d8
commit
5d1e1ed05d
1 changed files with 2 additions and 0 deletions
|
@ -104,6 +104,8 @@ public class UserService(
|
||||||
logger.LogDebug("Creating user {acct} with uri {uri}", acct, uri);
|
logger.LogDebug("Creating user {acct} with uri {uri}", acct, uri);
|
||||||
|
|
||||||
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");
|
||||||
|
if (host == instance.Value.WebDomain || host == instance.Value.AccountDomain)
|
||||||
|
throw GracefulException.UnprocessableEntity("Refusing to create remote user on local instance domain");
|
||||||
if (await fedCtrlSvc.ShouldBlockAsync(uri, host))
|
if (await fedCtrlSvc.ShouldBlockAsync(uri, host))
|
||||||
throw GracefulException.UnprocessableEntity("Refusing to create user on blocked instance");
|
throw GracefulException.UnprocessableEntity("Refusing to create user on blocked instance");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue