@deveko/devguard 0.1.6 β 0.1.8
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 +179 -177
- package/bin/devguard-linux +0 -0
- package/bin/devguard-macos +0 -0
- package/bin/devguard-win.exe +0 -0
- package/cli.js +23 -23
- package/package.json +24 -24
package/README.md
CHANGED
|
@@ -1,177 +1,179 @@
|
|
|
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 (`SECRET`, `KEY`, `API` too short)
|
|
15
|
-
- β Catches invalid port values (e.g. `PORT=abc`)
|
|
16
|
-
- β Flags malformed URLs (e.g. `DATABASE_URL=localhost`)
|
|
17
|
-
- β Validates `NODE_ENV` values
|
|
18
|
-
- β οΈ Warns about empty, malformed, or missing variables
|
|
19
|
-
- β
Priority-based rule engine
|
|
20
|
-
- β
Auto-generates `.env.example` from `.env`
|
|
21
|
-
- β
Clean, readable CLI output
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## π Installation
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npx @deveko/devguard
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
That's it. No installation needed.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## π¦ Usage
|
|
36
|
-
|
|
37
|
-
Place a `.env` file in your project root, then run:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
# Scan default .env
|
|
41
|
-
npx @deveko/devguard check
|
|
42
|
-
|
|
43
|
-
# Scan a custom path
|
|
44
|
-
npx @deveko/devguard check --path ./apps/backend/.env
|
|
45
|
-
|
|
46
|
-
# Generate .env.example from .env
|
|
47
|
-
npx @deveko/devguard init
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Example `.env`
|
|
51
|
-
|
|
52
|
-
```env
|
|
53
|
-
TEST2
|
|
54
|
-
PORT=abc
|
|
55
|
-
JWT_SECRET=123
|
|
56
|
-
DATABASE_URL=localhost
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
β
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
| Key
|
|
102
|
-
| Key contains `
|
|
103
|
-
| Key contains `
|
|
104
|
-
| Key contains `
|
|
105
|
-
| Key contains `
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- [x]
|
|
117
|
-
- [x]
|
|
118
|
-
- [x]
|
|
119
|
-
- [x]
|
|
120
|
-
- [x]
|
|
121
|
-
- [x]
|
|
122
|
-
- [x]
|
|
123
|
-
- [x]
|
|
124
|
-
- [x]
|
|
125
|
-
- [
|
|
126
|
-
- [
|
|
127
|
-
- [
|
|
128
|
-
- [ ]
|
|
129
|
-
- [ ]
|
|
130
|
-
- [ ]
|
|
131
|
-
- [ ]
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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 (`SECRET`, `KEY`, `API` too short)
|
|
15
|
+
- β Catches invalid port values (e.g. `PORT=abc`)
|
|
16
|
+
- β Flags malformed URLs (e.g. `DATABASE_URL=localhost`)
|
|
17
|
+
- β Validates `NODE_ENV` values
|
|
18
|
+
- β οΈ Warns about empty, malformed, or missing variables
|
|
19
|
+
- β
Priority-based rule engine
|
|
20
|
+
- β
Auto-generates `.env.example` from `.env`
|
|
21
|
+
- β
Clean, readable CLI output
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## π Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx @deveko/devguard
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That's it. No installation needed.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## π¦ Usage
|
|
36
|
+
|
|
37
|
+
Place a `.env` file in your project root, then run:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Scan default .env
|
|
41
|
+
npx @deveko/devguard check
|
|
42
|
+
|
|
43
|
+
# Scan a custom path
|
|
44
|
+
npx @deveko/devguard check --path ./apps/backend/.env
|
|
45
|
+
|
|
46
|
+
# Generate .env.example from .env
|
|
47
|
+
npx @deveko/devguard init
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Example `.env`
|
|
51
|
+
|
|
52
|
+
```env
|
|
53
|
+
TEST2
|
|
54
|
+
PORT=abc
|
|
55
|
+
JWT_SECRET=123
|
|
56
|
+
DATABASE_URL=localhost
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Example output
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
π DevGuard - scanning .env...
|
|
63
|
+
|
|
64
|
+
=== Warning(s) ===
|
|
65
|
+
β οΈ 'TEST2' is malformed - missing '='
|
|
66
|
+
|
|
67
|
+
=== Error(s) ===
|
|
68
|
+
β PORT -> must be a number
|
|
69
|
+
β JWT_SECRET -> must be greater than or equal to 32
|
|
70
|
+
β DATABASE_URL -> must start with http://, https://, postgres://...
|
|
71
|
+
|
|
72
|
+
=== Missing(s) ===
|
|
73
|
+
β REDIS_URL -> missing required variable
|
|
74
|
+
|
|
75
|
+
β οΈ 4 error(s) and 1 warning(s) found
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
When everything looks good:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
π DevGuard - scanning .env...
|
|
82
|
+
|
|
83
|
+
β
All checks passed! Your .env looks good!
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## π§ How It Works
|
|
89
|
+
|
|
90
|
+
DevGuard runs three checks on your project:
|
|
91
|
+
|
|
92
|
+
**1. Parse Check**
|
|
93
|
+
Scans `.env` line by line for malformed entries
|
|
94
|
+
|
|
95
|
+
**2. Validation Check**
|
|
96
|
+
Runs pattern-based rules with priority ordering:
|
|
97
|
+
|
|
98
|
+
| Pattern | Rule |
|
|
99
|
+
| ------- | ---- |
|
|
100
|
+
| Key is `NODE_ENV` | Must be `development`, `production`, or `test` |
|
|
101
|
+
| Key contains `SECRET` or `KEY` or `API` | Value must be β₯ 32 characters |
|
|
102
|
+
| Key contains `URL` | Must start with a valid protocol (http, postgres, redis, etc.) |
|
|
103
|
+
| Key contains `PORT` | Must be a valid number (0-65535) |
|
|
104
|
+
| Key contains `HOST` | Must not be empty |
|
|
105
|
+
| Key contains `ID` | Must not be empty |
|
|
106
|
+
|
|
107
|
+
**3. Missing Keys Check**
|
|
108
|
+
Compares `.env` against `.env.example` - any key in `.env.example` missing from `.env` is flagged!!
|
|
109
|
+
|
|
110
|
+
No config needed. Just run it.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## πΊοΈ Roadmap
|
|
115
|
+
|
|
116
|
+
- [x] `.env` parser
|
|
117
|
+
- [x] Pattern-based validation engine
|
|
118
|
+
- [x] CLI output with colors
|
|
119
|
+
- [x] `npx devguard` via npm
|
|
120
|
+
- [x] `--path` option for custom `.env` paths
|
|
121
|
+
- [x] Malformed line detection
|
|
122
|
+
- [x] Improved error summary
|
|
123
|
+
- [x] New validation rules
|
|
124
|
+
- [x] Priority system
|
|
125
|
+
- [x] `devguard init` -> auto-generate `.env.example`
|
|
126
|
+
- [x] Missing required keys detection
|
|
127
|
+
- [x] Sectioned output (Warnings, Errors, Missing)
|
|
128
|
+
- [ ] Custom rules via `devguard.config.toml`
|
|
129
|
+
- [ ] CI/CD integration
|
|
130
|
+
- [ ] GitHub Action
|
|
131
|
+
- [ ] VSCode extension
|
|
132
|
+
- [ ] Docker config validation
|
|
133
|
+
- [ ] Secret leak detection in source files
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## π§ Local Development
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
git clone https://github.com/ekojoecovenant/devguard.git
|
|
141
|
+
cd devguard
|
|
142
|
+
cargo build --release
|
|
143
|
+
node cli.js check
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## π€ Contributing
|
|
149
|
+
|
|
150
|
+
Contributions are welcome! Here's how to get started:
|
|
151
|
+
|
|
152
|
+
1. Fork the repo
|
|
153
|
+
2. Create a feature branch
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
git checkout -b feature/your-feature-name
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
3. Make your changes
|
|
160
|
+
4. Run the project locally to test
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
cargo build --release
|
|
164
|
+
node cli.js check
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
5. Open a Pull Request with a clear description of what you changed and why
|
|
168
|
+
|
|
169
|
+
Please keep PRs focused β one feature or fix per PR.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## π License
|
|
174
|
+
|
|
175
|
+
MIT β use it, build on it, ship it.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
<p align="center">Built with π¦ Rust β by <a href="https://github.com/ekojoecovenant">βπ¬π³π’</a></p>
|
|
Binary file
|
|
Binary file
|
package/bin/devguard-win.exe
CHANGED
|
Binary file
|
package/cli.js
CHANGED
|
@@ -1,23 +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);
|
|
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
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@deveko/devguard",
|
|
3
|
-
"version": "0.1.
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@deveko/devguard",
|
|
3
|
+
"version": "0.1.8",
|
|
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
|
+
}
|