superseriousbusiness / gotosocial

Fast, fun, small ActivityPub server.
https://docs.gotosocial.org
GNU Affero General Public License v3.0
3.67k stars 310 forks source link

[bug] Bitlbee authentication doesn't quite work #1292

Closed kensanata closed 1 year ago

kensanata commented 1 year ago

Bitlbee is a local IRC server where users connect with an IRC client and then Bitlbee uses plugins to connect to social media accounts, acting as a proxy. I'm the author of the Mastodon plugin for Bitlbee.

When I use bitlbee, authentication doesn't quite work. I can log in, authorize the app, and get a code, but Bitlbee gets an error when it tries to connect:

20:29 <root> social - Logging in: Login
20:29 <root> social - Logging in: Starting OAuth authentication
20:29 <root> social - Logging in: Requesting OAuth access token
20:29 <root> social - Login error: OAuth failure (I'm a teapot: no user-agent sent with request)
20:29 <root> social - Logging in: Signing off..
20:29 <root> social - Logging in: Reconnecting in 15 seconds..

This is from internal/middleware/useragent.go. I'm not quite sure what to make of it and I don't understand the comment in the code.

I guess my first preference would be to drop this test, since I don't understand the benefit.

Assuming there is a reason for this code, I will need to check where this happens. The actual requests later (after OAuth is done) are made with the UserAgent header BitlBee 3.6 so I would have to change it upstream in BitlBee (link to the suspected C code in BitlBee) itself – which makes me think that requiring a UserAgent header is not actually a requirement.

What do you think: Is this a GoToSocial bug, or a BitlBee bug?

What's your GoToSocial Version?

GoToSocial 0.6.0 git-f9e5ec9

tsmethurst commented 1 year ago

User agent is one of those things where the client should send it (https://www.rfc-editor.org/rfc/rfc7231#section-5.5.3), but many neglect to. Since it's not actually required according to http, we should make this requirement configurable. We have plans to allow user-agent filtering, so will probably fold this into that. I'll make a separate issue.

[edit] So in short, not really a bug in either bitlbee or gts imo, but something we should make more flexible.

kensanata commented 1 year ago

Cool! Thanks. Closing this one.