mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-08 10:27:08 +02:00
On a multi-library instance, a few reads and writes built their own queries without the per-user library filter that every other media read applies. A user granted only some libraries could see, and store, tracks from libraries they had no access to. - getBookmarks now filters the query. It has to be the query and not the result: the loop below it pre-sizes the response from the bookmark count, so a row dropped afterwards would emit an empty bookmark entry. - createBookmark rejects an id the caller cannot read, returning error 70 to match getSong. Stored rows are left alone rather than purged, so a temporary revoke does not lose saved playback positions. - playlistTrackRepository Read, Count and GetAlbumIDs get the filter their siblings CountAll and GetMediaFileIDs already had. Read is the one that mattered most: its id is the integer playlist position, so it needed no track id at all. - Playlist track writes are filtered in playlistRepository.addTracks, the only writer of playlist_tracks rows apart from smart playlists, so Add, Insert, AddAlbums/AddArtists/AddDiscs and a full replace through Put all go through it. Insert reserves a slot per requested id, so when the filter drops one it renumbers to close the hole. - playTracker.GetNowPlaying honours its context instead of discarding it. The cache is process-global, so the filter belongs in the tracker rather than in the Subsonic handler, and any future caller inherits it. Admins and single-library installs are unaffected: applyLibraryFilter and HasLibraryAccess both short-circuit for them. Scanner playlist sync runs as admin, and M3U and CLI imports already resolve tracks through FindByPaths as the same user, so neither changes. |
||
|---|---|---|
| .. | ||
| fixtures | ||
| harness | ||
| fake_http_client.go | ||
| init_tests.go | ||
| mock_album_repo.go | ||
| mock_artist_repo.go | ||
| mock_artwork_queue_repo.go | ||
| mock_artwork_repo.go | ||
| mock_data_store.go | ||
| mock_ffmpeg.go | ||
| mock_genre_repo.go | ||
| mock_library_repo.go | ||
| mock_library_service.go | ||
| mock_mediafile_repo.go | ||
| mock_playlist_repo.go | ||
| mock_playlist_track_repo.go | ||
| mock_playqueue_repo.go | ||
| mock_plugin_manager.go | ||
| mock_plugin_repo.go | ||
| mock_property_repo.go | ||
| mock_radio_repository.go | ||
| mock_scanner.go | ||
| mock_scrobble_buffer_repo.go | ||
| mock_scrobble_repo.go | ||
| mock_share_repo.go | ||
| mock_tag_repo.go | ||
| mock_transcoding_repo.go | ||
| mock_user_props_repo.go | ||
| mock_user_repo.go | ||
| mock_user_service.go | ||
| navidrome-test.toml | ||
| test_helpers.go | ||