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

Problem mentioning a user (with certain domains) #3467

Open
prolibre opened this issue Nov 10, 2024 · 3 comments
Open

Problem mentioning a user (with certain domains) #3467

prolibre opened this issue Nov 10, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@prolibre
Copy link

prolibre commented Nov 10, 2024

In Bookwyrm 0.7.4

A user of my instance has pointed out to me that in the attached example, one of the three users (the one with the domain lire.im) is not being mentioned correctly.

SharedScreenshot

I should point out that all the accounts are those of mastodon users.

EDIT :

I'd like to add a clarification that I've just discovered. The problem seems to occur when the mastodon instance has two (sub) domains (in parallel): here @[email protected] refers to https://re.lire.im/@account

Thank you and have a nice sunday !

@prolibre prolibre added the bug Something isn't working label Nov 10, 2024
@prolibre prolibre changed the title Problem mentioning a user with an exotic domain Problem mentioning a user (with certain domains) Nov 14, 2024
@hughrun
Copy link
Contributor

hughrun commented Nov 25, 2024

The problem here is that https://lire.im forwards to https://re.lire.im so users at that domain have ambiguous usernames.

For example if we request https://lire.im/.well-known/webfinger/?resource=acct:[email protected] it will forward to https://re.lire.im/.well-known/webfinger/?resource=acct:[email protected], and then give us this:

{
  "subject":"acct:[email protected]",
  "aliases":["https://re.lire.im/@admin","https://re.lire.im/users/admin"],
  "links":[
    {
        "rel":"http://webfinger.net/rel/profile-page",
        "type":"text/html",
        "href":"https://re.lire.im/@admin"
    },
    {  
        "rel":"self",
        "type":"application/activity+json",
        "href":"https://re.lire.im/users/admin"
    }, 
    {  
        "rel":"http://ostatus.org/schema/1.0/subscribe",
        "template":"https://re.lire.im/authorize_interaction?uri={uri}"
    },
    { 
        "rel":"http://webfinger.net/rel/avatar",
        "type":"image/png",
        "href":"https://re.lire.im/system/accounts/avatars/108/318/983/298/108/639/original/85c1d453ddfc458c.png"
    }
  ]
}

Notice that this is a webfinger request for [email protected] but the value for self is https://re.lire.im/users/admin.

This creates a problem at our end because we will end up with a local user [email protected], NOT [email protected]. Then when you mention [email protected], find_mentions will correctly identify that this is the user you meant, and return the canonical username:

    for username in not_found:
        mention_user = handle_remote_webfinger(username, unknown_only=True) # this will find the existing user but not return them because "unknown_only=True".
        if not mention_user:
            # this user is blocked or can't be found
            continue

This is tricky to solve and to be honest I think libre.im is doing the wrong thing here. For example there's no "alsoKnownAs" or any other value set at https://re.lire.im/users/admin.json which might indicate that @[email protected] is the same account as @[email protected].

@prolibre
Copy link
Author

@hughrun

It seems to be somehow implemented in mastodon because I had the same problem with a large provider (sciences.re). The account @contact@sciences.re <> social.sciences.re/@contact
And the mention of the user @[email protected] works from my instance (piaille.fr) mais pas depuis bookwyrm.
Well, it's not an urgent point, but it's intriguing all the same :-)

Have a nice evening.

@cemreefe
Copy link

cemreefe commented Jan 29, 2025

@prolibre is correct that mastodon allows mentioning by what I call "a fediverse alias", which is a parallel webfinger that points to the same account. see https://cemrekarakas.com/.well-known/webfinger that points to my real account on mastodon.social. This means anyone tagging @<random>@cemrekarakas.com, will see their mention changed to @[email protected].

The way to go about this is; for an object with reference to a potential account, check webfinger. If webfinger resolves to an actor that points to its valid webfinger on the same domain, replace the handle with the webfinger-verified handle.

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

No branches or pull requests

3 participants