Repository navigation
fix(spotify): Ignore a malformed artist ID in the spotlight lookup - #282
Conversation
The artist spotlight spliced its artist_id straight into the Spotify artists URL, so a value with "/" or ".." could make the server call another GET route under the app's token. A by-ID lookup now needs a 22-character base-62 ID; anything else is treated as a failed by-ID lookup and falls back to the name search. Closes F-B23-33. An outside agent wrote the patch; an independent review approved it. Three existing by-ID tests now pass a well-formed ID. Validation: `pytest -q` -- **3113 passed**.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; formal verification proved 0 of 1 changed function(s) (1 not verified).
Formal verification. PR-changed functions: 0/1 verified (0 proven, 0 may-equivalent, 0 distinguished) · 1 not verified (1 vacuous).
Not verified on this run: \_request\_spotlight\_artist (vacuous: never exercised).
Graphify review — findings
Fixes F-B23-33 by making the artist spotlight lookup take the by-ID path only when the ID is a well-formed Spotify ID (22 base-62 characters), so a value with / or .. can no longer be spliced into the artists URL and reach another GET route under the app's token. A malformed ID is treated like any failed by-ID lookup: no request to the artists URL, then the existing name fallback, or None without a name. Adds a parametrized test for malformed and well-formed IDs, updates three existing spotlight tests to use a valid ID, and bumps the pinned test count to 3113 with the findings, playbook and archive docs updated to match.
No blocking issues surfaced. 1 lower-confidence candidate did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 452 functions depend on the 326 functions this change touches.
Health — grade B; 10 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):
_fetch_and_process()— 25 callers, 10 callees (high)process_albums()— 23 callers, 7 callees (high)search_for_spotify_album_id()— 22 callers, 7 callees (high)fetch_spotify_album_details_batch()— 14 callers, 8 callees (high)_fetch_spotify_misses()— 12 callers, 9 callees (high)background_task()— 15 callers, 5 callees (high)_run_album_job()— 16 callers, 4 callees (high)_process_filtered_albums()— 6 callers, 8 callees (high)- …and 2 more
Verification — 452 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 430 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify \_request\_spotlight\_artist.
The verifier did not have enough to check \_request\_spotlight\_artist, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: not verifiable: all 101 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous
Take the F-B23-33 fix and its bookkeeping into the UI audit Minors branch (owner ruling: a merge commit, not a rebase). Only PLAYBOOK and the log archive conflicted; both sides' history is kept, with PR #282 recorded as merged. Validation: `pytest -q` -- **3118 passed**.
Summary
Closes F-B23-33.
/api/artist_spotlightpassed a request'sartist_idunchecked intohttps://api.spotify.com/v1/artists/{artist_id}, so a value with/or../segments made the server call other Spotify GET routes under the app's token._request_spotlight_artistinscrobblescope/spotify.pynow takes the by-ID path only for a well-formed Spotify ID (exactly 22 ASCII base-62 characters,fullmatch); anything else is treated like an unsuccessful by-ID lookup, so the existing name fallback runs, or the route answers with its decorative fallback when no name is given. The check lives in the Spotify module (global rule 4); the route is unchanged.One parametrized test in
tests/services/test_spotify_service.pyasserts on the URLs requested: malformed IDs never reach the artists URL, a well-formed one does. It was red against the unchanged code. Three existing by-ID tests now use a well-formed ID, because their short IDs are malformed under the new rule; their intent is unchanged.A side task outside the UI audit Minors PR: the patch was written by an outside agent from a written brief, independently reviewed (approved; probes included encoded slashes, non-ASCII digits, fullwidth letters and trailing newlines), then landed with the usual bookkeeping. F-B23-33 is resolved and rotated to the findings archive.
Validation at this head
Head
99690943. Gates:suite-docsync702 passed,suite-subdirs1506 passed,suite-core905 passed (3113 in all),pre-commit(all hooks) anddocsync-checkpass. Onesuite-corerun hit an unrelated intermittent failure (test_importing_the_app_runs_no_shell_commandsaw aversubprocess, which Python's Windows version lookup can spawn under load); the isolated re-run passed and the flake is recorded for the findings triage. No browser gate applies (no template, static or gate change). CI: pending.Checklist
pytest -qpasses (update SESSION_CONTEXT Section 1 if test count changed)pre-commit run --all-filespasses (all hooks)python scripts/doc_state_sync.py --checkexits 0- Batch WP: inside
DOCSYNC:CURRENT-BATCH-START/ENDmarkers- Side task: after
DOCSYNC:CURRENT-BATCH-ENDmarker(or deviation is logged in the Section 4 entry)