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

App crash with third-party WAF server in front of Navidrome #495

Closed
tofuliang opened this issue Oct 15, 2024 · 9 comments
Closed

App crash with third-party WAF server in front of Navidrome #495

tofuliang opened this issue Oct 15, 2024 · 9 comments
Labels
needs-info An issue that needs more information

Comments

@tofuliang
Copy link

Seems navidrome is not respond correctly.

OS Version : x86_64 14.6.1 (23G93)

❯ Supersonic.app/Contents/MacOS/supersonic
2024/10/15 23:51:26 Starting supersonic...
2024/10/15 23:51:26 Using config dir: /Users/runner/Library/Application Support/supersonic
2024/10/15 23:51:26 Using cache dir: /Users/runner/Library/Caches/supersonic
2024/10/15 23:51:27 failed to load theme file "": open /Users/runner/Library/Application Support/supersonic/themes: no such file or directory
2024-10-15 23:51:27.810 supersonic[12301:291804] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
2024/10/15 23:51:28 Fyne error:  Translation failure
2024/10/15 23:51:28   Cause: message "Home" not found in language "zh"
2024/10/15 23:51:28   At: /Users/runner/go/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20240819150801-f6d6d2ad82de/lang/lang.go:72
2024/10/15 23:51:28 Fyne error:  Translation failure
2024/10/15 23:51:28   Cause: message "Back" not found in language "zh"
2024/10/15 23:51:28   At: /Users/runner/go/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20240819150801-f6d6d2ad82de/lang/lang.go:72
2024/10/15 23:51:28 Fyne error:  Translation failure
2024/10/15 23:51:28   Cause: message "Forward" not found in language "zh"
2024/10/15 23:51:28   At: /Users/runner/go/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20240819150801-f6d6d2ad82de/lang/lang.go:72
2024/10/15 23:51:28 Fyne error:  Translation failure
2024/10/15 23:51:28   Cause: message "Reload" not found in language "zh"
2024/10/15 23:51:28   At: /Users/runner/go/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20240819150801-f6d6d2ad82de/lang/lang.go:72
2024/10/15 23:51:28 Fyne error:  Translation failure
2024/10/15 23:51:28   Cause: message "Menu" not found in language "zh"
2024/10/15 23:51:28   At: /Users/runner/go/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20240819150801-f6d6d2ad82de/lang/lang.go:72
2024/10/15 23:51:28 Fyne error:  Translation failure
2024/10/15 23:51:28   Cause: message "Mute" not found in language "zh"
2024/10/15 23:51:28   At: /Users/runner/go/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20240819150801-f6d6d2ad82de/lang/lang.go:72
2024/10/15 23:51:28 Fyne error:  Translation failure
2024/10/15 23:51:28   Cause: message "Repeat" not found in language "zh"
2024/10/15 23:51:28   At: /Users/runner/go/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20240819150801-f6d6d2ad82de/lang/lang.go:72
2024/10/15 23:51:28 Fyne error:  Translation failure
2024/10/15 23:51:28   Cause: message "Show play queue" not found in language "zh"
2024/10/15 23:51:28   At: /Users/runner/go/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20240819150801-f6d6d2ad82de/lang/lang.go:72
2024/10/15 23:51:28 Fyne error:  Translation failure
2024/10/15 23:51:28   Cause: message "Now Playing" not found in language "zh"
2024/10/15 23:51:28   At: /Users/runner/go/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20240819150801-f6d6d2ad82de/lang/lang.go:72
2024/10/15 23:51:29 failed to load saved play queue: saved play queue was from a different server
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1007a9cf8]

goroutine 101 [running]:
github.com/supersonic-app/go-subsonic/subsonic.(*Client).GetPlaylists(...)
	/Users/runner/go/pkg/mod/github.com/supersonic-app/go-subsonic@v0.0.0-20240807031555-2cb1ccd78f85/subsonic/playlist.go:19
github.com/dweymouth/supersonic/backend/mediaprovider/subsonic.(*subsonicMediaProvider).GetPlaylists(0xc0002fae70)
	/Users/runner/work/supersonic/supersonic/backend/mediaprovider/subsonic/subsonicmediaprovider.go:208 +0x118
github.com/dweymouth/supersonic/ui/browsing.(*PlaylistsPage).load(0xc00329b590, 0x0)
	/Users/runner/work/supersonic/supersonic/ui/browsing/playlistspage.go:112 +0x35
created by github.com/dweymouth/supersonic/ui/browsing.newPlaylistsPage in goroutine 170
	/Users/runner/work/supersonic/supersonic/ui/browsing/playlistspage.go:97 +0x748

@tofuliang
Copy link
Author

tofuliang commented Oct 15, 2024

After some investigation, Supersonic received a 403 response from Navidrome.
Perhaps changing the User Agent from Go-http-client to something else might help?

@dweymouth
Copy link
Owner

I use Navidrome myself and have not run into this issue so I don't think the user-agent is the issue. Does this only happen with the playlists page? Or do you also get crashes when loading the albums, artists, etc pages? In any case, we don't want to be crashing even if a 403 is returned so I will look into fixing the crash from your stack trace

@dweymouth dweymouth changed the title App crash on startup App crash on viewing Playlists page Oct 15, 2024
@tofuliang
Copy link
Author

I figured it out using Charles proxy. I'm using a third-party Navidrome service that is protected by a WAF. The WAF detects the Go User Agent and directly responds with a 403 error.
image

@tofuliang
Copy link
Author

I tried changing the User Agent to something else on my local machine, and it no longer crashes.
image

@dweymouth
Copy link
Owner

Would changing the User-Agent to "Supersonic" work? Trying to evaluate options for a hardcoded user agent

@dweymouth dweymouth added the needs-info An issue that needs more information label Oct 15, 2024
@tofuliang
Copy link
Author

Yes, "Supersonic" works !

@dweymouth
Copy link
Owner

@tofuliang I pushed a fix, if you can build from source it'd be great if you can test it and let me know if it resolves it on your end

@dweymouth dweymouth changed the title App crash on viewing Playlists page App crash with third-party WAF server in front of Navidrome Oct 17, 2024
@dweymouth
Copy link
Owner

Oh, I forgot you can download the Github Actions build to test the fix as well: https://github.com/dweymouth/supersonic/actions/runs/11388277777

@tofuliang
Copy link
Author

@tofuliang I pushed a fix, if you can build from source it'd be great if you can test it and let me know if it resolves it on your end

I built it from source and can confirm that it fixed the issue. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-info An issue that needs more information
Projects
None yet
Development

No branches or pull requests

2 participants