Skip to content

client: don't crash if we can't load cookies from the database#51

Merged
bradtgmurray merged 1 commit intomainfrom
linkedin-bad-credentials-cookies-crash
Feb 11, 2026
Merged

client: don't crash if we can't load cookies from the database#51
bradtgmurray merged 1 commit intomainfrom
linkedin-bad-credentials-cookies-crash

Conversation

@bradtgmurray
Copy link
Contributor

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x3613e5888]

goroutine 1604 [running]:
go.mau.fi/mautrix-linkedin/pkg/linkedingo.(*StringCookieJar).GetCookie(...)
    /Users/mattwondra/go/pkg/mod/go.mau.fi/mautrix-linkedin@v0.2512.1-0.20260203112029-7db734150ebe/pkg/linkedingo/stringcookiejar.go:82
go.mau.fi/mautrix-linkedin/pkg/connector.(*LinkedInClient).IsLoggedIn(0x14000bb59c8?)
    /Users/mattwondra/go/pkg/mod/go.mau.fi/mautrix-linkedin@v0.2512.1-0.20260203112029-7db734150ebe/pkg/connector/client.go:152 +0x38
go.mau.fi/mautrix-linkedin/pkg/connector.(*LinkedInClient).Connect(0x14000c06eb0, {0x36459aa60, 0x14000885380})
    /Users/mattwondra/go/pkg/mod/go.mau.fi/mautrix-linkedin@v0.2512.1-0.20260203112029-7db734150ebe/pkg/connector/client.go:127 +0x30
maunium.net/go/mautrix/bridgev2.(*Bridge).StartLogins(0x1400083e140, {0x36459aa60, 0x14000ba40f0})
    /Users/mattwondra/go/pkg/mod/maunium.net/go/mautrix@v0.26.3-0.20260129174719-d2364b382275/bridgev2/bridge.go:361 +0x2d8
maunium.net/go/mautrix/bridgev2.(*Bridge).Start(0x1400083e140, {0x36459aa60?, 0x14000ba40c0?})
    /Users/mattwondra/go/pkg/mod/maunium.net/go/mautrix@v0.26.3-0.20260129174719-d2364b382275/bridgev2/bridge.go:123 +0xac
github.com/beeper/beeper-client-sdk/pkg/bridges.(*LocalBridge).doStart(0x14000d2a900, {0x36459aa98?, 0x14000db8320?})
    /Users/mattwondra/projects/beeper/sdk/pkg/bridges/localbridge.go:196 +0xd4
github.com/beeper/beeper-client-sdk/pkg/bridges.(*LocalBridge).Start.func1()
    /Users/mattwondra/projects/beeper/sdk/pkg/bridges/localbridge.go:177 +0x54
created by github.com/beeper/beeper-client-sdk/pkg/bridges.(*LocalBridge).Start in goroutine 11
    /Users/mattwondra/projects/beeper/sdk/pkg/bridges/localbridge.go:175 +0x170

In October 2025 (77c78a7) we changed how cookies are stored and if you boot up a new bridge with the old format we'd end up with nil cookies due to an Unmarshalling failure. Treat us not having cookies as not being logged in instead of crashing.

@tulir tulir changed the title Don't crash if we can't load cookies from the database client: don't crash if we can't load cookies from the database Feb 11, 2026
@bradtgmurray bradtgmurray merged commit 9a2884b into main Feb 11, 2026
15 checks passed
@bradtgmurray bradtgmurray deleted the linkedin-bad-credentials-cookies-crash branch February 11, 2026 17:08
bradtgmurray added a commit that referenced this pull request Feb 11, 2026
With #51, we worked around a crash at startup by handling our cookie jar being nil, but that just caused explosions down the line when we tried to do other operations such as logging out which would attempt to use our cookies (c.getCSRFToken refers to c.jar which is nil).  

https://github.com/mautrix/linkedin/blob/b4fddae12a26bb3241d67e2526df298a46656202/pkg/linkedingo/self.go#L57-L62

Just make sure our linkedingo.Client is never created with nil cookies. This also makes the previous change unecessary. Pushed IsLoggedIn down to the linkedingo client to make things more similar to our other bridges instead of checking the origina userLogin struct. Also, skip logging out if we're not logged in, there's no credentials available to make the logout request with.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants