Repository navigation
Setup flow callback: keep params as plain strings - #4955
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
strbefore 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.Types of changes
bugfixnew-featureenhancementnew-providerbreaking-changerefactordocumentationmaintenancecidependenciesChecklist
pre-commit run --all-filespasses.pytestpasses, and tests have been added/updated undertests/where applicable.music-assistant/modelsis linked.music-assistant/frontendis linked.