fix(openclaw): yaml-escape Ollama model names in overlay generation#783
Merged
Merged
Conversation
The #775 injection fix wrapped imported values with yamlScalar() but missed the two sites that interpolate names sourced from listOllamaModels() (which JSON-decodes the local Ollama HTTP endpoint with no charset validation): generateOverlayValues's model-list block and patchOverlayModelList's overlay-update path both spliced the raw model id/display-name into hand-built YAML lines. A model name containing a newline plus a YAML key (e.g. "x\nimage:\n repository: evil") could inject new top-level keys into values-obol.yaml, later applied to the cluster via helmfile sync. Route both id and name through the existing yamlScalar() encoder at both call sites. Added regression tests mirroring the #775 TestGenerateOverlayValues_RejectsYAMLInjection pattern for each site, plus an injection subtest under TestPatchOverlayModelList; both fail on the pre-fix code and pass after. Updated the three pre-existing assertions that expected unquoted 'id: <model>' output, since yamlScalar always double-quotes. Claude-Session: https://claude.ai/code/session_014YjPMViNrZ7zBVgUQzwEKk
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.
Medium from the PR #756 review. The #775 YAML-injection fix wrapped imported openclaw.json values but left Ollama-sourced model names (from the Ollama HTTP endpoint, unvalidated) interpolated raw into the generated overlay values YAML at two sites. Routes both through yamlScalar so a model name with YAML metacharacters can't inject overlay keys.
https://claude.ai/code/session_014YjPMViNrZ7zBVgUQzwEKk