Skip to content

fix(pmem): correct parent_uuid format specifier in args_dict#6283

Open
buildearth wants to merge 1 commit intoavocado-framework:masterfrom
buildearth:master
Open

fix(pmem): correct parent_uuid format specifier in args_dict#6283
buildearth wants to merge 1 commit intoavocado-framework:masterfrom
buildearth:master

Conversation

@buildearth
Copy link
Copy Markdown

the parent_uuid format string in args_dict was "-p %", missing the format specifier s. This causes incorrect formatting when passing parent_uuid to ndctl commands.

Change "parent_uuid": "-p %" to "parent_uuid": "-p %s".

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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 addresses a critical formatting error in the pmem utility, specifically for the 'parent_uuid' argument. By correcting a missing format specifier, it ensures that 'ndctl' commands are constructed correctly, preventing potential failures or misinterpretations when persistent memory operations are performed.

Highlights

  • Format Specifier Correction: Corrected the format specifier for 'parent_uuid' in the 'args_dict' within the pmem utility, changing it from "-p %" to "-p %s" to ensure proper command formatting for ndctl.
Changelog
  • avocado/utils/pmem.py
    • Fixed the format string for 'parent_uuid' in 'args_dict' to include the '%s' specifier.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mr-avocado mr-avocado bot moved this to Review Requested in Default project Mar 9, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a formatting bug in the parent_uuid argument for the write-infoblock command. While the fix is functionally correct, it introduces a critical command injection vulnerability. Commands are constructed using user input and executed in a shell without proper sanitization, posing a significant security risk. Input sanitization is strongly recommended to prevent this.

"align": "-a %s",
"uuid": "-u %s",
"parent_uuid": "-p %",
"parent_uuid": "-p %s",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

This change, while fixing a formatting bug for parent_uuid, introduces a command injection vulnerability. The parent_uuid value (and other user-provided inputs like namespace, output, and kwargs) is formatted into a command string and executed with shell=True without proper sanitization. If parent_uuid contains shell metacharacters (e.g., '; rm -rf /'), an attacker could execute arbitrary commands. To remediate, sanitize all user-provided values using shlex.quote() before formatting them into the command string. Alternatively, consider avoiding shell=True and passing the command and its arguments as a list to the execution function.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.67%. Comparing base (8fa8228) to head (5bf3bc7).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6283      +/-   ##
==========================================
- Coverage   73.70%   73.67%   -0.04%     
==========================================
  Files         206      206              
  Lines       22620    22634      +14     
==========================================
+ Hits        16673    16675       +2     
- Misses       5947     5959      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@buildearth
Copy link
Copy Markdown
Author

The failing CI test selftests/functional/job_timeout.py::JobTimeOutTest::test_sleep_short_timeout is unrelated to this change. It expects exit code 8 (AVOCADO_JOB_INTERRUPTED), but in CI the job can exit with 9 (8 | 1) when a test interrupted by timeout is also recorded as ERROR, so both AVOCADO_JOB_INTERRUPTED and AVOCADO_TESTS_FAIL are set. This appears to be an existing test/environment behavior. The fix in this PR only touches the pmem format string.

@buildearth
Copy link
Copy Markdown
Author

@harvey0100 Hi, I submitted this PR on March 9th. It has been two weeks since then. I haven't received any feedback yet, so I am writing this letter to sincerely ask if you could spare some time to review it when it's convenient for you.
If you need any additional information from me or if there are any areas that need to be revised, please let me know. I am more than willing to make the necessary adjustments as soon as possible.
Thank you very much for taking the time and offering your help!

@harvey0100 harvey0100 self-requested a review March 23, 2026 13:59
Copy link
Copy Markdown
Contributor

@harvey0100 harvey0100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is correct. Please shorten the commit header to under 72 characters -- the rest should go in the body. For example:

avocado/utils/pmem: fix parent_uuid format specifier

Change -p % to -p %s to fix incorrect formatting when passing
parent_uuid to ndctl commands.

Signed-off-by: lixintao lixintao@uniontech.com

Once the commit message is fixed, this LGTM.

Change -p % to -p %s to fix incorrect formatting when passing
parent_uuid to ndctl commands.

Signed-off-by: lixintao <lixintao@uniontech.com>
@buildearth
Copy link
Copy Markdown
Author

@harvey0100 Thank you for your guidance. I’ve updated the commit message according to the conventions.
Please take another look, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Review Requested

Development

Successfully merging this pull request may close these issues.

2 participants