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

[bug] oidc code sends requests with the wrong user agent #3719

Open
Pectojin opened this issue Jan 31, 2025 · 1 comment
Open

[bug] oidc code sends requests with the wrong user agent #3719

Pectojin opened this issue Jan 31, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Pectojin
Copy link

Describe the bug with a clear and concise description of what the bug is.

When an oidc is configured in gotosocial requests are sent to the oidc server with the user agent Go-http-client/<some_version>

What's your GoToSocial Version?

v0.17.3

GoToSocial Arch

amd64

What happened?

I blocked all requests from Go-http-client and my gotosocial server started crashing on startup

2025/01/31 17:30:21 error executing command: error creating oidc idp: Get "https://auth.example.com/realms/production/.well-known/openid-configuration": stream error: stream ID 1; ENHANCE_YOUR_CALM; received from peer

Side note: It's probably fine it crashes here

On the haproxy side I see the logs:

<134>Jan 31 17:36:11 haproxy[8]: 192.168.2.1:55998 [31/Jan/2025:17:36:11.389] main~ keycloak/s1 0/0/0/5/5 200 6371 - - ---- 45/44/0/0/0 0/0 {auth.example.com|Go-http-client/2.0|} "GET https://auth.example.com/realms/production/.well-known/openid-configuration HTTP/2.0"

and in the gotosocial logs after compiling webassembly:

timestamp="31/01/2025 17:41:49.937" func=server.init.func1 level=INFO msg="compiling WebAssembly"
timestamp="31/01/2025 17:41:59.601" func=workers.(*Workers).StartScheduler level=INFO msg="started scheduler"
timestamp="31/01/2025 17:41:59.601" func=cleaner.(*Cleaner).ScheduleJobs level=INFO msg="scheduling media clean to run every 24h0m0s, starting from 00:00; next clean will run at 2025-02-01 00:00:00 +0000 UTC"
timestamp="31/01/2025 17:41:59.602" func=workers.(*Workers).Start level=INFO msg="started 24 delivery workers"
timestamp="31/01/2025 17:41:59.602" func=workers.(*Workers).Start level=INFO msg="started 48 client workers"
timestamp="31/01/2025 17:41:59.602" func=workers.(*Workers).Start level=INFO msg="started 48 federator workers"
timestamp="31/01/2025 17:41:59.602" func=workers.(*Workers).Start level=INFO msg="started 48 dereference workers"
timestamp="31/01/2025 17:41:59.602" func=workers.deliveryWorkers level=INFO msg="started 12 processing workers"
timestamp="31/01/2025 17:41:59.623" func=cache.(*Caches).Stop level=INFO msg="stop: 0xc00085f008"
timestamp="31/01/2025 17:41:59.623" func=router.(*Router).Stop level=INFO msg="shutting down http router with 30s grace period"
timestamp="31/01/2025 17:41:59.623" func=router.(*Router).Stop level=INFO msg="http router closed connections and shut down gracefully"
timestamp="31/01/2025 17:41:59.623" func=workers.(*Workers).Stop level=INFO msg="stopped scheduler"
timestamp="31/01/2025 17:41:59.623" func=workers.(*Workers).Stop level=INFO msg="stopped delivery workers"
timestamp="31/01/2025 17:41:59.623" func=workers.(*Workers).Stop level=INFO msg="stopped client workers"
timestamp="31/01/2025 17:41:59.623" func=workers.(*Workers).Stop level=INFO msg="stopped federator workers"
timestamp="31/01/2025 17:41:59.623" func=workers.(*Workers).Stop level=INFO msg="stopped dereference workers"
timestamp="31/01/2025 17:41:59.623" func=workers.(*Workers).Stop level=INFO msg="stopped processing workers"
timestamp="31/01/2025 17:41:59.623" func=admin.(*Processor).PersistWorkerQueues level=INFO msg=dehydrate!
timestamp="31/01/2025 17:41:59.623" func=admin.(*Processor).PersistWorkerQueues level=INFO delivery=0 federator=0 client=0 errors=0 msg="persisted queued tasks"
timestamp="31/01/2025 17:41:59.623" func=bundb.(*basicDB).Close level=INFO msg="closing db connection"
timestamp="31/01/2025 17:41:59.623" func=server.init.func1.1 level=INFO msg="done! exiting..."
2025/01/31 17:41:59 error executing command: error creating oidc idp: Get "https://auth.example.com/realms/production/.well-known/openid-configuration": stream error: stream ID 1; ENHANCE_YOUR_CALM; received from peer

What you expected to happen?

I expected gotosocial to send a user agent gotosocial/0.17.3+git-... similar to what it does with other requests.

How to reproduce it?

configure a gotosocial instance with oidc again e.g. keycloak and check the logs

Anything else we need to know?

No response

@Pectojin Pectojin added the bug Something isn't working label Jan 31, 2025
@tsmethurst
Copy link
Contributor

Thanks! We gotta tangle with the OIDC dependency and see if we can inject our own http client there.

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

2 participants