Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): URLとURIが異なるエンティティの照会に失敗する問題を修正 #15107

Closed
wants to merge 16 commits into from

Conversation

kakkokari-gtyih
Copy link
Contributor

What

Public Suffix Listで同一性を判定するように

Why

Fix #15039

Additional info (optional)

https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/773

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@github-actions github-actions bot added packages/backend Server side specific issue/PR packages/backend:test labels Dec 9, 2024
Copy link
Contributor

github-actions bot commented Dec 9, 2024

このPRによるapi.jsonの差分
差分はありません。
Get diff files from Workflow Page

Copy link

codecov bot commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 48.57143% with 18 lines in your changes missing coverage. Please review.

Project coverage is 39.97%. Comparing base (3c81926) to head (419b17c).
Report is 33 commits behind head on develop.

Files with missing lines Patch % Lines
...end/src/core/activitypub/models/ApPersonService.ts 40.00% 9 Missing ⚠️
...s/backend/src/core/activitypub/ApRequestService.ts 0.00% 4 Missing ⚠️
...ckend/src/core/activitypub/models/ApNoteService.ts 0.00% 3 Missing ⚠️
packages/backend/src/core/UtilityService.ts 91.66% 1 Missing ⚠️
.../backend/src/core/activitypub/ApResolverService.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #15107   +/-   ##
========================================
  Coverage    39.96%   39.97%           
========================================
  Files         1563     1563           
  Lines       197878   197890   +12     
  Branches      3646     3653    +7     
========================================
+ Hits         79080    79097   +17     
+ Misses      118193   118188    -5     
  Partials       605      605           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@syuilo
Copy link
Member

syuilo commented Dec 10, 2024

特定のサービスのドメインをハードコードし続けていくのはキリがなさそうだしメンテナンスの負荷が高そうな懸念があるわね

@syuilo
Copy link
Member

syuilo commented Dec 10, 2024

URLとURIを異なるものにしなければならないユースケースってどういうのかしら

@kakkokari-gtyih
Copy link
Contributor Author

URLとURIを異なるものにしなければならないユースケースってどういうのかしら

元Issue(www.threads.netとthreads.net)

@anatawa12
Copy link
Member

そのメンテコストを外にするためにpsl npm packageを使ってるってことではあると思う

@syuilo
Copy link
Member

syuilo commented Dec 10, 2024

URLとURIを異なるものにしなければならないユースケースってどういうのかしら

元Issue(www.threads.netとthreads.net)

threads側で同じものにできない理由がある…?

@anatawa12
Copy link
Member

ユースケース的にはActivity Pub用のidとwebページ上のページを分けたいってのはありそう。その使い分けとしてurl uriを分けることが適切なのかは怪しい気もするけど。(threads.netがやってること)

リダイレクト処理ができなくはないけどCDNによってはVary対応がなかったり(CF等)複雑になったりがあるから別URLにした需要は十分あるかなと

@syuilo
Copy link
Member

syuilo commented Dec 10, 2024

そのメンテコストを外にするためにpsl npm packageを使ってるってことではあると思う

pslも結局は様々なサービスのドメインを列挙してるだけに見えるからpslがメンテナンスされ続けていく必要があるしメモリの観点からもあまり好ましくなさそう

This reverts commit b5b94d5.
@samunohito
Copy link
Member

まずは一時対応として取り込んでみるのは如何でしょうか…?
この対応で不十分 or さらに良い対応方法が見つかった場合は改めて修正すれば良いと思います。

この現象で苦しんでいるサーバは多いので、まずは動くようにすることが肝要かと思います

@kakkokari-gtyih
Copy link
Contributor Author

あげ

@dakkar
Copy link
Contributor

dakkar commented Dec 18, 2024

you skipped the special handling of masto.host (see https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/773/diffs#7273672166a7d0ec40636692f141ea9fc30a95f1_125_126 )

masto.host provides their customers with Mastodon instances responding to hostnames like something.masto.host; the PSL does not consider masto.host a public suffix, therefore all *.masto.host instances would be considered "the same thing" unless we special-case the domain. as a consequence, the code in this PR allows any masto.host customer to (try to) impersonate any other

@dakkar
Copy link
Contributor

dakkar commented Dec 18, 2024

特定のサービスのドメインをハードコードし続けていくのはキリがなさそうだしメンテナンスの負荷が高そうな懸念があるわね

yes, I understand the concern

the PSL is literally a list of specific services, managed by hand

here we only add a few; there's not that many fediverse hosting services that provide sub-domains

@kakkokari-gtyih
Copy link
Contributor Author

kakkokari-gtyih commented Dec 18, 2024

you skipped the special handling of masto.host (see https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/773/diffs#7273672166a7d0ec40636692f141ea9fc30a95f1_125_126 )

masto.host provides their customers with Mastodon instances responding to hostnames like something.masto.host; the PSL does not consider masto.host a public suffix, therefore all *.masto.host instances would be considered "the same thing" unless we special-case the domain. as a consequence, the code in this PR allows any masto.host customer to (try to) impersonate any other

(Off-topic) This should be corrected on the masto.host side, too (xsns.jp as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/backend:test packages/backend Server side specific issue/PR
Projects
Development

Successfully merging this pull request may close these issues.

2024.11.0でurlとuriのドメインが違うノートが読めない
5 participants