Conversation
Summary of ChangesHello @cgwalters, 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 development environment by incorporating 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 adds tmt and nushell to the development environment containers, along with corresponding tests and documentation updates. However, it introduces several instances of insecure shell variable handling in build scripts and Containerfiles, specifically regarding unquoted build arguments and derived variables, which could lead to command injection. Additionally, there are opportunities to improve the robustness of shell scripts through better error handling and temporary resource cleanup.
| *) echo "nushell unavailable for $arch"; return 0 ;; | ||
| esac | ||
| target=nu-${nushellversion#v}-${nuarch}-unknown-linux-gnu.tar.gz | ||
| /bin/time -f '%E %C' curl -fLO https://github.com/nushell/nushell/releases/download/$nushellversion/$target |
There was a problem hiding this comment.
The variables $nushellversion and $target are used unquoted in the curl command, which is a security vulnerability that can lead to command injection if these variables contain shell metacharacters. It's crucial to quote these variables to ensure secure handling and prevent word splitting, even if they currently derive from hardcoded defaults. This also aligns with the general best practice of quoting variables containing paths.
| /bin/time -f '%E %C' curl -fLO https://github.com/nushell/nushell/releases/download/$nushellversion/$target | |
| /bin/time -f '%E %C' curl -fLO "https://github.com/nushell/nushell/releases/download/${nushellversion}/${target}" |
| ARG nushellversion=v0.101.0 | ||
| COPY fetch-tools.sh /run/src/ | ||
| RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion /run/src/fetch-tools.sh | ||
| RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion nushellversion=$nushellversion /run/src/fetch-tools.sh |
There was a problem hiding this comment.
The build arguments are passed to the shell script without quoting. If any of these variables (which can be overridden at build time) contain shell metacharacters or spaces, it could lead to command injection or word splitting issues during the container build process. Always quote variables in shell commands to ensure they are handled as a single argument.
RUN bcvkversion="$bcvkversion" scorecardversion="$scorecardversion" nushellversion="$nushellversion" /run/src/fetch-tools.sh
| ARG nushellversion=v0.101.0 | ||
| COPY fetch-tools.sh /run/src/ | ||
| RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion /run/src/fetch-tools.sh | ||
| RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion nushellversion=$nushellversion /run/src/fetch-tools.sh |
There was a problem hiding this comment.
The build arguments are passed to the shell script without quoting. If any of these variables (which can be overridden at build time) contain shell metacharacters or spaces, it could lead to command injection or word splitting issues during the container build process. Always quote variables in shell commands to ensure they are handled as a single argument.
RUN bcvkversion="$bcvkversion" scorecardversion="$scorecardversion" nushellversion="$nushellversion" /run/src/fetch-tools.sh
| esac | ||
| target=nu-${nushellversion#v}-${nuarch}-unknown-linux-gnu.tar.gz | ||
| /bin/time -f '%E %C' curl -fLO https://github.com/nushell/nushell/releases/download/$nushellversion/$target | ||
| tar xvzf $target |
| tar xvzf $target | ||
| # The extracted directory has the same name as the archive without .tar.gz | ||
| extracted_dir=nu-${nushellversion#v}-${nuarch}-unknown-linux-gnu | ||
| mv $extracted_dir/nu /usr/local/bin/nu |
There was a problem hiding this comment.
| tmpdir=$(mktemp -d) | ||
| ( | ||
| cd "$tmpdir" | ||
| # Create basic fmf metadata directory and file | ||
| mkdir -p .fmf | ||
| echo "1" > .fmf/version | ||
|
|
||
| # Create a minimal test | ||
| mkdir -p tests | ||
| cat > tests/basic.fmf <<EOF | ||
| summary: Basic validation test | ||
| test: echo "tmt test validation passed" | ||
| duration: 5s | ||
| EOF | ||
|
|
||
| # Create a minimal plan | ||
| mkdir -p plans | ||
| cat > plans/basic.fmf <<EOF | ||
| summary: Basic validation plan | ||
| discover: | ||
| how: fmf | ||
| execute: | ||
| how: local | ||
| EOF | ||
|
|
||
| # Test tmt functionality | ||
| echo "Testing tmt plan discovery..." | ||
| tmt plan ls | ||
| echo "Testing tmt test discovery..." | ||
| tmt test ls | ||
| echo "Basic tmt validation complete" | ||
| ) | ||
| rm -rf "$tmpdir" |
There was a problem hiding this comment.
The temporary directory created for the tmt test is not cleaned up if any command within the subshell fails. Because set -e is active, the script will exit immediately on error, and the rm -rf command on line 100 will not be executed. Using a trap ensures the cleanup is always performed when the script exits.
tmpdir=$(mktemp -d)
trap 'rm -rf -- "$tmpdir"' EXIT
(
cd "$tmpdir"
# Create basic fmf metadata directory and file
mkdir -p .fmf
echo "1" > .fmf/version
# Create a minimal test
mkdir -p tests
cat > tests/basic.fmf <<EOF
summary: Basic validation test
test: echo "tmt test validation passed"
duration: 5s
EOF
# Create a minimal plan
mkdir -p plans
cat > plans/basic.fmf <<EOF
summary: Basic validation plan
discover:
how: fmf
execute:
how: local
EOF
# Test tmt functionality
echo "Testing tmt plan discovery..."
tmt plan ls
echo "Testing tmt test discovery..."
tmt test ls
echo "Basic tmt validation complete"
)- Add tmt testing framework to CentOS Stream 10 (via EPEL) and Debian (via pip3) - Add nushell modern shell to both environments via binary installation - Include comprehensive test coverage and error handling - Configure renovate for nushell version management - Fix nushell version format (use 0.110.0 not v0.101.0) Addresses requirements from bootc-dev#55. Assisted-by: OpenCode (Sonnet 4.5)
Prep for #55 among others.
Assisted-by: OpenCode (Sonnet 4.5)