vibe-guard 1.1.5 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -92
- package/dist/bin/vibe-guard.js +93 -264
- package/dist/bin/vibe-guard.js.map +1 -1
- package/dist/index.d.ts +4 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -69
- package/dist/index.js.map +1 -1
- package/dist/reporter.d.ts +4 -11
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +125 -461
- package/dist/reporter.js.map +1 -1
- package/dist/rules/container-registry-security.d.ts +21 -0
- package/dist/rules/container-registry-security.d.ts.map +1 -0
- package/dist/rules/container-registry-security.js +271 -0
- package/dist/rules/container-registry-security.js.map +1 -0
- package/dist/rules/dockerfile-security.d.ts +20 -0
- package/dist/rules/dockerfile-security.d.ts.map +1 -0
- package/dist/rules/dockerfile-security.js +280 -0
- package/dist/rules/dockerfile-security.js.map +1 -0
- package/dist/rules/exposed-secrets.d.ts.map +1 -1
- package/dist/rules/exposed-secrets.js +27 -8
- package/dist/rules/exposed-secrets.js.map +1 -1
- package/dist/rules/hardcoded-sensitive-data.js +1 -1
- package/dist/rules/hardcoded-sensitive-data.js.map +1 -1
- package/dist/rules/index.d.ts +6 -1
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/index.js +16 -1
- package/dist/rules/index.js.map +1 -1
- package/dist/rules/insecure-deserialization.js +1 -1
- package/dist/rules/insecure-deserialization.js.map +1 -1
- package/dist/rules/insecure-error-handling.js +1 -1
- package/dist/rules/insecure-error-handling.js.map +1 -1
- package/dist/rules/insecure-file-upload.js +1 -1
- package/dist/rules/insecure-file-upload.js.map +1 -1
- package/dist/rules/insecure-http.js +1 -1
- package/dist/rules/insecure-http.js.map +1 -1
- package/dist/rules/insecure-logging.js +1 -1
- package/dist/rules/insecure-logging.js.map +1 -1
- package/dist/rules/kubernetes-security.d.ts +17 -0
- package/dist/rules/kubernetes-security.d.ts.map +1 -0
- package/dist/rules/kubernetes-security.js +314 -0
- package/dist/rules/kubernetes-security.js.map +1 -0
- package/dist/rules/unpinned-supply-chain-dependencies.d.ts +12 -0
- package/dist/rules/unpinned-supply-chain-dependencies.d.ts.map +1 -0
- package/dist/rules/unpinned-supply-chain-dependencies.js +56 -0
- package/dist/rules/unpinned-supply-chain-dependencies.js.map +1 -0
- package/dist/rules/unsafe-llm-prompt-construction.d.ts +9 -0
- package/dist/rules/unsafe-llm-prompt-construction.d.ts.map +1 -0
- package/dist/rules/unsafe-llm-prompt-construction.js +31 -0
- package/dist/rules/unsafe-llm-prompt-construction.js.map +1 -0
- package/dist/rules/xss-detection.js +1 -1
- package/dist/rules/xss-detection.js.map +1 -1
- package/dist/scanner.d.ts +1 -2
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.js +43 -116
- package/dist/scanner.js.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.js +1 -1
- package/package.json +26 -19
package/README.md
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
# ██ Vibe-Guard Security Scanner
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vibe-Guard gives you a quick security pass over source code and configuration files, with 30 pattern-based rules covering common application, AI, dependency, and container risks. Findings include a suggested next step, so scans can also help you learn what to look for.
|
|
4
|
+
|
|
5
|
+
It is a heuristic scanner, not a substitute for code review or a full security audit. It requires Node.js 20 or newer; npm installs its declared third-party runtime dependencies for you.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/vibe-guard)
|
|
6
8
|
[](https://www.npmjs.com/package/vibe-guard)
|
|
7
9
|
[](https://github.com/Devjosef/vibe-guard/blob/main/LICENSE)
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
10
13
|
|
|
11
14
|
```bash
|
|
12
15
|
# Install globally
|
|
13
16
|
npm install -g vibe-guard
|
|
14
17
|
|
|
18
|
+
# Interactive menu (scan and view rules)
|
|
19
|
+
vibe-guard start
|
|
20
|
+
|
|
15
21
|
# Scan your project
|
|
16
22
|
vibe-guard scan .
|
|
17
23
|
|
|
18
|
-
#
|
|
19
|
-
vibe-guard
|
|
20
|
-
|
|
21
|
-
# Try with demo files
|
|
22
|
-
vibe-guard demo
|
|
24
|
+
# Export a SARIF report
|
|
25
|
+
vibe-guard scan . --format sarif --output-file security-report.sarif
|
|
23
26
|
```
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Vibe-Guard is more than a scanner, it's an educational tool that teaches you about web security:
|
|
28
|
+
`vibe-guard scan` requires a target path. Supported formats are `table`, `json`, `sarif`, and `html`. A scan with findings exits with code 1; scan errors exit with code 2. The interactive `start` menu lets you scan, view the rule list, and create or view a configuration file. There are no separate `learn`, `demo`, or `stats` commands.
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
## Common issues and safer patterns
|
|
30
31
|
|
|
31
32
|
**XSS (Cross-Site Scripting):**
|
|
32
33
|
```javascript
|
|
33
|
-
//
|
|
34
|
+
// Vulnerable code
|
|
34
35
|
app.get('/user', (req, res) => {
|
|
35
36
|
const userInput = req.query.name;
|
|
36
|
-
res.send('<h1>Hello ' + userInput + '</h1>'); // XSS!
|
|
37
|
+
res.send('<h1>Hello ' + userInput + '</h1>'); // XSS vulnerability!
|
|
37
38
|
});
|
|
38
39
|
|
|
39
|
-
//
|
|
40
|
+
// Secure code
|
|
40
41
|
app.get('/user', (req, res) => {
|
|
41
42
|
const userInput = req.query.name;
|
|
42
43
|
res.send('<h1>Hello ' + escapeHtml(userInput) + '</h1>');
|
|
@@ -45,47 +46,76 @@ app.get('/user', (req, res) => {
|
|
|
45
46
|
|
|
46
47
|
**SQL Injection:**
|
|
47
48
|
```javascript
|
|
48
|
-
//
|
|
49
|
-
const query = 'SELECT * FROM users WHERE id = ' + userId; // SQL injection!
|
|
49
|
+
// Vulnerable code
|
|
50
|
+
const query = 'SELECT * FROM users WHERE id = ' + userId; // SQL injection risk!
|
|
50
51
|
|
|
51
|
-
//
|
|
52
|
+
// Secure code
|
|
52
53
|
const query = 'SELECT * FROM users WHERE id = ?';
|
|
53
54
|
db.query(query, [userId]);
|
|
54
55
|
```
|
|
55
56
|
|
|
56
57
|
**Exposed Secrets:**
|
|
57
58
|
```javascript
|
|
58
|
-
//
|
|
59
|
-
const API_KEY = 'sk-1234567890abcdef'; //
|
|
59
|
+
// Vulnerable code
|
|
60
|
+
const API_KEY = 'sk-1234567890abcdef'; // Secret exposed in source code!
|
|
60
61
|
|
|
61
|
-
//
|
|
62
|
+
// Secure code
|
|
62
63
|
const API_KEY = process.env.API_KEY; // Environment variable
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
**Container Security:**
|
|
67
|
+
```yaml
|
|
68
|
+
# Vulnerable Kubernetes manifest
|
|
69
|
+
apiVersion: apps/v1
|
|
70
|
+
kind: Deployment
|
|
71
|
+
spec:
|
|
72
|
+
template:
|
|
73
|
+
spec:
|
|
74
|
+
containers:
|
|
75
|
+
- name: app
|
|
76
|
+
image: nginx:latest # Latest tag vulnerability
|
|
77
|
+
securityContext:
|
|
78
|
+
runAsUser: 0 # Root user vulnerability
|
|
79
|
+
privileged: true # Privileged container vulnerability
|
|
80
|
+
|
|
81
|
+
# Secure Kubernetes manifest
|
|
82
|
+
apiVersion: apps/v1
|
|
83
|
+
kind: Deployment
|
|
84
|
+
spec:
|
|
85
|
+
template:
|
|
86
|
+
spec:
|
|
87
|
+
containers:
|
|
88
|
+
- name: app
|
|
89
|
+
image: nginx:1.21.6@sha256:<real-image-digest> # Replace with the registry's actual digest
|
|
90
|
+
securityContext:
|
|
91
|
+
runAsUser: 1000 # Non-root user
|
|
92
|
+
runAsNonRoot: true
|
|
93
|
+
allowPrivilegeEscalation: false
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Security Best Practices
|
|
66
97
|
|
|
67
98
|
1. **Input Validation** - Always validate and sanitize user input
|
|
68
|
-
2. **Output Encoding** - Encode output to prevent XSS
|
|
69
|
-
3. **Parameterized Queries** - Use prepared statements for
|
|
70
|
-
4. **Environment Variables** - Never hardcode secrets
|
|
99
|
+
2. **Output Encoding** - Encode output to prevent XSS attacks
|
|
100
|
+
3. **Parameterized Queries** - Use prepared statements for database operations
|
|
101
|
+
4. **Environment Variables** - Never hardcode secrets in source code
|
|
71
102
|
5. **Security Headers** - Implement proper HTTP security headers
|
|
72
103
|
|
|
73
|
-
|
|
104
|
+
6. **Container Security** - Use non-root users, pinned image digests, and proper security contexts
|
|
74
105
|
|
|
75
|
-
|
|
106
|
+
## Comprehensive Security Coverage
|
|
76
107
|
|
|
77
|
-
-
|
|
78
|
-
- **Input Validation**: SQL injection, XSS, unvalidated input
|
|
79
|
-
- **Data Protection**: Exposed secrets, hardcoded sensitive data
|
|
80
|
-
- **Configuration**: Insecure configuration, missing security headers
|
|
81
|
-
- **Session Management**: Insecure session handling
|
|
82
|
-
- **Error Handling**: Information disclosure through errors
|
|
83
|
-
- **File Operations**: Directory traversal, insecure file uploads
|
|
84
|
-
- **Dependencies**: Insecure dependencies, outdated packages
|
|
85
|
-
- **AI/ML Security**: AI-generated code validation, prompt injection
|
|
86
|
-
- **Modern Threats**: CSRF, CORS issues, insecure logging
|
|
108
|
+
Vibe-Guard detects 30 types of vulnerabilities across multiple categories:
|
|
87
109
|
|
|
88
|
-
|
|
110
|
+
- **Authentication & Authorization**: Missing authentication, broken access control, session management
|
|
111
|
+
- **Input Validation**: SQL injection, XSS, unvalidated input, directory traversal
|
|
112
|
+
- **Data Protection**: Exposed secrets, hardcoded sensitive data, insecure logging
|
|
113
|
+
- **Configuration**: Insecure configuration, missing security headers, CORS issues
|
|
114
|
+
- **Modern Threats**: AI provider tokens, unsafe LLM prompt construction, prompt injection, MCP security
|
|
115
|
+
- **Dependencies**: Known vulnerable packages, floating versions, and mutable Git references
|
|
116
|
+
- **Container Security**: Kubernetes security, Dockerfile vulnerabilities, container registry issues
|
|
117
|
+
|
|
118
|
+
## Use it in your workflow
|
|
89
119
|
|
|
90
120
|
**CI/CD Integration:**
|
|
91
121
|
```yaml
|
|
@@ -94,6 +124,10 @@ Vibe-Guard detects 25 types of vulnerabilities:
|
|
|
94
124
|
run: vibe-guard scan . --format sarif --output-file security-report.sarif
|
|
95
125
|
```
|
|
96
126
|
|
|
127
|
+
## SARIF test reporting
|
|
128
|
+
|
|
129
|
+
For local Jest test-result reporting, see [TEST_SCANNING.md](docs/TEST_SCANNING.md); that utility is separate from scanning project code.
|
|
130
|
+
|
|
97
131
|
**Pre-commit Hook:**
|
|
98
132
|
```bash
|
|
99
133
|
# .git/hooks/pre-commit
|
|
@@ -101,19 +135,14 @@ Vibe-Guard detects 25 types of vulnerabilities:
|
|
|
101
135
|
vibe-guard scan . || exit 1
|
|
102
136
|
```
|
|
103
137
|
|
|
104
|
-
**
|
|
138
|
+
**Interactive menu:**
|
|
105
139
|
```bash
|
|
106
|
-
|
|
107
|
-
vibe-guard learn sql-injection
|
|
108
|
-
vibe-guard learn xss-detection
|
|
109
|
-
|
|
110
|
-
# Practice with demo files
|
|
111
|
-
vibe-guard demo
|
|
140
|
+
vibe-guard start
|
|
112
141
|
```
|
|
113
142
|
|
|
114
|
-
## Installation
|
|
143
|
+
## Installation Options
|
|
115
144
|
|
|
116
|
-
**NPM:**
|
|
145
|
+
**NPM (Recommended):**
|
|
117
146
|
```bash
|
|
118
147
|
npm install -g vibe-guard
|
|
119
148
|
```
|
|
@@ -123,60 +152,33 @@ npm install -g vibe-guard
|
|
|
123
152
|
brew install devjosef/tap/vibe-guard
|
|
124
153
|
```
|
|
125
154
|
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
# Linux
|
|
129
|
-
curl -L https://github.com/Devjosef/vibe-guard/releases/latest/download/vibe-guard-linux-x64 -o vibe-guard
|
|
130
|
-
chmod +x vibe-guard
|
|
131
|
-
|
|
132
|
-
# macOS
|
|
133
|
-
curl -L https://github.com/Devjosef/vibe-guard/releases/latest/download/vibe-guard-macos-x64 -o vibe-guard
|
|
134
|
-
chmod +x vibe-guard
|
|
135
|
-
|
|
136
|
-
# Windows
|
|
137
|
-
curl -L https://github.com/Devjosef/vibe-guard/releases/latest/download/vibe-guard-windows-x64.exe -o vibe-guard.exe
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Documentation
|
|
141
|
-
|
|
142
|
-
- **[Getting Started](https://devjosef.github.io/vibe-guard/getting-started.html)** - Complete setup guide
|
|
143
|
-
- **[Security Rules](https://devjosef.github.io/vibe-guard/rules.html)** - Detailed rule explanations
|
|
144
|
-
- **[Performance Guide](https://devjosef.github.io/vibe-guard/performance.html)** - Optimization tips
|
|
145
|
-
- **[API Reference](https://devjosef.github.io/vibe-guard/docs.html)** - Programmatic usage
|
|
146
|
-
|
|
147
|
-
## 🤝 Community
|
|
148
|
-
|
|
149
|
-
**Join us in making the web more secure:**
|
|
155
|
+
Standalone binaries for Linux x64/arm64, macOS x64/arm64, and Windows x64 are built in CI and uploaded as workflow artifacts. They are not currently published as GitHub release downloads.
|
|
150
156
|
|
|
151
|
-
|
|
152
|
-
- **Demo**: `vibe-guard demo` - Try with example vulnerabilities
|
|
153
|
-
- **Stats**: `vibe-guard stats` - See your security impact
|
|
154
|
-
- **Discuss**: [GitHub Discussions](https://github.com/Devjosef/vibe-guard/discussions)
|
|
155
|
-
- **Report**: [GitHub Issues](https://github.com/Devjosef/vibe-guard/issues)
|
|
156
|
-
- **Star**: [GitHub Repository](https://github.com/Devjosef/vibe-guard)
|
|
157
|
+
## Documentation & Resources
|
|
157
158
|
|
|
158
|
-
|
|
159
|
+
- **[Getting Started](https://devjosef.github.io/vibe-guard/getting-started.html)** - Complete setup and configuration guide
|
|
160
|
+
- **[Security Rules](https://devjosef.github.io/vibe-guard/features.html)** - Rule coverage and descriptions
|
|
161
|
+
- **[Performance Guide](https://devjosef.github.io/vibe-guard/performance.html)** - Optimization and best practices
|
|
162
|
+
- **[API Reference](https://devjosef.github.io/vibe-guard/docs.html)** - Programmatic usage and integration
|
|
159
163
|
|
|
160
|
-
|
|
164
|
+
## Community & Support
|
|
161
165
|
|
|
162
|
-
|
|
163
|
-
- **25 security rules** - Comprehensive coverage
|
|
164
|
-
- **Cross-platform** - Works everywhere
|
|
165
|
-
- **Educational** - Learn while you scan
|
|
166
|
-
- **OWASP aligned** - Industry best practices
|
|
167
|
-
- **Developer-friendly** - Simple CLI interface
|
|
166
|
+
**Questions, feedback, or a finding that looks wrong?**
|
|
168
167
|
|
|
169
|
-
|
|
168
|
+
- **Interactive menu**: `vibe-guard start` - Scan or view available rules
|
|
169
|
+
- **SARIF export**: `vibe-guard scan . --format sarif --output-file report.sarif`
|
|
170
|
+
- **Community Discussion**: [GitHub Discussions](https://github.com/Devjosef/vibe-guard/discussions)
|
|
171
|
+
- **Issue Reporting**: [GitHub Issues](https://github.com/Devjosef/vibe-guard/issues)
|
|
172
|
+
- **Repository**: [GitHub Repository](https://github.com/Devjosef/vibe-guard)
|
|
170
173
|
|
|
171
|
-
|
|
174
|
+
## What to expect
|
|
172
175
|
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
177
|
-
- **Educational focus** - teaching security concepts
|
|
176
|
+
- Findings include the rule, severity, file and line, explanation, and suggested remediation.
|
|
177
|
+
- Pattern-based checks can miss issues or flag safe code; review findings in context and do not treat a clean scan as proof that code is secure.
|
|
178
|
+
- `start` is a small interactive menu for scanning and browsing rule descriptions, not a guided course.
|
|
179
|
+
- CI runs the Jest suite on Node.js 20 and 22. Binary builds are CI artifacts until attached to a release.
|
|
178
180
|
|
|
179
|
-
##
|
|
181
|
+
## License
|
|
180
182
|
|
|
181
183
|
MIT License - see [LICENSE](LICENSE) for details.
|
|
182
184
|
|