fix(policy): require confirmation for shell parameter expansion#28175
fix(policy): require confirmation for shell parameter expansion#28175huynhtrungcsc wants to merge 2 commits into
Conversation
|
📊 PR Size: size/M
|
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 strengthens the security of shell command execution by implementing stricter validation for shell parameter expansion. By detecting and restricting these patterns, the changes prevent potential unintended shell execution behaviors, ensuring that commands are either blocked or require explicit user confirmation based on the current execution mode. Highlights
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 the 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 counterproductive. 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 introduces shell parameter expansion detection in the PolicyEngine to prevent unauthorized variable expansions in allowed commands. It adds the hasShellExpansion helper and integrates it into the policy check flow, along with corresponding unit tests. The review feedback highlights a critical security vulnerability in hasShellExpansion where single quotes nested inside double quotes are incorrectly handled, allowing potential bypasses. It also notes that positional parameters are not detected and suggests robust code fixes and regression tests to address these gaps.
|
Addressed the review feedback in 2646455. The shell expansion detector now tracks double-quoted state separately, keeps single quotes inside double quotes expansion-capable, and detects positional/special parameters such as |
Summary
Tests