Skip to content

Commit

Permalink
fix: 削除したノートやユーザーがリモートから参照されると復活することがあるのを修正 (7918)
Browse files Browse the repository at this point in the history
* Fix #7557

* CHANGELOG

* Fix user

* CHANGELOG

* Tune CHANGELOG

* Tune CHANGELOG

* resolver

* Remove check

* Remove import

* CHANGELOG

* Tune

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
  • Loading branch information
2 people authored and atsu1125 committed Feb 19, 2024
1 parent a42a26f commit 43340f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/remote/activitypub/models/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ export async function resolveNote(value: string | IObject, resolver?: Resolver):
}
//#endregion

if (uri.startsWith(config.url)) {
throw { statusCode: 400 };
}

// リモートサーバーからフェッチしてきて登録
// ここでuriの代わりに添付されてきたNote Objectが指定されていると、サーバーフェッチを経ずにノートが生成されるが
// 添付されてきたNote Objectは偽装されている可能性があるため、常にuriを指定してサーバーフェッチを行う。
Expand Down
4 changes: 4 additions & 0 deletions src/remote/activitypub/models/person.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ export async function fetchPerson(uri: string, resolver?: Resolver): Promise<Use
export async function createPerson(uri: string, resolver?: Resolver): Promise<User> {
if (typeof uri !== 'string') throw new Error('uri is not string');

if (uri.startsWith(config.url)) {
throw { statusCode: 400 };
}

if (resolver == null) resolver = new Resolver();

const object = await resolver.resolve(uri) as any;
Expand Down

0 comments on commit 43340f6

Please sign in to comment.