Skip to content

Commit c21eb47

Browse files
committed
Unify secret key validation and fix documentation
- Add SecretKeyValidator as single source of truth for key validation - Update Secret, Placeholder, ImportService, SecretController to use unified validator - Fix frontend validation to match backend rules (SecretDialog, RenameDialog) - Add path traversal protection to TemplateService - Remove exception type leakage from Router error responses - Add missing command configs to ArgumentProcessor (diff, verify, export) - Remove dead cache export code from ExportCommand - Extract import delay to named constant Documentation fixes: - Fix --output to --file flag throughout docs - Fix keep list to keep show, keep ui to keep server - Remove false rate limiting claims from WEB_UI.md - Replace YAML with CSV in export format docs and frontend - Fix broken links to CLI reference - Add Secret Key Naming Rules section to CLI reference - Clarify template placeholder syntax
1 parent 77d0928 commit c21eb47

32 files changed

Lines changed: 349 additions & 173 deletions

docs/WEB_UI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Compare secrets across envs and vaults:
5353
### Export
5454

5555
Export secrets in multiple formats:
56-
- **Formats**: ENV, JSON, YAML, Shell script
56+
- **Formats**: ENV, JSON, CSV
5757
- **Live preview** before download
5858
- **Copy to clipboard** for quick use
5959
- **Template support** for custom formats
@@ -125,7 +125,7 @@ Manage Keep configuration:
125125
- Binds to 127.0.0.1 by default
126126
- No CORS headers (prevents external access)
127127
- HTTPS not required for localhost
128-
- Rate limiting on API endpoints
128+
- Token validation on all API endpoints
129129

130130
## Troubleshooting
131131

docs/guide/cli/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ For detailed command syntax and options, see the [CLI Command Reference](./refer
143143
| `keep run` | Runtime injection | Production deployment |
144144
| `keep delete` | Remove secrets | Cleanup |
145145
| `keep shell` | Interactive mode | Exploration |
146-
| `keep ui` | Web interface | Management |
146+
| `keep server` | Web interface | Management |
147147

148148
## Integration Examples
149149

docs/guide/cli/reference.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,25 @@ Create or update secrets in vaults.
182182
- `[key]` - Secret key name (prompted if not provided)
183183
- `[value]` - Secret value (prompted if not provided)
184184

185+
### Secret Key Naming Rules
186+
187+
Secret keys must follow these rules:
188+
- **Allowed characters**: Letters, numbers, underscores, and hyphens (`A-Za-z0-9_-`)
189+
- **Length**: 1-255 characters
190+
- **Cannot start with hyphen**: Keys like `-MY_KEY` are rejected (could be interpreted as command flags)
191+
192+
**Valid examples:**
193+
- `DATABASE_PASSWORD`
194+
- `api-key`
195+
- `my_service_v2_token`
196+
- `AWS_ACCESS_KEY_ID`
197+
198+
**Invalid examples:**
199+
- `-starts-with-hyphen` (starts with hyphen)
200+
- `has spaces` (contains spaces)
201+
- `path/with/slashes` (contains slashes)
202+
- `dotted.key.name` (contains dots)
203+
185204
**Examples:**
186205
```bash
187206
# Interactive mode

docs/guide/deployment/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ One template per env, containing both secrets (as placeholders) and static confi
101101
- Learn about [Runtime Secrets Injection](./runtime-injection.md)
102102
- Set up [Templates](./templates.md) for your applications
103103
- Understand [File Export](./exporting.md) options
104-
- Review [Security Best Practices](/guide/reference/security-architecture)
104+
- Review [AWS Authentication](/guide/aws-authentication) for security best practices

docs/guide/deployment/templates.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ TIMEZONE=UTC
2323
REDIS_HOST=redis.internal
2424
QUEUE_CONNECTION=redis
2525

26-
# Secrets from vaults
26+
# Secrets from vaults (format: {vault:key})
2727
DATABASE_URL={ssm:DATABASE_URL}
2828
REDIS_PASSWORD={ssm:REDIS_PASSWORD}
2929
API_KEY={ssm:API_KEY}
3030

31-
# Path-based secrets
32-
STRIPE_KEY={ssm:payments/stripe/key}
33-
3431
# Multiple vaults
3532
AWS_ACCESS_KEY={ssm:AWS_ACCESS_KEY}
3633
GITHUB_TOKEN={secretsmanager:GITHUB_TOKEN}

docs/guide/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ keep get DB_PASSWORD --env=local --unmask
2929

3030
```bash
3131
# Export secrets to a .env file
32-
keep export --env=local --output=.env
32+
keep export --env=local --file=.env
3333
```
3434

3535
This creates a `.env` file with your secrets:

docs/guide/vaults/aws-secrets-manager.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,4 +343,4 @@ For supported services like RDS, enable automatic rotation:
343343

344344
- [AWS SSM Parameter Store](./aws-ssm) - For cost-effective configuration and simple secrets
345345
- [Deployment & Runtime](../deployment/) - Export secrets and runtime injection
346-
- [CLI Reference](../reference/cli-reference) - Complete command documentation
346+
- [CLI Reference](../cli/reference) - Complete command documentation

docs/guide/vaults/aws-ssm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,4 @@ keep export --template=env.template --env=production --vault=ssm --output=.env
233233

234234
- [AWS Secrets Manager](./aws-secrets-manager) - For more advanced secret rotation features
235235
- [Deployment & Runtime](../deployment/) - Export secrets and runtime injection
236-
- [CLI Reference](../reference/cli-reference) - Complete command documentation
236+
- [CLI Reference](../cli/reference) - Complete command documentation

docs/guide/web-ui/features.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The Secrets page provides full CRUD operations with real-time search and filteri
99
- Copy secrets between environments and vaults
1010
- View revision history
1111
- Bulk import from `.env` files
12-
- Export in ENV, JSON, YAML, or Shell format
12+
- Export in ENV, JSON, or CSV format
1313

1414
## Diff Matrix
1515

@@ -45,12 +45,11 @@ API_KEY={secretsmanager:API_KEY}
4545
### Import
4646
Drop `.env` files or paste content to bulk import secrets. The preview shows what will be imported with conflict detection. Choose to skip existing secrets or overwrite them.
4747

48-
### Export
48+
### Export
4949
Generate configuration files in multiple formats:
5050
- **ENV** - Standard `.env` format
5151
- **JSON** - Structured object
52-
- **YAML** - Key-value pairs
53-
- **Shell** - Export statements
52+
- **CSV** - Spreadsheet-compatible format
5453

5554
Export supports filtering by patterns and selective inclusion.
5655

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ keep vault:add
4646
keep set DB_PASSWORD "super-secret" --env=production
4747

4848
# List secrets
49-
keep list --env=staging
49+
keep show --env=staging
5050

5151
# Compare environments
5252
keep diff --env=staging,production
5353

5454
# Export to .env
55-
keep export --env=production --output=.env
55+
keep export --env=production --file=.env
5656

5757
# Use templates
5858
keep export --template=.env.template --env=production --output=.env

0 commit comments

Comments
 (0)