[Tokodon] [Bug 465085] New: Account settings can get clobbered if username is shared between instances

Raphael Gaschignard bugzilla_noreply at kde.org
Tue Jan 31 14:57:18 GMT 2023


https://bugs.kde.org/show_bug.cgi?id=465085

            Bug ID: 465085
           Summary: Account settings can get clobbered if username is
                    shared between instances
    Classification: Applications
           Product: Tokodon
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: raphael at rtpg.co
                CC: carl at carlschwan.eu
  Target Milestone: ---

SUMMARY
If you connect to multiple instances with the same username, the settings file
clobbers over one of the instance settings on save.

The relevant bit in `account.cpp`, where we're using the username (`m_name`) to
save the account settings:

```
void Account::writeToSettings(QSettings &settings) const
{
    settings.beginGroup(m_name);

    settings.setValue("token", m_token);
     /* snip */
    settings.endGroup();
}
```

I think the group needs to be set as something non-unique. At least
`mastodon.sdf.org` sets the username as just the left part of the identifier,
so `m_name` is only unique per instance, instead of globally unique.

A simple fix would be to simply use the instance + the name as the group

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Unassigned-bugs mailing list