Skip to content

Commit 55d8bd2

Browse files
committed
Refactor env, Docker, and docs; improve CLI defaults
Consolidates environment variable examples into .env.example and removes .env.webapp.example. Deletes Dockerfiles for GitHub, queue, and Telegram modes. Moves documentation images from docs/ to images/ and updates README references accordingly. Refactors pr_security_review/__main__.py to set CLI argument defaults from environment variables for GitHub App, docs directory, queue listener, and continuous monitoring. Cleans up README to remove redundant configuration file instructions.
1 parent 7c1a697 commit 55d8bd2

File tree

13 files changed

+36
-148
lines changed

13 files changed

+36
-148
lines changed

.env.example

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,47 @@ FLASK_ENV=development
99
WEB_APP_PORT=5000
1010
FINDINGS_SERVER_PORT=8000
1111
FINDINGS_SERVER_URL=http://localhost:8000
12-
13-
# Database Configuration
12+
AUTHORIZED_EMAILS=[email protected] # Admin email for accessing the web app, comma-separated for multiple
1413
DATABASE_URL=postgresql://username:password@localhost:5432/security_findings
1514

16-
# Authorized Email Addresses (comma-separated)
17-
AUTHORIZED_EMAILS=[email protected]
15+
# Continuous Monitoring
16+
MONITOR_CONTINUOUS=false
1817

19-
# Optional: Telegram Configuration (if using Telegram notifications)
18+
# Telegram Notifications
2019
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
2120
TELEGRAM_CHAT_ID=your_telegram_chat_id_here
2221

23-
# Optional: LLM Provider API Keys
24-
OPENAI_API_KEY=your_openai_api_key_here
25-
ANTHROPIC_API_KEY=your_anthropic_api_key_here
26-
GOOGLE_AI_API_KEY=your_google_ai_api_key_here
27-
28-
# GitHub PAT token for accessing repositories
29-
GITHUB_TOKEN=your_github_token_here
30-
3122
# Email Notifications (Amazon SES)
3223
AWS_SES_REGION=us-east-1
3324
SES_FROM_EMAIL=[email protected]
3425
BASE_URL=https://your-domain.com
3526
AWS_ACCESS_KEY_ID=your_aws_access_key_here
3627
AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key_here
3728

38-
# Notification Settings
29+
# LLM Provider API Keys
30+
OPENAI_API_KEY=your_openai_api_key_here
31+
ANTHROPIC_API_KEY=your_anthropic_api_key_here
32+
GOOGLE_AI_API_KEY=your_google_ai_api_key_here
33+
34+
# GitHub PAT token for accessing repositories - requires repo scope read access
35+
GITHUB_TOKEN=your_github_token_here
36+
37+
# Notification Settings (notify on all or only potentially bad commits)
3938
NOTIFY_CLEAN_COMMITS=false
4039

41-
# Embeddings API key (required for Claude with docs)
40+
# Embeddings API key (required for using Claude with docs)
41+
DOCS_DIR=./docs
4242
VOYAGE_API_KEY=your_voyage_api_key_here
4343

4444
# GitHub App Settings
45+
GITHUB_APP=false
4546
GITHUB_APP_ID=12345
4647
GITHUB_PRIVATE_KEY_PATH=./privatekey.pem
4748
GITHUB_WEBHOOK_SECRET=your_webhook_secret_here
4849
GITHUB_CLIENT_SECRET=your_github_client_secret_here
4950

5051
# AMQP Message Queue (optional)
52+
LISTEN_QUEUE=false
5153
AMQP_URL=amqp://guest:guest@localhost:5672/
5254
QUEUE_NAME=security_review_requests
5355
RESPONSE_QUEUE_NAME=security_review_responses
@@ -62,39 +64,22 @@ LLAMA_WEIGHT=1
6264
# Optional: Enable SQL query debugging (set to true to see SQL queries in logs)
6365
SQL_DEBUG=false
6466

65-
# LLM Prompts Configuration
67+
# LLM Prompts Configuration (optional overrides for default prompts)
6668
LLM_SECURITY_PROMPT_INTRO="You are a security expert specializing in Ethereum client implementations and blockchain security."
67-
6869
LLM_SECURITY_PROMPT_FOCUS_AREAS="Pay special attention to Blockchain specific vulnerabilities."
69-
7070
LLM_SECURITY_PROMPT_IMPORTANT_NOTES="IMPORTANT:\n- Focus on concrete exploitable vulnerabilities."
71-
7271
LLM_SECURITY_PROMPT_EXAMPLES="Examples of concrete vulnerabilities:\n- Gas costs that deviate from EIP specifications."
73-
7472
LLM_SECURITY_PROMPT_RESPONSE_FORMAT="CRITICAL: Your response must be ONLY the following JSON object, with no additional text, explanation, or markdown formatting:\n{\n \"confidence_score\": <use highest confidence from findings, or 100 if no vulnerabilities>,\n \"has_vulnerabilities\": <true/false>,\n \"findings\": [\n {\n \"severity\": \"<HIGH|MEDIUM|LOW>\",\n \"description\": \"<specific vulnerability with exact code location>\",\n \"recommendation\": \"<precise fix required>\",\n \"confidence\": <0-100, how certain you are about this specific vulnerability>,\n \"detailed_explanation\": \"<comprehensive explanation of what the issue is>\",\n \"impact_explanation\": \"<what can happen if this vulnerability is exploited>\",\n \"detailed_recommendation\": \"<detailed explanation of how to fix the issue>\",\n \"code_example\": \"<the existing problematic code block, with proposed changes highlighted using html-style comments>\",\n \"additional_resources\": \"<links to documentation or other resources>\"\n }\n ],\n \"summary\": \"<only mention concrete vulnerabilities found>\"\n}\n\nIMPORTANT: The overall confidence_score should match the highest confidence score from the findings.\nFor example, if you find one vulnerability with 90% confidence, the overall confidence_score should also be 90."
75-
7673
LLM_SECURITY_PROMPT_NO_VULNS_RESPONSE="If no clear vulnerabilities are found in the code changes, return:\n{\n \"confidence_score\": 100,\n \"has_vulnerabilities\": false,\n \"findings\": [],\n \"summary\": \"No concrete vulnerabilities identified in the changed code.\"\n}"
77-
7874
LLM_SKEPTICAL_VERIFICATION_INTRO="You are a skeptical security auditor tasked with CRITICALLY reviewing and VERIFYING potential vulnerabilities."
79-
8075
LLM_SKEPTICAL_VERIFICATION_CRITICAL_QUESTIONS="Ask yourself is this is really a vulnerability."
81-
8276
LLM_SKEPTICAL_VERIFICATION_BE_CRITICAL="Keep a critical mindset."
83-
8477
LLM_SKEPTICAL_VERIFICATION_ONLY_CONFIRM="Only confirm vulnerabilities you are very sure about."
85-
8678
LLM_SKEPTICAL_VERIFICATION_RESPONSE_FORMAT="Return ONLY a JSON object with your verification results:\n{\n \"verified_findings\": [\n {\n \"original_index\": <index of the original finding, starting from 0>,\n \"is_real_vulnerability\": <true/false>,\n \"verification_confidence\": <0-100>,\n \"reason\": \"<why you believe this is or isnt a real vulnerability>\"\n }\n ],\n \"summary\": \"<brief summary of your verification>\"\n}"
87-
8879
LLM_SYNTHESIS_PROMPT_INTRO="You are a security expert tasked with synthesizing multiple security analyses into a single coherent report."
89-
9080
LLM_SYNTHESIS_PROMPT_INSTRUCTION="Please synthesize these analyses into a single, coherent security report. Combine similar findings, use the highest confidence scores where appropriate, and create a unified summary."
91-
9281
LLM_SYNTHESIS_SYSTEM_PROMPT="You are a security expert specializing in code review. Return ONLY JSON output with no additional text or explanation."
93-
9482
LLM_SYNTHESIS_SYSTEM_PROMPT_ANTHROPIC="You are a skeptical security auditor. Return ONLY JSON output with no additional text or explanation."
95-
9683
LLM_SYNTHESIS_SYSTEM_PROMPT_SYNTHESIZE="You are a security expert specializing in synthesizing multiple analyses. Return ONLY JSON output with no additional text or explanation."
9784

98-
99-
# End of .env.example
100-
# Note: Rename this file to .env and fill in the actual values before running the application.
85+
# End of .env.example

.env.webapp.example

Lines changed: 0 additions & 38 deletions
This file was deleted.

Dockerfile.github

Lines changed: 0 additions & 10 deletions
This file was deleted.

Dockerfile.queue

Lines changed: 0 additions & 10 deletions
This file was deleted.

Dockerfile.telegram

Lines changed: 0 additions & 10 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ This will then:
150150
#### One-Shot
151151
Examples using Anthropic
152152

153-
<a href="docs/cli.png">
154-
<img src="docs/cli.png" width="200"/>
153+
<a href="images/cli.png">
154+
<img src="images/cli.png" width="200"/>
155155
</a>
156156

157157
##### Single PR Review
@@ -235,7 +235,7 @@ You can use the commit monitoring feature that track repositories for new commit
235235

236236
##### Quick Start
237237

238-
###### Option 1: Add repositories manually
238+
###### Add repositories manually
239239

240240
```bash
241241
# Add a repository to monitor (e.g., Nethermind's master branch)
@@ -248,34 +248,6 @@ python -m pr_security_review --monitor-check
248248
python -m pr_security_review --monitor-continuous
249249
```
250250

251-
##### Option 2: Use a configuration file
252-
253-
Create a JSON configuration file with your repositories:
254-
255-
```json
256-
{
257-
"repositories": [
258-
{
259-
"url": "https://github.com/fredrik0x/go-ethereum",
260-
"branches": ["master"]
261-
},
262-
{
263-
"url": "https://github.com/ethereum/solidity",
264-
"branches": ["develop", "main"]
265-
}
266-
]
267-
}
268-
```
269-
270-
Then run with the config file:
271-
272-
```bash
273-
# Check for new commits using config file
274-
python -m pr_security_review --monitor-check --config-file config.json
275-
276-
# Start continuous monitoring using config file
277-
python -m pr_security_review --monitor-continuous --config-file config.json
278-
```
279251
##### Common Commands
280252

281253
```bash
@@ -300,8 +272,8 @@ You can use a supported AMQP queue (such as rabbitmq) to receive incoming review
300272
You can also run the tool as a GitHub App, which allows for command-based triggering of security reviews on PRs.
301273
Example: https://github.com/fredrik0x/go-ethereum/pull/1
302274

303-
<a href="docs/github.png">
304-
<img src="docs/github.png" width="200"/>
275+
<a href="images/github.png">
276+
<img src="images/github.png" width="200"/>
305277
</a>
306278

307279

@@ -360,17 +332,17 @@ Add your API key(s) and other environmental variables to your repository secrets
360332

361333

362334
### Web Application
363-
<a href="docs/web1.png">
364-
<img src="docs/web1.png" width="200"/>
335+
<a href="images/web1.png">
336+
<img src="images/web1.png" width="200"/>
365337
</a>
366338

367-
<a href="docs/web2.png">
368-
<img src="docs/web2.png" width="200"/>
339+
<a href="images/web2.png">
340+
<img src="images/web2.png" width="200"/>
369341
</a>
370342

371343

372-
<a href="docs/web3.png">
373-
<img src="docs/web3.png" width="200"/>
344+
<a href="images/web3.png">
345+
<img src="images/web3.png" width="200"/>
374346
</a>
375347

376348

@@ -391,8 +363,8 @@ You can receive an email whenever a new finding is found by setting the AWS SES
391363

392364
#### Telegram Notifications
393365

394-
<a href="docs/telegram.png">
395-
<img src="docs/telegram.png" width="200"/>
366+
<a href="images/telegram.png">
367+
<img src="images/telegram.png" width="200"/>
396368
</a>
397369

398370
You can receive telegram notifications when a review has found a potential vulnerability (or all reviews)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)