Potential fix for code scanning alert no. 169: Code injection - #261
Conversation
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Lukas Burgholzer <burgholzer@me.com>
📝 WalkthroughSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughModified the CMake configuration step in a Windows C++ testing workflow to introduce a COMPILER environment variable and refactored the clang compiler check to reference this variable instead of directly expanding the inputs parameter. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Potential fix for https://github.com/munich-quantum-toolkit/workflows/security/code-scanning/169
To address the code injection vulnerability, remove use of
${{ inputs.compiler }}inside the shell script, and instead define an intermediate environment variable (e.g.,COMPILER) in theenv:section. Then, in the shell script, use the shell-native$COMPILERvariable for logic, ensuring environment variable expansion is used, not GitHub expression syntax.Specifically, on line 78, change:
to
You must also add
COMPILER: ${{ inputs.compiler }}to theenv:section of this step.What files/regions to change:
env:must include an assignment for theCOMPILERvariable.${{ inputs.compiler }}must be changed to use$COMPILERinstead.No new imports or methods are required.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.