fix: restrict cmd template function for remote dependency configs#10026
fix: restrict cmd template function for remote dependency configs#10026markoyoungson wants to merge 1 commit intoGoogleContainerTools:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the security posture of the system by preventing arbitrary command execution from untrusted remote configuration sources. It introduces a mechanism to disable the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request implements a security enhancement to prevent arbitrary command execution from remote or untrusted Skaffold configurations. It introduces a CmdAllowed flag that disables the cmd template function when processing such dependencies, and includes corresponding tests. A review comment suggests updating the placeholder issue link in the CmdAllowed variable's documentation for better traceability.
pkg/skaffold/util/env_template.go
Outdated
| } | ||
| // CmdAllowed controls whether the `cmd` template function is permitted. | ||
| // Set to false when processing remote/untrusted config dependencies to | ||
| // prevent arbitrary command execution. See https://github.com/GoogleContainerTools/skaffold/issues/XXXXX |
207fb8a to
622074f
Compare
Prevent arbitrary command execution from untrusted remote configuration dependencies by disabling the cmd template function when processing remote configs.
622074f to
9c10fb3
Compare
Summary
The
cmdtemplate function allows arbitrary command execution during config field expansion. Currently, this function is available to all template contexts, including remote/untrusted config dependencies fetched viagit, GCS, or Google Cloud Build repos.This change restricts the
cmdfunction from being available when processing remote dependency configs to prevent unintended command execution from external config sources.Changes
CmdAllowedflag inpkg/skaffold/util/env_template.gothat controls whether thecmdfunction is permittedrunCmdFuncnow checksCmdAllowedbefore executing and returns an error if not allowedpkg/skaffold/parser/config.gosetsCmdAllowed = falsebefore processing remote dependency configs viaprocessEachDependencyTest plan
cmdstill works for local configscmdis blocked whenCmdAllowed = falsecmdworks whenCmdAllowed = trueskaffold.yamlwith{{cmd "echo" "hello"}}still works{{cmd ...}}returns an error