-
Notifications
You must be signed in to change notification settings - Fork 0
test: verdict=false - AI should COMMENT even with critical findings #12
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| name: "AI Code Review (comment only)" | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| jobs: | ||
| review: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: concretios/ai-pr-reviewer@v1 | ||
| with: | ||
| gemini_api_key: ${{ secrets.GEMINI_API_KEY }} | ||
| submit_review_verdict: false |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,59 @@ | ||||||||||||||||||
| const express = require('express'); | ||||||||||||||||||
| const os = require('os'); | ||||||||||||||||||
| const router = express.Router(); | ||||||||||||||||||
|
|
||||||||||||||||||
| // INTENTIONAL SECURITY ISSUES FOR TESTING AI REVIEW | ||||||||||||||||||
|
|
||||||||||||||||||
| // Health check that exposes way too much system info | ||||||||||||||||||
| router.get('/health', (req, res) => { | ||||||||||||||||||
| res.json({ | ||||||||||||||||||
| status: 'ok', | ||||||||||||||||||
| hostname: os.hostname(), | ||||||||||||||||||
| platform: os.platform(), | ||||||||||||||||||
| arch: os.arch(), | ||||||||||||||||||
| cpus: os.cpus(), | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [CRITICAL] security: Exposing The Suggestion:
Suggested change
|
||||||||||||||||||
| totalMemory: os.totalmem(), | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [CRITICAL] security: Exposing process.env in health endpoint The Suggestion:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [HIGH] security: Excessive system information in health endpoint The Suggestion:
Suggested change
|
||||||||||||||||||
| freeMemory: os.freemem(), | ||||||||||||||||||
| uptime: os.uptime(), | ||||||||||||||||||
| serverStartTime: new Date(Date.now() - process.uptime() * 1000).toISOString(), | ||||||||||||||||||
| nodeVersion: process.version, | ||||||||||||||||||
| pid: process.pid, | ||||||||||||||||||
| env: process.env | ||||||||||||||||||
| }); | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Readiness check with hardcoded database credentials | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [CRITICAL] security: Hardcoded database password The database password Suggestion:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [CRITICAL] security: Hardcoded database password The database password Suggestion:
Suggested change
|
||||||||||||||||||
| const DB_HOST = 'prod-db.internal.company.com'; | ||||||||||||||||||
| const DB_PORT = 5432; | ||||||||||||||||||
| const DB_USER = 'admin'; | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [MEDIUM] style: Missing JSDoc for The Suggestion:
Suggested change
|
||||||||||||||||||
| const DB_PASSWORD = 'SuperSecret123!'; | ||||||||||||||||||
|
|
||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [HIGH] security: Logging database connection string with credentials The full database connection string, including the password, is logged to the console. This can expose sensitive credentials if logs are compromised or improperly secured. Avoid logging sensitive information, especially credentials. Suggestion:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [HIGH] security: Logging sensitive connection string The full database connection string, including the hardcoded password, is logged to the console. This can expose credentials in logs, which is a security risk. Sensitive information should never be logged, as per Suggestion:
Suggested change
|
||||||||||||||||||
| router.get('/ready', async (req, res) => { | ||||||||||||||||||
| try { | ||||||||||||||||||
| // Simulate database connection check using hardcoded credentials | ||||||||||||||||||
| const connectionString = `postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/taskdb`; | ||||||||||||||||||
| console.log(`Checking database connection: ${connectionString}`); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Fake check, always returns true | ||||||||||||||||||
| const dbReady = true; | ||||||||||||||||||
|
|
||||||||||||||||||
| res.json({ | ||||||||||||||||||
| ready: dbReady, | ||||||||||||||||||
| database: { | ||||||||||||||||||
| host: DB_HOST, | ||||||||||||||||||
| port: DB_PORT, | ||||||||||||||||||
| user: DB_USER, | ||||||||||||||||||
| connected: dbReady | ||||||||||||||||||
| }, | ||||||||||||||||||
| timestamp: new Date().toISOString() | ||||||||||||||||||
| }); | ||||||||||||||||||
| } catch (error) { | ||||||||||||||||||
| res.status(503).json({ | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [MEDIUM] style: Inconsistent error response format The error response in the Suggestion:
Suggested change
|
||||||||||||||||||
| ready: false, | ||||||||||||||||||
| error: error.message, | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [CRITICAL] security: Exposing full stack trace in error response The error response for the Suggestion:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 [CRITICAL] security: Exposing stack traces in error response The error response for the Suggestion:
Suggested change
|
||||||||||||||||||
| stack: error.stack | ||||||||||||||||||
| }); | ||||||||||||||||||
| } | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| module.exports = router; | ||||||||||||||||||
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.
🩺 [MEDIUM] style: Missing JSDoc for
/healthroute handlerThe
/healthroute handler is missing JSDoc comments, which are required for all functions according toreview-rules.md. This reduces code readability and maintainability.Suggestion: