diff options
| author | Julia Johannesen <julia@insertdomain.name> | 2024-11-20 20:06:46 -0500 |
|---|---|---|
| committer | Julia Johannesen <julia@insertdomain.name> | 2024-11-20 20:06:46 -0500 |
| commit | fa3cf6c2996741e642955c5e2fca8ad785e83205 (patch) | |
| tree | dcb1bbf6ffb6626481f1ccfaca50215aa7d42333 /packages/backend/src/core | |
| parent | merge: (re-merge) Prevent DoS from spammed media proxy requests (!763) (diff) | |
| download | sharkey-fa3cf6c2996741e642955c5e2fca8ad785e83205.tar.gz sharkey-fa3cf6c2996741e642955c5e2fca8ad785e83205.tar.bz2 sharkey-fa3cf6c2996741e642955c5e2fca8ad785e83205.zip | |
Fix type error in security fixes
Diffstat (limited to 'packages/backend/src/core')
| -rw-r--r-- | packages/backend/src/core/activitypub/models/ApPersonService.ts | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index 1c117795e9..2119c41569 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -163,13 +163,16 @@ export class ApPersonService implements OnModuleInit { } for (const collection of ['outbox', 'followers', 'following'] as (keyof IActor)[]) { - const collectionUri = getApId((x as IActor)[collection]); - if (typeof collectionUri === 'string' && collectionUri.length > 0) { - if (this.utilityService.punyHost(collectionUri) !== expectHost) { - throw new Error(`invalid Actor: ${collection} has different host`); + const xCollection = (x as IActor)[collection]; + if (xCollection != null) { + const collectionUri = getApId(xCollection); + if (typeof collectionUri === 'string' && collectionUri.length > 0) { + if (this.utilityService.punyHost(collectionUri) !== expectHost) { + throw new Error(`invalid Actor: ${collection} has different host`); + } + } else if (collectionUri != null) { + throw new Error(`invalid Actor: wrong ${collection}`); } - } else if (collectionUri != null) { - throw new Error(`invalid Actor: wrong ${collection}`); } } |