[PR #2334] [MERGED] Fix Spotify percent decoding panic #5537

Closed
opened 2026-10-22 04:17:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2334
Author: @Xelvanis
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/5/2026
Merged by: @Xelvanis

Base: refactor ← Head: fix/spotify-percent-decode-2325


📝 Commits (1)

  • 83ece76 Fix Spotify percent decoding panic

📊 Changes

4 files changed (+77 additions, -78 deletions)

View changed files

📝 src-tauri/src/commands/storage/integrations.rs (+2 -0)
📝 src-tauri/src/commands/storage/integrations/spotify.rs (+1 -39)
📝 src-tauri/src/commands/storage/integrations/spotify_callback.rs (+1 -39)
➕ src-tauri/src/commands/storage/integrations/spotify_query.rs (+73 -0)

📄 Description

Linked issue

Closes #2325

Why this change

  • Spotify callback parsing could panic when a percent sign was followed by a multi-byte UTF-8 character, which could kill the OAuth callback task or reject the pasted callback URL exchange.

What changed

  • Added one shared Spotify query parser for the loopback callback and pasted callback URL paths.
  • Decode percent escapes from raw bytes instead of slicing a &str at byte offsets.
  • Added focused Rust coverage for valid callback decoding and malformed percent sequences with multi-byte characters.

Refactor impact

Primary owner:

Rust storage integrations, Spotify OAuth parsing.

Impact areas reviewed:

  • Loopback Spotify OAuth callback request parsing.
  • Pasted callbackUrl exchange parsing.
  • Duplicate Spotify query decoder copies removed from both entrypoints.

Boundary notes:

  • Rust-only integration parsing fix under src-tauri; no React, engine, shared API, command registration, or remote-runtime boundary changes.

Pressure points touched:

  • None.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • cargo fmt --manifest-path src-tauri/Cargo.toml
  • cargo test --manifest-path src-tauri/Cargo.toml spotify_query --lib passed: 3 tests passed.
  • cargo check --manifest-path src-tauri/Cargo.toml passed.
  • git diff --cached --check passed before commit.
  • pnpm check passed.
  • No live Spotify OAuth/Tauri callback flow was exercised.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Internal Spotify OAuth parser crash fix; no new user-discoverable surface.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

N/A; Rust-only parser fix with no visible UI changes.

Summary by CodeRabbit

  • Refactor
    • Improved code organization for Spotify integration utilities by consolidating shared functionality into a reusable module.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2334 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/spotify-percent-decode-2325` --- ### 📝 Commits (1) - [`83ece76`](https://github.com/Pasta-Devs/Marinara-Engine/commit/83ece7615a19235cd739a9bf7b957d0c45ef74a4) Fix Spotify percent decoding panic ### 📊 Changes **4 files changed** (+77 additions, -78 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/integrations.rs` (+2 -0) 📝 `src-tauri/src/commands/storage/integrations/spotify.rs` (+1 -39) 📝 `src-tauri/src/commands/storage/integrations/spotify_callback.rs` (+1 -39) ➕ `src-tauri/src/commands/storage/integrations/spotify_query.rs` (+73 -0) </details> ### 📄 Description ## Linked issue Closes #2325 ## Why this change - Spotify callback parsing could panic when a percent sign was followed by a multi-byte UTF-8 character, which could kill the OAuth callback task or reject the pasted callback URL exchange. ## What changed - Added one shared Spotify query parser for the loopback callback and pasted callback URL paths. - Decode percent escapes from raw bytes instead of slicing a `&str` at byte offsets. - Added focused Rust coverage for valid callback decoding and malformed percent sequences with multi-byte characters. ## Refactor impact Primary owner: Rust storage integrations, Spotify OAuth parsing. Impact areas reviewed: - Loopback Spotify OAuth callback request parsing. - Pasted `callbackUrl` exchange parsing. - Duplicate Spotify query decoder copies removed from both entrypoints. Boundary notes: - Rust-only integration parsing fix under `src-tauri`; no React, engine, shared API, command registration, or remote-runtime boundary changes. Pressure points touched: - None. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `cargo fmt --manifest-path src-tauri/Cargo.toml` - `cargo test --manifest-path src-tauri/Cargo.toml spotify_query --lib` passed: 3 tests passed. - `cargo check --manifest-path src-tauri/Cargo.toml` passed. - `git diff --cached --check` passed before commit. - `pnpm check` passed. - No live Spotify OAuth/Tauri callback flow was exercised. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Internal Spotify OAuth parser crash fix; no new user-discoverable surface. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence N/A; Rust-only parser fix with no visible UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Improved code organization for Spotify integration utilities by consolidating shared functionality into a reusable module. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:17:10 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5537
No description provided.