-
Notifications
You must be signed in to change notification settings - Fork 18
Adding an example for standalone security-review Github Action #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
🤖 Hi @shrishabh, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📋 Review Summary
This pull request introduces a new example GitHub Actions workflow for running Gemini security analysis. The workflow is well-structured and provides a good starting point for users.
🔍 General Feedback
- The use of pinned actions for
create-github-app-tokenandcheckoutis a good security practice. - The workflow correctly uses concurrency controls to prevent multiple runs.
- A high-severity issue was found regarding the use of
@mainfor therun-gemini-cliaction, which should be addressed.
| REPOSITORY: '${{ github.repository }}' | ||
| run: |- | ||
| gh issue comment "${ISSUE_NUMBER}" \ | ||
| --body "${MESSAGE}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 For security and stability, it's recommended to pin the version of the google-github-actions/run-gemini-cli action to a specific release tag instead of using @main. This prevents unexpected breaking changes or malicious code from being introduced into your workflow.
| --body "${MESSAGE}" \ | |
| uses: 'google-github-actions/run-gemini-cli@v1' # ratchet:exclude |
| shell: 'bash' | ||
|
|
||
| jobs: | ||
| review: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 For better stability and to ensure consistent builds, consider pinning the runner version to a specific version (e.g., ubuntu-22.04) instead of using ubuntu-latest.
| review: | |
| runs-on: 'ubuntu-22.04' |
| @@ -0,0 +1,128 @@ | |||
| name: '🔎 Gemini Review & Security Analysis' | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we put the file to
~/examples/security-review.yml like https://github.com/google-github-actions/run-gemini-cli/tree/main/examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually, yes. I think we are waiting for the go-ahead from run-gemini-cli team to add the security-review. Adding it here so that we can test and then refer to when we move to the gemini-cli repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to test this workflow in our repo, we need to restructure the folder to .github/workflows/security-review.yml. GHA does not support subfolders under .github/workflows/.
We should also temporarily disable the original code review workflow, as it will generate duplicated comments for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request adds a reusable GitHub Actions workflow for security analysis. The workflow is well-structured, but it has a potential prompt injection vulnerability and uses an unpinned version of a GitHub Action, which is not a secure practice.
🔍 General Feedback
- The workflow is well-documented and easy to understand.
- Pinning actions to a specific version is a crucial security measure to prevent supply chain attacks.
- Always treat user-provided input as untrusted and sanitize it before using it in sensitive contexts like prompts for language models.
| gemini_model: '${{ vars.GEMINI_MODEL }}' | ||
| google_api_key: '${{ secrets.GOOGLE_API_KEY }}' | ||
| use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' | ||
| use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| PULL_REQUEST_NUMBER: '${{ github.event.pull_request.number || github.event.issue.number }}' | ||
| REPOSITORY: '${{ github.repository }}' | ||
| ADDITIONAL_CONTEXT: '${{ inputs.additional_context }}' | ||
| with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| with: | |
| uses: 'google-github-actions/run-gemini-cli@v1.0.0' # ratchet:exclude |
This is the template for security review action.