Skip to content

Commit 956dac5

Browse files
committed
updated ratelimit and printout styling
1 parent ef0e594 commit 956dac5

File tree

8 files changed

+756
-659
lines changed

8 files changed

+756
-659
lines changed

README.md

Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -13,99 +13,12 @@ VibeSafe helps developers quickly check their projects for common security issue
1313
* **Unvalidated Upload Detection:** Identifies potential missing file size/type restrictions in common upload libraries (`multer`, `formidable`, `express-fileupload`, `busboy`) and generic patterns (`new FormData()`, `<input type="file">`).
1414
* **Exposed Endpoint Detection:** Flags potentially sensitive endpoints (e.g., `/admin`, `/debug`, `/status`, `/info`, `/metrics`) in Express/Node.js applications using common routing patterns or string literals.
1515
* **Rate Limit Check (Heuristic):** Suggests reviewing rate limiting if Express/Node.js routes are detected in a file without an `express-rate-limit` import.
16-
* **Improper Error Logging Detection:** Flags potential logging of full error objects (e.g., `console.error(err)`, `logger.error(e)`), which can leak stack traces.
16+
* **Improper Logging Detection:** Flags potential logging of full error objects (e.g., `console.error(err)`), which can leak stack traces, and detects logging of potentially sensitive data based on keywords (e.g., `password`, `email`, `token`).
1717
* **Multiple Output Formats:** Provides results via console output (with colors!), JSON (`--output`), or a Markdown report (`--report` with default `VIBESAFE-REPORT.md`).
1818
* **AI-Powered Suggestions (Optional):** Generates fix suggestions in the Markdown report using OpenAI (requires API key).
1919
* **Filtering:** Focus on high-impact issues using `--high-only`.
2020
* **Customizable Ignores:** Use a `.vibesafeignore` file (similar syntax to `.gitignore`) to exclude specific files or directories from the scan.
2121

2222
## Installation
2323

24-
```bash
25-
# Assuming publication to npm eventually
26-
npm install -g vibesafe
27-
```
28-
29-
*(Note: Currently, for local development, use `npm link` after building)*
30-
31-
## Usage
32-
33-
**Basic Scan (Current Directory):**
34-
35-
```bash
36-
vibesafe scan
37-
```
38-
39-
**Scan a Specific Directory:**
40-
41-
```bash
42-
vibesafe scan ./path/to/your/project
43-
```
44-
45-
**Output to JSON:**
46-
47-
```bash
48-
vibesafe scan -o scan-results.json
49-
```
50-
51-
**Generate Markdown Report:**
52-
53-
```bash
54-
# Generate report with a specific name
55-
vibesafe scan -r my-report.md
56-
57-
# Generate report with the default name (VIBESAFE-REPORT.md in the scanned directory)
58-
vibesafe scan -r
59-
```
60-
61-
**Generate AI Report (Requires API Key):**
62-
63-
To generate fix suggestions in the Markdown report, you need an OpenAI API key.
64-
65-
1. Create a `.env` file in the root of the directory where you run `vibesafe` (or in the project root if running locally during development).
66-
2. Add your key to the `.env` file:
67-
```
68-
OPENAI_API_KEY=sk-YourActualOpenAIKeyHere
69-
```
70-
3. Run the scan with the report flag:
71-
```bash
72-
# Use default name VIBESAFE-REPORT.md
73-
vibesafe scan -r
74-
75-
# Or specify a name
76-
vibesafe scan -r vibesafe-ai-report.md
77-
```
78-
79-
**Show Only High/Critical Issues:**
80-
81-
```bash
82-
vibesafe scan --high-only
83-
```
84-
85-
## Limitations
86-
87-
* **Superagent Timeouts:** The check for missing timeouts in the `superagent` HTTP client library is currently disabled due to complexities in accurately detecting chained method calls (like `.timeout()`) using AST. Calls using `superagent` will not be flagged for missing timeouts at this time. This is planned for a future enhancement.
88-
* **Dynamic Configuration:** Checks rely on static analysis (AST parsing, regex). Timeouts or security settings configured dynamically (e.g., read from environment variables at runtime and passed into client options) may not be detected.
89-
* **Rate Limiting:** The check is a heuristic based on the presence of route definitions and the *absence* of a specific import (`express-rate-limit`). It does not guarantee that rate limiting is actually missing or insufficient if implemented differently.
90-
* **Authentication Checks:** Exposed endpoint detection does not currently verify if proper authentication or authorization middleware is applied to flagged routes.
91-
92-
## Ignoring Files (.vibesafeignore)
93-
94-
Create a `.vibesafeignore` file in the root of the directory being scanned. Add file paths or glob patterns (one per line) to exclude them from the scan. The syntax is the same as `.gitignore`.
95-
96-
**Example `.vibesafeignore**:**
97-
98-
```
99-
# Ignore all test data
100-
test-data/
101-
102-
# Ignore a specific configuration file
103-
config/legacy-secrets.conf
104-
105-
# Allow scanning a specific .env file if needed (overrides default info behavior)
106-
# !.env.production
107-
```
108-
109-
## License
110-
111-
This project uses a custom proprietary license. Please see the [LICENSE](LICENSE) file for details. TL;DR: Free to use, source visible, but no modification, copying, or redistribution allowed.
24+
```

instructions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@
9999
3. **Exposed Debug/Admin Endpoints**
100100
- [x] Search for routes named `/debug`, `/admin`, `/status`, `/info`, etc. using framework patterns or string literals
101101
- [ ] Flag those without authentication or middleware checks // (Future enhancement - complex)
102-
4. **Lack of Rate‑Limiting**
102+
4. **Lack of Rate‑Limiting / HTTP Client Issues**
103103
- [x] Identify files with route definitions but missing `express-rate-limit` import (heuristic)
104-
- [ ] Flag missing throttle/retry settings in HTTP client code
105-
- [x] Detect missing timeout/cancellation in HTTP client calls (axios, fetch, got, request) // (Superagent check disabled due to AST complexity)
104+
- [x] Detect missing timeout/cancellation in HTTP client calls (axios, fetch, got, request) // (Superagent check disabled)
106105
- [ ] *TODO: Implement reliable `superagent` timeout detection via AST*
106+
- [ ] *TODO: Flag missing retry settings in HTTP client code (e.g., check `got` for missing `retry` config; research robust checks for axios/fetch/others)*
107107
5. **Insufficient Logging & Error Sanitization**
108108
- [x] Find logging of full error objects or stack traces (e.g., `console.error(err)`)
109-
- [ ] Detect logging of PII or sensitive data in plain text // (Future enhancement - complex)
109+
- [x] Detect logging of potential PII (keywords like password, email, token, etc.)
110110

111111
## 6. Risks & Mitigations
112112

0 commit comments

Comments
 (0)