soulsync/core/metadata
Broque Thomas d9529fc801 Token leak round 2: artist endpoint + playlist sync + URL-encoded redaction
The first token-leak fix scrubbed the artwork URL fixer's own log
calls. This catches three more sites that ALSO leaked tokens, plus
one upstream gap that let URL-encoded tokens slip through the
redactor.

Three sites in `web_server.py` (artist endpoint at line 8765-8773):

- "Artist image before fix: '...'" -- logged the raw image_url with
  the auth token in plain form.
- "Artist image after fix: '...'" -- logged the URL-encoded form
  after it had been wrapped in the image proxy
  (`/api/image-proxy?url=<percent-encoded-token>`).
- "Final artist data being sent: {...}" -- dumped the entire
  artist_info dict on every render, including the image_url field.

All three were dev-time debug noise. Removed entirely. The "No
artist image URL found" warning at line 8770 stays (no URL, just
the artist name).

One site in `core/discovery/sync.py:402`:

- "[PLAYLIST IMAGE] image_url=..." -- logged the playlist poster URL
  during sync. Same auth-token leak risk for Plex / Jellyfin
  playlists. Changed to log only `has_image=True/False`.

Upstream gap in `_redact_url_secrets`:

- The original regex only matched plain query params (`?key=value`).
  When an auth-bearing URL gets wrapped inside another URL's query
  string (our `/api/image-proxy?url=<encoded>` flow) the auth params
  end up percent-encoded -- `%3FX-Plex-Token%3D...` -- and slipped
  through.
- New second pattern catches the URL-encoded form. Both passes run
  on every redact call; idempotent.

Verified manually:
  /api/image-proxy?url=...%3FX-Plex-Token%3DABC...
  -> /api/image-proxy?url=...%3FX-Plex-Token%3D***REDACTED***

6 artwork tests pass.
2026-05-15 09:33:15 -07:00
..
__init__.py Move image URL normalization into metadata helpers 2026-05-02 22:02:36 +03:00
album_mbid_cache.py Final silent-exception sweep + ruff S110 lint guardrail — ~45 sites 2026-05-07 11:16:06 -07:00
album_tracks.py Fix $albumtype defaulting to album for non-Spotify sources 2026-05-12 21:09:16 -07:00
artist_image.py Move metadata helpers into package modules 2026-04-29 11:28:42 +03:00
artist_resolution.py Fix Soulseek downloads losing collab artist tags 2026-05-13 22:11:20 -07:00
artwork.py Token leak round 2: artist endpoint + playlist sync + URL-encoded redaction 2026-05-15 09:33:15 -07:00
cache.py Surface silent exceptions across remaining modules — ~70 sites 2026-05-07 10:28:58 -07:00
common.py Surface silent exceptions across remaining modules — ~70 sites 2026-05-07 10:28:58 -07:00
completion.py Move metadata helpers into package modules 2026-04-29 11:28:42 +03:00
discography.py feat: add explicit badges to discography modal and artist-detail cards 2026-05-12 23:35:08 -04:00
discography_filters.py Skip already-owned tracks during download discography 2026-05-12 15:10:41 -07:00
enrichment.py Stop writing TRCK as "6/0" when album total_tracks is unknown 2026-05-14 15:25:16 -07:00
lookup.py Move metadata API into package 2026-04-29 08:10:18 +03:00
lyrics.py Move shared metadata helpers into package 2026-04-27 19:54:44 +03:00
multi_source_search.py Fix Download Discography pulling wrong artist + log routing 2026-05-06 13:03:43 -07:00
registry.py Surface silent exceptions across remaining modules — ~70 sites 2026-05-07 10:28:58 -07:00
relevance.py Deezer search: drop advanced-syntax at endpoint, free-text + rerank wins 2026-05-10 09:36:48 -07:00
service.py Move metadata API into package 2026-04-29 08:10:18 +03:00
similar_artists.py Move metadata helpers into package modules 2026-04-29 11:28:42 +03:00
source.py Fix Soulseek downloads losing collab artist tags 2026-05-13 22:11:20 -07:00
status.py Make Spotify status updates event-driven 2026-05-02 22:02:01 +03:00
track_number_format.py Stop writing TRCK as "6/0" when album total_tracks is unknown 2026-05-14 15:25:16 -07:00
types.py feat: add explicit badges to discography modal and artist-detail cards 2026-05-12 23:35:08 -04:00