fix(dev-env): prevent non-safelisted EJS execution in repo config files#2938
Merged
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens dev-env repository configuration handling by removing full EJS rendering and restricting template processing to a safelisted configDir placeholder, reducing the risk of executing arbitrary template code when loading vip-dev-env.yml.ejs.
Changes:
- Replaced
ejs.render()with a strict<%= configDir %>string substitution for template config files. - Added validation to reject remaining EJS template syntax after substitution.
- Added Jest tests covering placeholder substitution and rejection of arbitrary EJS usage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/lib/dev-environment/dev-environment-configuration-file.ts | Removes full EJS rendering and enforces a safelisted placeholder-only template mechanism. |
| tests/lib/dev-environment/dev-environment-configuration-file.js | Adds tests to verify allowed placeholder replacement and rejection of non-safelisted EJS syntax. |
Comment on lines
+25
to
+26
| const ALLOWED_CONFIG_DIR_TEMPLATE = /<%=\s*configDir\s*%>/g; | ||
| const EJS_TEMPLATE_TAG = /<%[\s\S]*?%>/; |
Contributor
Author
There was a problem hiding this comment.
n/a because it won't execute
41f6333 to
943b53e
Compare
943b53e to
23ada79
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
robersongomes
approved these changes
Jul 6, 2026
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
This pull request updates the handling of template configuration files in the dev environment to restrict usage of EJS syntax, allowing only the
<%= configDir %>placeholder. This change improves security and predictability by preventing arbitrary JavaScript execution in configuration templates.Changelog Description
Changed
vip-dev-env.yml.ejsto plain YAML with<%= configDir %>substitution.Pull request checklist
New release checklist
Steps to Test
Outline the steps to test and verify the PR here.
Example:
npm run build./dist/bin/vip-cookies.js nom