Fix properties template rendering - #265
Open
vondras wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes format: properties push-to-file output so it is compatible with Java .properties consumers by removing Go %q quoting and adding Java-properties-style escaping for values.
Changes:
- Switched the
propertiesstandard format from reusing the dotenv template to a dedicatedpropertiesTemplate. - Added a
propertiesenctemplate helper to escape property values (e.g., backslashes, newlines, separators). - Added/updated tests to ensure
propertiesoutput is unquoted whiledotenvremains Go-quoted.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/pushtofile/standard_templates.go | Maps properties format to the new dedicated template instead of dotenv. |
| pkg/pushtofile/standard_templates_definitions.go | Introduces propertiesTemplate using the new propertiesenc helper. |
| pkg/pushtofile/standard_templates_test.go | Updates existing properties expectations and adds regression tests for Java-compatible escaping and unchanged dotenv behavior. |
| pkg/file_templates/template_functions.go | Adds propertiesencTemplateFunc implementation for Java .properties value escaping. |
| pkg/file_templates/secret_file_templates.go | Exposes propertiesenc via the template FuncMap so templates can use it. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+45
to
+48
| "b64enc": b64encTemplateFunc, | ||
| "b64dec": b64decTemplateFunc, | ||
| "htmlenc": htmlencTemplateFunc, | ||
| "propertiesenc": propertiesencTemplateFunc, |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
|
Hi @vondras, thanks for reporting this and for opening a PR to fix it. We've pulled it into our internal review and CI process. I'll update this thread when it's merged and when the fix is available here. Thanks again for the contribution! |
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.
Desired Outcome
format: propertiesshould generate Java.properties-compatible output.Before this change, the
propertiespush-to-file format reused the dotenv template, which rendered values with Go%qquoting. That produced output like:Java
.propertiesconsumers treat double quotes as literal characters, not delimiters, so applications received"myhost.example.com"instead ofmyhost.example.com.The desired outcome is for simple property values to render without introduced quote characters:
db.host=myhost.example.comwhile preserving existing behavior for
dotenv,bash,json, andyamlformats.Implemented Changes
This PR adds a dedicated Java properties rendering path instead of reusing
dotenvTemplate.Changes include:
Added a
propertiesTemplateforformat: properties.Updated the standard template map so
propertiesusespropertiesTemplatewhile continuing to usevalidatePropertyVarName.Added a
propertiesenctemplate helper for Java properties value escaping.Preserved existing
dotenvrendering behavior, including its current quoted value output.Added regression tests covering:
Reviewers should focus on whether the escaping behavior matches the intended Java properties compatibility contract and whether the scope is appropriate for
format: properties.No screenshots are relevant for this change.
Connected Issue/Story
Resolves #264
CyberArk internal issue ID: N/A - external contribution
Definition of Done
At least 1 todo must be completed in the sections below for the PR to be
merged.
Changelog
CHANGELOG update
Test coverage
changes, or
Documentation
READMEs) were updated in this PRBehavior
This PR changes behavior for
format: propertiesto match the documented Java-style properties behavior. As an external contributor, I do not have access to CyberArk PO review; maintainers can route this internally if required.Security