@deveko/devguard 0.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 +147 -0
- package/bin/devguard-win.exe +0 -0
- package/cli.js +23 -0
- package/package.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# π‘οΈ DevGuard
|
|
2
|
+
|
|
3
|
+
> Catch broken configs before they break your app.
|
|
4
|
+
|
|
5
|
+
DevGuard is a fast, zero-config `.env` scanner for Node.js projects. It validates your environment variables and warns you about weak secrets, invalid ports, malformed URLs, and empty values β before you ship.
|
|
6
|
+
|
|
7
|
+
Built with Rust. Fast by default.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## β¨ Features
|
|
12
|
+
|
|
13
|
+
- π Scans your `.env` file instantly
|
|
14
|
+
- β Detects weak secrets (e.g. `JWT_SECRET` too short)
|
|
15
|
+
- β Catches invalid port values (e.g. `PORT=abc`)
|
|
16
|
+
- β Flags malformed URLs (e.g. `DATABASE_URL=localhost`)
|
|
17
|
+
- β οΈ Warns about empty or malformed variables
|
|
18
|
+
- β
Clean, readable CLI output
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## π Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx devguard
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
That's it. No installation needed.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## π¦ Usage
|
|
33
|
+
|
|
34
|
+
Place a `.env` file in your project root, then run:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Scan default .env
|
|
38
|
+
npx devguard check
|
|
39
|
+
|
|
40
|
+
# Scan a custom path
|
|
41
|
+
npx devguard check --path ./apps/backend/.env
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Example `.env`
|
|
45
|
+
|
|
46
|
+
```env
|
|
47
|
+
PORT=abc
|
|
48
|
+
JWT_SECRET=123
|
|
49
|
+
DATABASE_URL=localhost
|
|
50
|
+
NODE_ENV=development
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Example output
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
π DevGuard - scanning .env...
|
|
57
|
+
|
|
58
|
+
β PORT -> must be a number
|
|
59
|
+
β JWT_SECRET -> must be greater than or equal to 32 characters
|
|
60
|
+
β DATABASE_URL -> must start with http://, https://, postgres://, mysql://
|
|
61
|
+
|
|
62
|
+
β οΈ 3 issue(s) found
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
When everything looks good:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
π DevGuard - scanning .env...
|
|
69
|
+
|
|
70
|
+
β
All checks passed! Your .env looks good!
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## π§ How It Works
|
|
76
|
+
|
|
77
|
+
DevGuard scans your `.env` file line by line and runs pattern-based validation rules:
|
|
78
|
+
|
|
79
|
+
| Pattern | Rule |
|
|
80
|
+
| ------- | ---- |
|
|
81
|
+
| Key contains `SECRET` | Value must be β₯ 32 characters |
|
|
82
|
+
| Key contains `PORT` | Value must be a valid number |
|
|
83
|
+
| Key contains `URL` | Value must start with a valid protocol |
|
|
84
|
+
|
|
85
|
+
No config needed. Just run it.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## πΊοΈ Roadmap
|
|
90
|
+
|
|
91
|
+
- [x] `.env` parser
|
|
92
|
+
- [x] Pattern-based validation engine
|
|
93
|
+
- [x] CLI output with colors
|
|
94
|
+
- [x] `npx devguard` via npm
|
|
95
|
+
- [x] `--path` option for custom `.env` paths
|
|
96
|
+
- [ ] Custom rules via `devguard.config.toml`
|
|
97
|
+
- [ ] CI/CD integration
|
|
98
|
+
- [ ] GitHub Action
|
|
99
|
+
- [ ] VSCode extension
|
|
100
|
+
- [ ] Docker config validation
|
|
101
|
+
- [ ] Secret leak detection in source files
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## π§ Local Development
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git clone https://github.com/ekojoecovenant/devguard.git
|
|
109
|
+
cd devguard
|
|
110
|
+
cargo build --release
|
|
111
|
+
node cli.js check
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## π€ Contributing
|
|
117
|
+
|
|
118
|
+
Contributions are welcome! Here's how to get started:
|
|
119
|
+
|
|
120
|
+
1. Fork the repo
|
|
121
|
+
2. Create a feature branch
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
git checkout -b feature/your-feature-name
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
3. Make your changes
|
|
128
|
+
4. Run the project locally to test
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
cargo build --release
|
|
132
|
+
node cli.js check
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
5. Open a Pull Request with a clear description of what you changed and why
|
|
136
|
+
|
|
137
|
+
Please keep PRs focused β one feature or fix per PR.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## π License
|
|
142
|
+
|
|
143
|
+
MIT β use it, build on it, ship it.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
<p align="center">Built with π¦ Rust β by <a href="https://github.com/ekojoecovenant">βπ¬π³π’</a></p>
|
|
Binary file
|
package/cli.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const { spawnSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
// detect OS and pick correct binary
|
|
8
|
+
const platform = os.platform();
|
|
9
|
+
const binaryName =
|
|
10
|
+
platform === 'win32'
|
|
11
|
+
? 'devguard-win.exe'
|
|
12
|
+
: platform === 'darwin'
|
|
13
|
+
? 'devguard-macos'
|
|
14
|
+
: 'devguard-linux';
|
|
15
|
+
|
|
16
|
+
const binaryPath = path.join(__dirname, 'bin', binaryName);
|
|
17
|
+
|
|
18
|
+
// pass ALL argumets through to RUST binary
|
|
19
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
20
|
+
stdio: 'inherit',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
process.exit(result.status);
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deveko/devguard",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A fast .env scanner for Node.js projects",
|
|
5
|
+
"bin": {
|
|
6
|
+
"devguard": "cli.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"cli.js",
|
|
10
|
+
"bin/"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"env",
|
|
14
|
+
"security",
|
|
15
|
+
"cli",
|
|
16
|
+
"devtools",
|
|
17
|
+
"validation"
|
|
18
|
+
],
|
|
19
|
+
"author": "Ekojoe Covenant",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=14.0.0"
|
|
23
|
+
}
|
|
24
|
+
}
|