deliver-delayed で URL のパースに失敗した際に全てがコケる問題を修正 (#164)
* deliver-delayed で URL のパースに失敗した際に全てがコケる問題を修正 * validateActor に inbox / sharedInbox のバリデーションを追加 * fix quote * 念のため inbox-delayed も
This commit is contained in:
parent
1144fbc892
commit
9c0fcf0e06
|
@ -156,6 +156,21 @@ export class ApPersonService implements OnModuleInit {
|
|||
throw new Error('invalid Actor: wrong inbox');
|
||||
}
|
||||
|
||||
try {
|
||||
new URL(x.inbox);
|
||||
} catch {
|
||||
throw new Error('invalid Actor: wrong inbox');
|
||||
}
|
||||
|
||||
const sharedInbox = x.sharedInbox ?? x.endpoints?.sharedInbox;
|
||||
if (typeof sharedInbox === 'string') {
|
||||
try {
|
||||
new URL(sharedInbox);
|
||||
} catch {
|
||||
throw new Error('invalid Actor: wrong sharedInbox');
|
||||
}
|
||||
}
|
||||
|
||||
if (!(typeof x.preferredUsername === 'string' && x.preferredUsername.length > 0 && x.preferredUsername.length <= 128 && /^\w([\w-.]*\w)?$/.test(x.preferredUsername))) {
|
||||
throw new Error('invalid Actor: wrong username');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue