Skip to content

Commit 94ae2b8

Browse files
authored
Merge pull request #22 from PV-Bhat/codex/implement-ci-security-checks-and-documentation
Add security scan and policy
2 parents 6ac56d6 + ebc7071 commit 94ae2b8

File tree

5 files changed

+89
-1
lines changed

5 files changed

+89
-1
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ jobs:
1717
- run: npm run test:coverage
1818
- name: Report Vitest Coverage
1919
uses: davelosert/vitest-coverage-report-action@v2
20+
- name: Security Scan
21+
run: npm run security-check

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
[![Version](https://img.shields.io/badge/version-2.1-blue)](https://github.com/PV-Bhat/vibe-check-mcp-server)
1313
[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
14+
[![CI](https://github.com/PV-Bhat/vibe-check-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/PV-Bhat/vibe-check-mcp-server/actions/workflows/ci.yml)
1415
[![smithery badge](https://smithery.ai/badge/@PV-Bhat/vibe-check-mcp-server)](https://smithery.ai/server/@PV-Bhat/vibe-check-mcp-server)
1516
[![Verified on MseeP](https://mseep.ai/badge.svg)](https://mseep.ai/app/a2954e62-a3f8-45b8-9a03-33add8b92599)
1617

@@ -161,6 +162,12 @@ As an autonomous agent you will:
161162
- [Case Studies](./docs/case-studies.md)
162163
- [Changelog](./docs/changelog.md)
163164

165+
## Security
166+
167+
This repository includes a CI-based security scan that runs on every pull request.
168+
It checks dependencies with `npm audit` and scans the source for risky patterns.
169+
See [SECURITY.md](./SECURITY.md) for details and how to report issues.
170+
164171
## To-do List
165172

166173
- [x] Additional examples for OpenRouter models

SECURITY.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Security Policy
2+
3+
VibeCheck MCP is designed as a lightweight oversight layer for AI coding agents. While it does not execute code on behalf of the agent, it processes user prompts and sends them to third‑party LLM APIs. This document outlines our approach to keeping that process secure.
4+
5+
## Supported Versions
6+
Only the latest release receives security updates. Please upgrade regularly to stay protected.
7+
8+
## Threat Model
9+
- **Prompt injection**: malicious text could attempt to alter the meta-mentor instructions. VibeCheck uses a fixed system prompt and validates required fields to mitigate this.
10+
- **Tool misuse**: the server exposes only two safe tools (`vibe_check` and `vibe_learn`). No command execution or file access is performed.
11+
- **Data leakage**: requests are forwarded to the configured LLM provider. Avoid sending sensitive data if using hosted APIs. The optional `vibe_learn` log can be disabled via environment variables.
12+
- **Impersonation**: run VibeCheck only from this official repository or the published npm package. Verify the source before deployment.
13+
14+
## Reporting a Vulnerability
15+
If you discover a security issue, please open a private GitHub issue or email the maintainer listed in `package.json`. We will acknowledge your report within 48 hours and aim to provide a fix promptly.
16+
17+
## Continuous Security
18+
A custom security scan runs in CI on every pull request. It checks dependencies for known vulnerabilities and searches the source tree for dangerous patterns. The workflow fails if any issue is detected.
19+

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"start": "node build/index.js",
1414
"dev": "tsc-watch --onSuccess \"node build/index.js\"",
1515
"test": "vitest run",
16-
"test:coverage": "vitest run --coverage"
16+
"test:coverage": "vitest run --coverage",
17+
"security-check": "node scripts/security-check.cjs"
1718
},
1819
"dependencies": {
1920
"@google/generative-ai": "^0.17.1",

scripts/security-check.cjs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
const { execSync } = require('child_process');
2+
const fs = require('fs');
3+
const path = require('path');
4+
5+
function runAudit() {
6+
try {
7+
const output = execSync('npm audit --production --json', { encoding: 'utf8' });
8+
const json = JSON.parse(output);
9+
const vulnerabilities = json.vulnerabilities || {};
10+
let highOrCritical = 0;
11+
for (const name of Object.keys(vulnerabilities)) {
12+
const v = vulnerabilities[name];
13+
if (['high', 'critical'].includes(v.severity)) {
14+
console.error(`High severity issue in dependency: ${name}`);
15+
highOrCritical++;
16+
}
17+
}
18+
if (highOrCritical > 0) {
19+
console.error(`Found ${highOrCritical} high or critical vulnerabilities`);
20+
process.exitCode = 1;
21+
} else {
22+
console.log('Dependency audit clean');
23+
}
24+
} catch (err) {
25+
console.error('npm audit failed', err.message);
26+
process.exitCode = 1;
27+
}
28+
}
29+
30+
function scanSource() {
31+
const suspiciousPatterns = [/eval\s*\(/, /child_process/, /exec\s*\(/, /spawn\s*\(/];
32+
let flagged = false;
33+
function scanDir(dir) {
34+
for (const file of fs.readdirSync(dir)) {
35+
const full = path.join(dir, file);
36+
const stat = fs.statSync(full);
37+
if (stat.isDirectory()) {
38+
scanDir(full);
39+
} else if ((full.endsWith('.ts') || full.endsWith('.js')) && !full.includes('scripts/security-check.js')) {
40+
const content = fs.readFileSync(full, 'utf8');
41+
for (const pattern of suspiciousPatterns) {
42+
if (pattern.test(content)) {
43+
console.error(`Suspicious pattern ${pattern} found in ${full}`);
44+
flagged = true;
45+
}
46+
}
47+
}
48+
}
49+
}
50+
scanDir('src');
51+
if (flagged) {
52+
process.exitCode = 1;
53+
} else {
54+
console.log('Source scan clean');
55+
}
56+
}
57+
58+
runAudit();
59+
scanSource();

0 commit comments

Comments
 (0)