feat: detect & decode url-encoded placeholders, reencode after replacement #702
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
This PR enables plugin to detect and replace specific path placeholders that were url-encoded to look like
%3Cpath%3Asome%2Fpath%23secret%3E
(for example, by Helmurlquery
function).The code finds such escaped placeholders, decodes them, replaces with the secret value and re-encodes the values again.
Example workflow:
A Helm chart creates a ConfigMap with the following url using a placeholder value for password from values.yaml file:
The placeholder
%3Cpath%3Akv%2Fdata%2Fconfig%2Fharbor%2Fredis-pwd%23password%3E
is detected and decoded into<path:kv/data/config/harbor/redis-pwd#password>
.The decoded placeholder is used to obtain password value "redis@123", which is then URL-encoded again into "redis%40123".
The resulting data in the ConfigMap is:
Fixes #701
Checklist
Please make sure that your PR fulfills the following requirements:
go mod tidy -compat=1.22.7
to ensure only the minimum is pulled in.Type of Change