Skip to content

Setup flow callback: keep params as plain strings - #4955

Merged
marcelveldt merged 1 commit into
devfrom
setup-flow-callback-params
Jul 24, 2026
Merged

marcelveldt merged 1 commit into
devfrom
setup-flow-callback-params

Conversation

@marcelveldt

Copy link
Copy Markdown
Member

What does this implement/fix?

Follow-up on #4952 (flagged in review): the setup-flow external-step callback declares its params as dict[str, str], but a JSON POST body could inject numbers/bools into it.

  • Coerce JSON body keys/values to strings before merging into the callback params
  • Ignore non-object JSON bodies (logged) instead of merging garbage
  • Test covering a JSON callback body with non-string values

Types of changes

  • Bugfix (non-breaking change which fixes an issue) — bugfix
  • New feature (non-breaking change which adds functionality) — new-feature
  • Enhancement to an existing feature — enhancement
  • New music/player/metadata/plugin provider — new-provider
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — breaking-change
  • Refactor (no behaviour change) — refactor
  • Documentation only — documentation
  • Maintenance / chore — maintenance
  • CI / workflow change — ci
  • Dependencies bump — dependencies

Checklist

  • The code change is tested and works locally.
  • pre-commit run --all-files passes.
  • pytest passes, and tests have been added/updated under tests/ where applicable.
  • For changes to shared models, the companion PR in music-assistant/models is linked.
  • For changes affecting the UI, the companion PR in music-assistant/frontend is linked.
  • I have read and complied with the project's AI Policy for any AI-assisted contributions.
  • I have raised a PR against the documentation repository targeting the main or beta branch as appropriate.

Copilot AI review requested due to automatic review settings July 24, 2026 01:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the setup-flow external-step callback handler to uphold its dict[str, str] params contract when receiving JSON POST bodies, preventing non-string JSON values (e.g., numbers/bools) from being merged as non-strings.

Changes:

  • Coerce JSON callback body keys/values to str before merging into callback params.
  • Ignore (and log) non-object JSON bodies instead of merging them.
  • Add a test covering a JSON callback body with non-string values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
music_assistant/models/setup_flow.py Coerces JSON callback bodies to string params and ignores non-dict JSON bodies.
tests/controllers/config/test_setup_flows.py Adds coverage ensuring JSON callback params are coerced to strings.

@marcelveldt
marcelveldt merged commit 16569b9 into dev Jul 24, 2026
15 checks passed
@marcelveldt
marcelveldt deleted the setup-flow-callback-params branch July 24, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants