Fix parsing algorithm in ValueParser#522
Conversation
`ExpressionExpansion` being a subclass of `ShellExpansion` means that `isinstance(node, ShellExpansion)` returns `True` even if node is an instance of `ExpressionExpansion`. Fix that. Signed-off-by: Nikola Forró <nforro@redhat.com>
Signed-off-by: Nikola Forró <nforro@redhat.com>
This fixes rather naive colon processing in bracketed expressions and makes the parsing algorithm follow more closely what RPM does. Signed-off-by: Nikola Forró <nforro@redhat.com>
|
❌ pre-commit FAILURE in 2m 12s |
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 refines the core parsing mechanism for macro substitutions within 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. Changelog
Activity
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly improves the parsing algorithm in ValueParser for handling enclosed macros (%{...}). The refactoring introduces a new Expansion base class and replaces BuiltinMacro with SingleArgEnclosedMacroSubstitution, leading to a cleaner design. However, it introduces or maintains several security risks: recursive parsing for nested macros can lead to a Denial of Service via RecursionError, automatic expansion of macros can lead to arbitrary command execution if untrusted spec files are processed, and unhandled exceptions in path comparisons can cause the parser to crash. While the new parsing logic is more robust and handles several edge cases, a minor issue was identified in a new test case where the expected output appears to be incorrect.
Signed-off-by: Nikola Forró <nforro@redhat.com>
|
Build succeeded. ✔️ pre-commit SUCCESS in 2m 11s |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request significantly refactors the ValueParser to improve robustness with invalid macro constructs and enhance code clarity through the introduction of Expansion and SingleArgEnclosedMacroSubstitution. However, it introduces critical security vulnerabilities by allowing a bypass of the Sanitizer. The parser's restrictive macro identification can be exploited by attackers to hide malicious macros (like lua, include, or load) using leading spaces or nested macros, potentially leading to Remote Code Execution (RCE) or arbitrary file access when RPM expands the unsanitized output. The parser should be updated to match RPM's liberal macro identification, and the sanitizer must recursively validate macro names. Additionally, a minor issue was found in a new test case with an incorrect expectation.
|
Build succeeded (gate pipeline). ✔️ pre-commit SUCCESS in 2m 08s |
No description provided.