Repository navigation
fix: preserve multiline SSL environment values in standalone YAML - #14074
Open
ruanweihong-aaa wants to merge 3 commits into
Open
ruanweihong-aaa wants to merge 3 commits into
ruanweihong-aaa wants to merge 3 commits into
Conversation
ruanweihong-aaa
marked this pull request as ready for review
October 25, 2026 14:33
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.
Description
Standalone YAML expands environment variables before parsing. Raw multiline PEM values can therefore cause YAML parse errors or have their newlines folded, preventing SSL resources from loading.
This change preserves multiline values when a complete environment reference is used in an SSL resource's
cert,key,certs/keysarray item, orclient.ca.For example,
SERVER_CERTandSERVER_KEYcan contain original multiline PEM:The loader builds a temporary discovery copy, identifies supported fields, and protects the corresponding variable occurrences with placeholders during the final YAML parse. It checks scalar source locations and final field paths before restoring the original values, preventing accidental replacement of user content.
CLI validation and runtime file reload share the same helper. No new dependency or configuration switch is introduced.
Compatibility and supported scope
\nescape handling.JSON and bootstrap
config.yamlprocessing are unchanged.$ENV://remains an existing alternative. This change does not bypass SSL schema or certificate validation.Related issue
Related to #14038.
Validation
Tested using
apache/apisix:3.19.0-ubuntuwith the working-tree candidate mounted:apisix init.git diff --checkand patch reverse-apply checks passed.The full project test suite remains unverified. The release image lacks
makeand the complete project test environment; full-suite validation requires CI.Checklist
The compatibility checkbox remains open pending full CI validation and maintainer review of the documented fallback behavior.