Skip to content

Commit 4913e6e

Browse files
committed
ci: set up a security reviewer action
Set up a security reviewer action which performs a security specific review against all changes made by the `angular-robot` account. This is being done as a pilot test, testing the value of the analysis done automatically by gemini.
1 parent 3809747 commit 4913e6e

File tree

2 files changed

+119
-1
lines changed

2 files changed

+119
-1
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: 'Security Review'
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize]
6+
7+
concurrency:
8+
group: '${{ github.workflow }}-review-${{ github.event.pull_request.number }}'
9+
cancel-in-progress: true
10+
11+
defaults:
12+
run:
13+
shell: 'bash'
14+
15+
jobs:
16+
review:
17+
# 89942104 is the user id for the angular robot account.
18+
if: |
19+
(
20+
github.event_name == 'pull_request' &&
21+
github.event.pull_request.user.id == '89942104'
22+
)
23+
runs-on: 'ubuntu-latest'
24+
timeout-minutes: 15
25+
permissions:
26+
contents: 'read'
27+
id-token: 'write'
28+
pull-requests: 'write'
29+
steps:
30+
- name: 'Acknowledge request'
31+
env:
32+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
33+
ISSUE_NUMBER: '${{ github.event.pull_request.number }}'
34+
MESSAGE: |-
35+
Beginning seecurity review for the pull request. Track the progres [in the logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.
36+
REPOSITORY: '${{ github.repository }}'
37+
run: |-
38+
gh issue comment "${ISSUE_NUMBER}" \
39+
--body "${MESSAGE}" \
40+
--repo "${REPOSITORY}"
41+
42+
- name: 'Checkout repository'
43+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
44+
45+
- name: 'Run Gemini security analysis review'
46+
uses: 'google-github-actions/run-gemini-cli@f7db4b6f82ad0c3725cf4c98bdd93af80e22b4dc' # v0.1.14
47+
id: 'gemini_security_analysis'
48+
env:
49+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
50+
ISSUE_TITLE: '${{ github.event.pull_request.title }}'
51+
ISSUE_BODY: '${{ github.event.pull_request.body }}'
52+
PULL_REQUEST_NUMBER: '${{ github.event.pull_request.number }}'
53+
REPOSITORY: '${{ github.repository }}'
54+
with:
55+
gcp_location: '${{ vars.GOOGLE_CLOUD_LOCATION }}'
56+
gcp_project_id: '${{ vars.GOOGLE_CLOUD_PROJECT }}'
57+
gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
58+
gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}'
59+
gemini_api_key: '${{ secrets.SECURITY_REVIEWER }}'
60+
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'
61+
gemini_debug: '${{ fromJSON(vars.DEBUG || vars.ACTIONS_STEP_DEBUG || false) }}'
62+
gemini_model: '${{ vars.GEMINI_MODEL }}'
63+
google_api_key: '${{ secrets.GOOGLE_API_KEY }}'
64+
use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}'
65+
use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}'
66+
upload_artifacts: '${{ vars.UPLOAD_ARTIFACTS }}'
67+
extensions: |
68+
[
69+
"https://github.com/gemini-cli-extensions/security.git"
70+
]
71+
settings: |-
72+
{
73+
"model": {
74+
"maxSessionTurns": 100
75+
},
76+
"telemetry": {
77+
"enabled": true,
78+
"target": "local",
79+
"outfile": ".gemini/telemetry.log"
80+
},
81+
"mcpServers": {
82+
"github": {
83+
"command": "docker",
84+
"args": [
85+
"run",
86+
"-i",
87+
"--rm",
88+
"-e",
89+
"GITHUB_PERSONAL_ACCESS_TOKEN",
90+
"ghcr.io/github/github-mcp-server:v0.18.0"
91+
],
92+
"includeTools": [
93+
"add_comment_to_pending_review",
94+
"create_pending_pull_request_review",
95+
"pull_request_read",
96+
"submit_pending_pull_request_review"
97+
],
98+
"env": {
99+
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
100+
}
101+
}
102+
},
103+
"tools": {
104+
"core": [
105+
"run_shell_command(cat)",
106+
"run_shell_command(echo)",
107+
"run_shell_command(grep)",
108+
"run_shell_command(head)",
109+
"run_shell_command(tail)"
110+
]
111+
}
112+
}
113+
prompt: '/security:analyze-github-pr'

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,9 @@ test-results/*
5454
apps/*-debug.log
5555

5656
# Ignore generated package archives
57-
angular-*.tgz
57+
angular-*.tgz
58+
59+
# gemini-cli settings
60+
.gemini/
61+
# GitHub App credentials
62+
gha-creds-*.json

0 commit comments

Comments
 (0)