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

activitypub.resolve_remote_id throws IntegrityError if remote user has unknown alias #3426

Closed
hughrun opened this issue Aug 29, 2024 · 0 comments · Fixed by #3432
Closed
Labels
bug Something isn't working

Comments

@hughrun
Copy link
Contributor

hughrun commented Aug 29, 2024

Describe the bug
Resolving remote users who have unknown users set as an alias may fail.

To Reproduce
Steps to reproduce the behavior:

  1. call activitypub.resolve_remote_id to retrieve details of remote user A and add them to the local DB
  2. remote user A has set remote user B as an alias in their also_known_as list
  3. remote user B is not known to the local server, and therefore their ID cannot be resolved
  4. error: null value in column "to_user_id" of relation "bookwyrm_user_also_known_as" violates not-null constraint

Expected behavior
activitypub.resolve_remote_id should deal with unknown alias users, probably by recursively calling activitypub.resolve_remote_id on every alias

Screenshots
If applicable, add screenshots to help explain your problem.

Instance
Development instance

Additional context
I stumbled across this when I was doing some work on improving user imports. So caveat on this: I think there is a broader bug, but it's possible this is only relevant for user imports.

Thinking about what is actually happening here, it's possible this is actually even worse because if the user ID does exist in the local DB, would it just set a totally different user as the alias? Need to do some more testing.


Desktop (please complete the following information):
- OS: [e.g. iOS]: Docker on Mac
- Browser [e.g. chrome, safari]: Firefox
- Version [e.g. 22]: main branch

@hughrun hughrun added the bug Something isn't working label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@hughrun and others