fix: old entry with unresolved variable name doesn't deletes from config table after var value substitution#12885
Open
pronchakov wants to merge 1 commit intoapache:masterfrom
Conversation
Contributor
|
Hi @pronchakov, can you add corresponding tests for this fix? |
Author
Ok, I'll add some tests. |
moonming
requested changes
Mar 16, 2026
Member
moonming
left a comment
There was a problem hiding this comment.
Hi @pronchakov, thank you for catching this bug!
This is a clear and correct fix — conf.key = nil should be conf[key] = nil. The current code sets a literal field named key to nil instead of deleting the dynamic key. Great catch!
One request: Could you please add a test case that verifies this behavior? Something like:
- Define a route/config where a key name contains an environment variable reference (e.g.,
\${{ENV_KEY_NAME}}) - Verify that after resolution, the old key is properly removed and the new key exists
This is a one-line fix with clear correctness, so once the test is added, this should be ready to merge. Thank you!
Contributor
|
Hi @pronchakov, following up on the previous review comments. Please let us know if you have any updates. Thank you. |
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
There is a little bug in function
local function resolve_conf_var(conf)incli/file.luaconf.key = nildeletes entry from conf with name "key"but after variable substitution, old entry with name contained in variable
keyshould be removed.so it needs to be rewritten to
conf[key] = nilconf.key = nilresults in adding entry with resolved variable to conf, but doesn't remove entry with unresolved variable name.In case of using it in routes->upstream->nodes it results in two node entries. one is correct and one with unresolved variable name in it, that results in dns error in logs. I suppose that another places will result in different consequences.
Which issue(s) this PR fixes:
Fixes #12884
Checklist