@gfargo/doorman 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/LICENSE +21 -0
- package/README.md +506 -0
- package/bin/run +3 -0
- package/bin/run-deprecated +11 -0
- package/bin/run.ts +23 -0
- package/dist/bin/run.d.mts +2 -0
- package/dist/bin/run.d.ts +2 -0
- package/dist/bin/run.js +167 -0
- package/dist/bin/run.mjs +167 -0
- package/dist/src/index.d.mts +23 -0
- package/dist/src/index.d.ts +23 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.mjs +1 -0
- package/package.json +157 -0
- package/skills/doorman/SKILL.md +132 -0
- package/skills/doorman/rules-reference.md +478 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Griffen Fargo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
# 🚪 Doorman
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@gfargo/doorman)
|
|
4
|
+
[](https://www.npmjs.com/package/@gfargo/doorman)
|
|
5
|
+
[](https://www.npmjs.com/package/@gfargo/doorman)
|
|
6
|
+
[](https://github.com/gfargo/doorman/issues)
|
|
7
|
+
[](https://github.com/gfargo/doorman/pulls)
|
|
8
|
+
[](https://github.com/gfargo/doorman/tree/main)
|
|
9
|
+
|
|
10
|
+
**The complete toolkit for managing firewall rules as code across multiple providers.**
|
|
11
|
+
|
|
12
|
+
Doorman enables Infrastructure as Code (IaC) for your security layer, bringing version control, automated deployment, and team collaboration to your firewall configuration. Supports Vercel Firewall and Cloudflare WAF.
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<img src="./assets/demos/quickstart.gif" alt="vercel-doorman init security-focused, then vercel-doorman validate --verbose, showing a passing configuration" width="720" />
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center"><sub>Real terminal output — <code>vercel-doorman init security-focused</code> followed by <code>vercel-doorman validate --verbose</code>. Recorded with <a href="https://github.com/charmbracelet/vhs">VHS</a>, see <a href="/demos">/demos</a>.</sub></p>
|
|
19
|
+
|
|
20
|
+
## ✨ Features
|
|
21
|
+
|
|
22
|
+
### Core Functionality
|
|
23
|
+
|
|
24
|
+
- 🔒 **Complete Rule Management** - Create, update, delete custom rules and IP blocking
|
|
25
|
+
- 🔄 **Bidirectional Sync** - Keep local configs and Vercel in perfect sync
|
|
26
|
+
- 📊 **Smart Status Checking** - Know exactly what needs syncing before you deploy
|
|
27
|
+
- 🔍 **Detailed Diff Analysis** - See exactly what will change with color-coded output
|
|
28
|
+
- ✅ **Advanced Validation** - Syntax checking plus configuration health scoring
|
|
29
|
+
|
|
30
|
+
> ✅ **New in 2.0:** Cloudflare WAF support is here! Manage both Vercel and Cloudflare firewall rules from a single tool with `--provider cloudflare`.
|
|
31
|
+
|
|
32
|
+
### Developer Experience
|
|
33
|
+
|
|
34
|
+
- 🚀 **Interactive Setup** - Guided initialization with helpful links and validation
|
|
35
|
+
- 👀 **Watch Mode** - Auto-sync during development for faster iteration
|
|
36
|
+
- 📋 **Multiple Output Formats** - Table, JSON, YAML, Markdown, and Terraform export
|
|
37
|
+
- 🛡️ **Safety First** - Backup/restore functionality and confirmation prompts
|
|
38
|
+
- 📚 **Rich Templates** - Pre-built security rules from Vercel's template library
|
|
39
|
+
|
|
40
|
+
### Enterprise Ready
|
|
41
|
+
|
|
42
|
+
- 🔄 **CI/CD Integration** - JSON outputs and validation perfect for automation
|
|
43
|
+
- 📈 **Health Monitoring** - Configuration scoring and best practice recommendations
|
|
44
|
+
- 🏥 **Comprehensive Testing** - 50+ test scenarios covering edge cases and failures
|
|
45
|
+
- 📖 **Documentation Export** - Generate team documentation in multiple formats
|
|
46
|
+
|
|
47
|
+
## 🚀 Quick Start
|
|
48
|
+
|
|
49
|
+
### Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install -g @gfargo/doorman
|
|
53
|
+
# or
|
|
54
|
+
yarn global add @gfargo/doorman
|
|
55
|
+
# or
|
|
56
|
+
pnpm add -g @gfargo/doorman
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Get Started in 30 Seconds
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# 1. See the setup guide
|
|
63
|
+
doorman setup
|
|
64
|
+
|
|
65
|
+
# 2. Initialize your project (interactive)
|
|
66
|
+
doorman init --interactive
|
|
67
|
+
|
|
68
|
+
# 3. Check your configuration health
|
|
69
|
+
doorman status
|
|
70
|
+
|
|
71
|
+
# 4. Deploy your rules
|
|
72
|
+
doorman sync
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 📋 Configuration
|
|
76
|
+
|
|
77
|
+
Doorman uses a simple JSON configuration file with full TypeScript support and JSON Schema validation:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"$schema": "https://doorman.griffen.codes/schema.json",
|
|
82
|
+
"projectId": "prj_abc123",
|
|
83
|
+
"teamId": "team_xyz789",
|
|
84
|
+
"rules": [
|
|
85
|
+
{
|
|
86
|
+
"id": "rule_block_bots",
|
|
87
|
+
"name": "Block Bad Bots",
|
|
88
|
+
"description": "Block malicious bots and crawlers",
|
|
89
|
+
"active": true,
|
|
90
|
+
"conditionGroup": [
|
|
91
|
+
{
|
|
92
|
+
"conditions": [
|
|
93
|
+
{
|
|
94
|
+
"type": "user_agent",
|
|
95
|
+
"op": "sub",
|
|
96
|
+
"value": "bot"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"action": {
|
|
102
|
+
"mitigate": {
|
|
103
|
+
"action": "deny"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"ips": [
|
|
109
|
+
{
|
|
110
|
+
"ip": "192.168.1.100",
|
|
111
|
+
"hostname": "suspicious-host",
|
|
112
|
+
"action": "deny"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 🎨 Getting Started with Rules
|
|
119
|
+
|
|
120
|
+
**Option 1: Use the `add` Command** (Recommended)
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
doorman add --interactive # Guided prompts
|
|
124
|
+
doorman add --name "Block Admin" --field path --op pre --value "/admin" --action deny
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
<p align="center">
|
|
128
|
+
<img src="./assets/demos/add-interactive.gif" alt="vercel-doorman add --interactive walking through creating a Block Admin Access rule" width="720" />
|
|
129
|
+
</p>
|
|
130
|
+
|
|
131
|
+
**Option 2: Use Templates**
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
doorman template # Browse available templates
|
|
135
|
+
doorman template ai-bots # Add AI bot protection
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
<p align="center">
|
|
139
|
+
<img src="./assets/demos/template-picker.gif" alt="vercel-doorman template picker adding the ai-bots template" width="720" />
|
|
140
|
+
</p>
|
|
141
|
+
|
|
142
|
+
**Option 3: Interactive Setup**
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
doorman init security-focused # Start with security templates
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Option 4: Import Existing**
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
doorman download # Import your current Vercel rules
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 📚 Examples & Templates
|
|
155
|
+
|
|
156
|
+
- **[Template Library](https://vercel.com/templates/vercel-firewall)** - Official Vercel templates
|
|
157
|
+
- **[Example Configurations](/examples)** - Real-world configuration examples
|
|
158
|
+
- **[Rule Builder Guide](https://vercel.com/docs/security/vercel-firewall)** - Vercel's official documentation
|
|
159
|
+
|
|
160
|
+
## 🛠️ Commands
|
|
161
|
+
|
|
162
|
+
### Setup & Initialization
|
|
163
|
+
|
|
164
|
+
| Command | Description | Example |
|
|
165
|
+
| ------- | ------------------------------------------------- | ---------------------------- |
|
|
166
|
+
| `setup` | Show comprehensive setup guide with links | `doorman setup` |
|
|
167
|
+
| `init` | Create new configuration with interactive prompts | `doorman init --interactive` |
|
|
168
|
+
|
|
169
|
+
### Rule Creation
|
|
170
|
+
|
|
171
|
+
| Command | Description | Example |
|
|
172
|
+
| ---------- | --------------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
173
|
+
| `add` | Add a new rule from the CLI (interactive or inline) | `doorman add --name "Block" --field path --op pre --value "/admin" --action deny` |
|
|
174
|
+
| `template` | Add predefined rule templates | `doorman template ai-bots` |
|
|
175
|
+
|
|
176
|
+
### Rule Management
|
|
177
|
+
|
|
178
|
+
| Command | Description | Example |
|
|
179
|
+
| ---------- | -------------------------------------------------- | ---------------------------------- |
|
|
180
|
+
| `remove` | Remove rules by name, ID, or interactive selection | `doorman remove --name "Old Rule"` |
|
|
181
|
+
| `template` | Add predefined rule templates | `doorman template ai-bots` |
|
|
182
|
+
|
|
183
|
+
### Status & Information
|
|
184
|
+
|
|
185
|
+
| Command | Description | Use Case |
|
|
186
|
+
| -------- | -------------------------------------------------- | ------------------------ |
|
|
187
|
+
| `status` | Show sync status and configuration health | Before syncing changes |
|
|
188
|
+
| `list` | Display current deployed rules | Audit what's live |
|
|
189
|
+
| `diff` | Show detailed differences between local and remote | Review before deployment |
|
|
190
|
+
|
|
191
|
+
### Configuration Management
|
|
192
|
+
|
|
193
|
+
| Command | Description | Direction |
|
|
194
|
+
| ---------- | ------------------------------------- | ---------------- |
|
|
195
|
+
| `sync` | Apply local changes to Vercel | Local → Remote |
|
|
196
|
+
| `download` | Import Vercel rules to local config | Remote → Local |
|
|
197
|
+
| `validate` | Check configuration syntax and health | Local validation |
|
|
198
|
+
|
|
199
|
+
### Advanced Features
|
|
200
|
+
|
|
201
|
+
| Command | Description | Use Case |
|
|
202
|
+
| -------- | ------------------------------------------------------------ | -------------------- |
|
|
203
|
+
| `watch` | Auto-sync on file changes | Development workflow |
|
|
204
|
+
| `backup` | Create/restore configuration backups | Safety & rollback |
|
|
205
|
+
| `export` | Export in multiple formats (JSON, YAML, Markdown, Terraform) | Documentation & IaC |
|
|
206
|
+
|
|
207
|
+
## 🔄 Workflows
|
|
208
|
+
|
|
209
|
+
### Development Workflow
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Start watching for changes
|
|
213
|
+
doorman watch
|
|
214
|
+
|
|
215
|
+
# Or manual development cycle:
|
|
216
|
+
doorman status # Check what needs syncing
|
|
217
|
+
doorman diff # Review changes
|
|
218
|
+
doorman sync # Deploy changes
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Production Deployment
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
doorman backup # Safety first
|
|
225
|
+
doorman validate # Check syntax
|
|
226
|
+
doorman diff # Review changes
|
|
227
|
+
doorman sync # Deploy
|
|
228
|
+
doorman status # Verify deployment
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Team Collaboration
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
doorman export --format markdown # Generate docs
|
|
235
|
+
doorman backup --list # Manage backups
|
|
236
|
+
doorman download # Sync with team changes
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## 🔧 Configuration
|
|
240
|
+
|
|
241
|
+
### Environment Variables
|
|
242
|
+
|
|
243
|
+
Set these environment variables to avoid passing credentials in commands:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
export VERCEL_TOKEN="your-api-token"
|
|
247
|
+
export VERCEL_PROJECT_ID="prj_abc123" # Optional
|
|
248
|
+
export VERCEL_TEAM_ID="team_xyz789" # Optional if using team
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### API Token Setup
|
|
252
|
+
|
|
253
|
+
1. Visit [Vercel Account Tokens](https://vercel.com/account/tokens)
|
|
254
|
+
2. Click "Create Token"
|
|
255
|
+
3. Name: "Doorman Firewall Management"
|
|
256
|
+
4. Scope: Select your project/team
|
|
257
|
+
5. Copy token and set as `VERCEL_TOKEN`
|
|
258
|
+
|
|
259
|
+
**Need help?** Run `doorman setup` for detailed instructions with direct links.
|
|
260
|
+
|
|
261
|
+
## 📊 Command Examples
|
|
262
|
+
|
|
263
|
+
### Basic Usage
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Quick status check
|
|
267
|
+
doorman status
|
|
268
|
+
|
|
269
|
+
# See what's currently deployed
|
|
270
|
+
doorman list
|
|
271
|
+
|
|
272
|
+
# Apply your local changes
|
|
273
|
+
doorman sync
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Advanced Usage
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Export documentation
|
|
280
|
+
doorman export --format markdown --output firewall-docs.md
|
|
281
|
+
|
|
282
|
+
# Backup before major changes
|
|
283
|
+
doorman backup
|
|
284
|
+
|
|
285
|
+
# Watch for changes during development
|
|
286
|
+
doorman watch
|
|
287
|
+
|
|
288
|
+
# Get detailed diff in JSON for CI/CD
|
|
289
|
+
doorman diff --format json
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### CI/CD Integration
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# Validate in CI pipeline
|
|
296
|
+
doorman validate
|
|
297
|
+
|
|
298
|
+
# Check for changes (exit code indicates changes)
|
|
299
|
+
doorman diff --format json > changes.json
|
|
300
|
+
|
|
301
|
+
# Deploy in production
|
|
302
|
+
doorman sync --config production.config.json
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## 🏥 Configuration Health
|
|
306
|
+
|
|
307
|
+
Doorman includes a built-in health checker that scores your configuration and provides recommendations:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
doorman status # Includes health score
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**Health Score Factors:**
|
|
314
|
+
|
|
315
|
+
- **Rule Naming** - Proper ID formats and descriptive names
|
|
316
|
+
- **Security Best Practices** - Rate limiting, bot protection, etc.
|
|
317
|
+
- **Performance Impact** - Rule complexity and regex usage
|
|
318
|
+
- **Maintainability** - Disabled rules, duplicates, versioning
|
|
319
|
+
|
|
320
|
+
**Score Ranges:**
|
|
321
|
+
|
|
322
|
+
- 🟢 80-100: Excellent configuration
|
|
323
|
+
- 🟡 60-79: Good with minor improvements needed
|
|
324
|
+
- 🔴 0-59: Needs attention
|
|
325
|
+
|
|
326
|
+
## 🔒 Security Best Practices
|
|
327
|
+
|
|
328
|
+
### Token Management
|
|
329
|
+
|
|
330
|
+
- Store API tokens in environment variables, never in code
|
|
331
|
+
- Set token expiration dates appropriately
|
|
332
|
+
- Use principle of least privilege for token scopes
|
|
333
|
+
- Regularly rotate API tokens
|
|
334
|
+
|
|
335
|
+
### Rule Management
|
|
336
|
+
|
|
337
|
+
- Test rules in staging before production
|
|
338
|
+
- Keep backups of working configurations
|
|
339
|
+
- Use descriptive names and documentation
|
|
340
|
+
- Start with rules disabled, enable after testing
|
|
341
|
+
|
|
342
|
+
### Team Collaboration
|
|
343
|
+
|
|
344
|
+
- Use version control for configuration files
|
|
345
|
+
- Document rule purposes and business logic
|
|
346
|
+
- Regular security audits of active rules
|
|
347
|
+
- Establish approval processes for rule changes
|
|
348
|
+
|
|
349
|
+
## 🚀 Advanced Features
|
|
350
|
+
|
|
351
|
+
### Watch Mode for Development
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
doorman watch --interval 1000
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Automatically syncs changes when you modify your config file. Perfect for rapid development and testing.
|
|
358
|
+
|
|
359
|
+
### Backup Management
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
doorman backup # Create backup
|
|
363
|
+
doorman backup --list # List backups
|
|
364
|
+
doorman backup --restore backup.json # Restore backup
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Multi-Format Export
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# Generate team documentation
|
|
371
|
+
doorman export --format markdown
|
|
372
|
+
|
|
373
|
+
# Export for Terraform (conceptual)
|
|
374
|
+
doorman export --format terraform
|
|
375
|
+
|
|
376
|
+
# CI/CD integration
|
|
377
|
+
doorman export --format json --source remote
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Configuration Health Monitoring
|
|
381
|
+
|
|
382
|
+
The health checker evaluates:
|
|
383
|
+
|
|
384
|
+
- Rule naming conventions
|
|
385
|
+
- Security coverage gaps
|
|
386
|
+
- Performance optimization opportunities
|
|
387
|
+
- Maintenance recommendations
|
|
388
|
+
|
|
389
|
+
## 🔧 Troubleshooting
|
|
390
|
+
|
|
391
|
+
### Common Issues
|
|
392
|
+
|
|
393
|
+
**"Project not found" error:**
|
|
394
|
+
|
|
395
|
+
- Verify your Project ID is correct
|
|
396
|
+
- Ensure your token has access to the project
|
|
397
|
+
- Check that the project has Pro plan or higher
|
|
398
|
+
|
|
399
|
+
**"Unauthorized" error:**
|
|
400
|
+
|
|
401
|
+
- Confirm `VERCEL_TOKEN` is set correctly
|
|
402
|
+
- Verify token hasn't expired
|
|
403
|
+
- Ensure token has firewall permissions
|
|
404
|
+
|
|
405
|
+
**Sync issues:**
|
|
406
|
+
|
|
407
|
+
- Run `doorman status` to see what's out of sync
|
|
408
|
+
- Use `doorman diff` to see detailed changes
|
|
409
|
+
- Check for validation errors with `doorman validate`
|
|
410
|
+
|
|
411
|
+
**Need more help?**
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
doorman setup # Comprehensive setup guide
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## 📚 Resources
|
|
418
|
+
|
|
419
|
+
- **[Setup Guide](https://github.com/gfargo/doorman#setup)** - Complete setup instructions
|
|
420
|
+
- **[Example Configurations](/examples)** - Real-world examples
|
|
421
|
+
- **[Vercel Firewall Docs](https://vercel.com/docs/security/vercel-firewall)** - Official documentation
|
|
422
|
+
- **[Template Library](https://vercel.com/templates/vercel-firewall)** - Pre-built rule templates
|
|
423
|
+
- **[API Reference](https://vercel.com/docs/rest-api/endpoints/firewall)** - Vercel Firewall API
|
|
424
|
+
|
|
425
|
+
## 🤝 Contributing
|
|
426
|
+
|
|
427
|
+
We welcome contributions! Here's how you can help:
|
|
428
|
+
|
|
429
|
+
### Development Setup
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
git clone https://github.com/gfargo/doorman.git
|
|
433
|
+
cd doorman
|
|
434
|
+
pnpm install
|
|
435
|
+
pnpm build
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Running Tests
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
pnpm test # Run test suite
|
|
442
|
+
pnpm test:coverage # Run with coverage
|
|
443
|
+
pnpm test:watch # Watch mode
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Contributing Guidelines
|
|
447
|
+
|
|
448
|
+
- Follow existing code style and patterns
|
|
449
|
+
- Add tests for new features
|
|
450
|
+
- Update documentation for changes
|
|
451
|
+
- Use conventional commit messages
|
|
452
|
+
|
|
453
|
+
### Areas for Contribution
|
|
454
|
+
|
|
455
|
+
- Additional export formats
|
|
456
|
+
- Enhanced rule templates
|
|
457
|
+
- Performance optimizations
|
|
458
|
+
- Documentation improvements
|
|
459
|
+
- Bug fixes and edge cases
|
|
460
|
+
|
|
461
|
+
## 📈 Why Doorman?
|
|
462
|
+
|
|
463
|
+
### Before Doorman
|
|
464
|
+
|
|
465
|
+
- Manual firewall rule management through Vercel dashboard
|
|
466
|
+
- No version control for security configurations
|
|
467
|
+
- Difficult to sync rules across environments
|
|
468
|
+
- No validation or testing of rule changes
|
|
469
|
+
- Hard to collaborate on security policies
|
|
470
|
+
|
|
471
|
+
### After Doorman
|
|
472
|
+
|
|
473
|
+
- ✅ Infrastructure as Code for firewall rules
|
|
474
|
+
- ✅ Full version control and change tracking
|
|
475
|
+
- ✅ Automated deployment and validation
|
|
476
|
+
- ✅ Team collaboration with documentation
|
|
477
|
+
- ✅ Health monitoring and best practices
|
|
478
|
+
- ✅ Backup/restore and safety features
|
|
479
|
+
|
|
480
|
+
## 🎯 Use Cases
|
|
481
|
+
|
|
482
|
+
- **Startups** - Quick security setup with templates
|
|
483
|
+
- **Enterprise** - Automated compliance and governance
|
|
484
|
+
- **DevOps Teams** - CI/CD integration and IaC workflows
|
|
485
|
+
- **Security Teams** - Centralized policy management
|
|
486
|
+
- **Development Teams** - Safe iteration and testing
|
|
487
|
+
|
|
488
|
+
## 📊 Project Stats
|
|
489
|
+
|
|
490
|
+

|
|
491
|
+
|
|
492
|
+
## 🙏 Acknowledgments
|
|
493
|
+
|
|
494
|
+
- **Vercel Team** - For building an excellent firewall platform
|
|
495
|
+
- **Community Contributors** - For feedback, bug reports, and improvements
|
|
496
|
+
- **Security Community** - For best practices and rule templates
|
|
497
|
+
|
|
498
|
+
## 📄 License
|
|
499
|
+
|
|
500
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
**Made with ❤️ by [Griffen Fargo](https://github.com/gfargo)**
|
|
505
|
+
|
|
506
|
+
_Securing the web, one firewall rule at a time._ 🚪🔒
|
package/bin/run
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Deprecation warning using raw ANSI codes (no dependencies needed)
|
|
4
|
+
process.stderr.write(
|
|
5
|
+
'\x1b[33m⚠️ The "vercel-doorman" command is deprecated and will be removed in a future release.\x1b[0m\n' +
|
|
6
|
+
'\x1b[33m Please use \x1b[1m"doorman"\x1b[22m instead.\x1b[0m\n' +
|
|
7
|
+
'\x1b[2m Install: npm i -g @gfargo/doorman\x1b[0m\n\n',
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// Delegate to the real CLI
|
|
11
|
+
import('../dist/bin/run.mjs')
|
package/bin/run.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { config } from 'dotenv'
|
|
2
|
+
import yargs, { CommandModule } from 'yargs'
|
|
3
|
+
import { commands } from '../src/commands'
|
|
4
|
+
|
|
5
|
+
config()
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const chalk = (await import('chalk')).default
|
|
9
|
+
|
|
10
|
+
const run = yargs(process.argv.slice(2))
|
|
11
|
+
run.usage(`${chalk.bold('🚪 Doorman')}\n\n${chalk.dim('Manage firewall rules as code across multiple providers')}`)
|
|
12
|
+
|
|
13
|
+
for (const command of commands) {
|
|
14
|
+
run.command(command as CommandModule)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
run
|
|
18
|
+
.demandCommand(1, 'You need at least one command before moving on')
|
|
19
|
+
.help()
|
|
20
|
+
.epilogue(chalk.dim(`See ${chalk.bold('https://doorman.griffen.codes/getting-started')} for more info`)).argv
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
main().catch(console.error)
|