@getaegis/cli 0.9.2 → 0.9.4
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 -550
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +11 -0
- package/dist/db.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,28 +5,45 @@
|
|
|
5
5
|
[](https://ghcr.io/getaegis/aegis)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
|
|
8
|
-
**
|
|
9
|
-
|
|
10
|
-
Aegis sits between your
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
**Stop putting API keys where AI agents can read them.**
|
|
9
|
+
|
|
10
|
+
Aegis is a local-first credential isolation proxy for AI agents. It sits between your agent and the APIs it calls — injecting secrets at the network boundary so the agent never sees, stores, or transmits real credentials.
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<img src="docs/assets/demo.gif" alt="Aegis demo" width="720" />
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
## How It Works
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
graph LR
|
|
20
|
+
Agent["🤖 AI Agent<br/><i>No credentials</i>"]
|
|
21
|
+
Gate["🛡️ Aegis Gate<br/><i>localhost:3100</i>"]
|
|
22
|
+
Check{"② Domain<br/>allowed?"}
|
|
23
|
+
API["🌐 Target API<br/><i>slack.com, github.com</i>"]
|
|
24
|
+
Ledger["📋 Ledger"]
|
|
25
|
+
|
|
26
|
+
Agent -->|"① HTTP request<br/>(no auth headers)"| Gate
|
|
27
|
+
Gate --> Check
|
|
28
|
+
Check -->|"Yes"| Inject
|
|
29
|
+
Inject["③ Inject credential"] -->|"Forward over HTTPS"| API
|
|
30
|
+
API -->|"④ Response"| Gate
|
|
31
|
+
Gate -->|"⑤ Return response<br/>(credential stripped)"| Agent
|
|
32
|
+
Check -->|"No"| Block["🚫 Blocked"]
|
|
33
|
+
Gate -.->|"Log every request"| Ledger
|
|
34
|
+
|
|
35
|
+
style Agent fill:#1a1f26,stroke:#C8973E,color:#e8ecef
|
|
36
|
+
style Gate fill:#1a1f26,stroke:#C8973E,color:#C8973E,stroke-width:2px
|
|
37
|
+
style Check fill:#1a1f26,stroke:#C8973E,color:#e8ecef
|
|
38
|
+
style Inject fill:#1a1f26,stroke:#C8973E,color:#e8ecef
|
|
39
|
+
style API fill:#1a1f26,stroke:#666,color:#e8ecef
|
|
40
|
+
style Block fill:#1a1f26,stroke:#e74c3c,color:#e74c3c
|
|
41
|
+
style Ledger fill:#1a1f26,stroke:#C8973E,color:#e8ecef
|
|
25
42
|
```
|
|
26
43
|
|
|
27
44
|
## Why?
|
|
28
45
|
|
|
29
|
-
AI agents (Claude, GPT, Cursor, custom bots) increasingly
|
|
46
|
+
AI agents (Claude, GPT, Cursor, custom bots) increasingly call real APIs — Slack, GitHub, Stripe, databases. The current pattern is dangerous:
|
|
30
47
|
|
|
31
48
|
1. **Agents see raw API keys** — one prompt injection exfiltrates them
|
|
32
49
|
2. **No domain guard** — a compromised agent can send your Slack token to `evil.com`
|
|
@@ -35,48 +52,15 @@ AI agents (Claude, GPT, Cursor, custom bots) increasingly need to call APIs —
|
|
|
35
52
|
|
|
36
53
|
Aegis solves all four. Your agent makes HTTP calls through a local proxy. Aegis handles authentication, enforces domain restrictions, and logs everything.
|
|
37
54
|
|
|
38
|
-
## Prerequisites
|
|
39
|
-
|
|
40
|
-
- **Node.js ≥ 20** — check with `node -v`
|
|
41
|
-
|
|
42
55
|
## Quick Start
|
|
43
56
|
|
|
44
57
|
```bash
|
|
45
|
-
# Install
|
|
58
|
+
# Install
|
|
46
59
|
npm install -g @getaegis/cli
|
|
47
60
|
|
|
48
|
-
# Initialize
|
|
61
|
+
# Initialize (stores master key in OS keychain by default)
|
|
49
62
|
aegis init
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
By default, `aegis init` stores the master key in your OS keychain (macOS Keychain, Windows Credential Manager, or Linux Secret Service). If no keychain is available, it falls back to a file at `.aegis/.master-key` (mode 0600).
|
|
53
|
-
|
|
54
|
-
Alternative storage modes:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
# Store in .env file (for CI/headless environments)
|
|
58
|
-
aegis init --env-file
|
|
59
63
|
|
|
60
|
-
# Store in aegis.config.yaml (convenient for local dev, not recommended for production)
|
|
61
|
-
aegis init --write-secrets
|
|
62
|
-
|
|
63
|
-
# Check where your master key is stored
|
|
64
|
-
aegis key where
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
**Master key resolution order** (highest priority wins):
|
|
68
|
-
|
|
69
|
-
| Priority | Source | Set by |
|
|
70
|
-
|----------|--------|--------|
|
|
71
|
-
| 1 | `AEGIS_MASTER_KEY` environment variable | `export` in shell |
|
|
72
|
-
| 2 | `.env` file | `aegis init --env-file` |
|
|
73
|
-
| 3 | `aegis.config.yaml` (`vault.master_key`) | `aegis init --write-secrets` |
|
|
74
|
-
| 4 | OS keychain (macOS/Windows/Linux) | `aegis init` (default) |
|
|
75
|
-
| 5 | File fallback (`.aegis/.master-key`) | Auto when no keychain available |
|
|
76
|
-
|
|
77
|
-
Run `aegis key where` to see which source is active.
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
64
|
# Add a credential
|
|
81
65
|
aegis vault add \
|
|
82
66
|
--name slack-bot \
|
|
@@ -85,530 +69,165 @@ aegis vault add \
|
|
|
85
69
|
--domains api.slack.com
|
|
86
70
|
|
|
87
71
|
# Start the proxy
|
|
88
|
-
aegis gate
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Your agent now calls `http://localhost:3100/slack/api/chat.postMessage` — Aegis injects the Bearer token and forwards to `https://api.slack.com`. The agent never sees the token. The request is logged.
|
|
72
|
+
aegis gate --no-agent-auth
|
|
92
73
|
|
|
93
|
-
|
|
94
|
-
# Verify it works
|
|
74
|
+
# Test it — Aegis injects the token, forwards to Slack, logs the request
|
|
95
75
|
curl http://localhost:3100/slack/api/auth.test \
|
|
96
76
|
-H "X-Target-Host: api.slack.com"
|
|
97
77
|
```
|
|
98
78
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
| Feature | Description |
|
|
102
|
-
|---------|-------------|
|
|
103
|
-
| **Encrypted Vault** | AES-256-GCM encrypted credential storage with PBKDF2 key derivation |
|
|
104
|
-
| **HTTP Proxy (Gate)** | Transparent credential injection — agent hits `localhost:3100/{service}/path` |
|
|
105
|
-
| **Domain Guard** | Every outbound request checked against credential allowlists. No bypass. |
|
|
106
|
-
| **Audit Ledger** | Every request (allowed and blocked) logged to SQLite with full context |
|
|
107
|
-
| **Agent Identity** | Per-agent tokens, credential scoping, and rate limits |
|
|
108
|
-
| **Policy Engine** | Declarative YAML policies — method, path, rate-limit, time-of-day restrictions |
|
|
109
|
-
| **Body Inspector** | Outbound request bodies scanned for credential-like patterns |
|
|
110
|
-
| **MCP Server** | Native Model Context Protocol integration for Claude, Cursor, VS Code |
|
|
111
|
-
| **Web Dashboard** | Real-time monitoring UI with WebSocket live feed |
|
|
112
|
-
| **Prometheus Metrics** | `/_aegis/metrics` endpoint for Grafana dashboards |
|
|
113
|
-
| **Webhook Alerts** | HMAC-signed notifications for blocked requests, expiring credentials |
|
|
114
|
-
| **RBAC** | Admin, operator, viewer roles with 16 granular permissions |
|
|
115
|
-
| **Multi-Vault** | Separate vaults for dev/staging/prod with isolated encryption keys |
|
|
116
|
-
| **Shamir's Secret Sharing** | M-of-N key splitting for team master key management |
|
|
117
|
-
| **Cross-Platform Key Storage** | OS keychain by default (macOS Keychain, Windows Credential Manager, Linux Secret Service) with file fallback |
|
|
118
|
-
| **TLS Support** | Optional HTTPS on Gate with cert/key configuration |
|
|
119
|
-
| **Configuration File** | `aegis.config.yaml` with env var overrides and CLI flag overrides |
|
|
120
|
-
|
|
121
|
-
## MCP Integration
|
|
122
|
-
|
|
123
|
-
Aegis is a first-class [MCP](https://modelcontextprotocol.io) server. Any MCP-compatible AI agent (Claude Desktop, Cursor, VS Code Copilot) can use Aegis natively — no HTTP calls needed.
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
# Generate config for your AI host
|
|
127
|
-
aegis mcp config claude # Claude Desktop
|
|
128
|
-
aegis mcp config cursor # Cursor
|
|
129
|
-
aegis mcp config vscode # VS Code
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Copy the printed JSON into your AI host's MCP config file. The MCP server exposes three tools:
|
|
133
|
-
|
|
134
|
-
| Tool | Description |
|
|
135
|
-
|------|-------------|
|
|
136
|
-
| `aegis_proxy_request` | Make an authenticated API call (provide service + path, Aegis injects credentials) |
|
|
137
|
-
| `aegis_list_services` | List available services (names only, never secrets) |
|
|
138
|
-
| `aegis_health` | Check Aegis status |
|
|
139
|
-
|
|
140
|
-
The MCP server replicates the full Gate security pipeline: domain guard, agent auth, body inspection, rate limiting, audit logging.
|
|
141
|
-
|
|
142
|
-
## Agent Identity & Scoping
|
|
143
|
-
|
|
144
|
-
Agent authentication is **on by default**. Every request through Gate must include a valid `X-Aegis-Agent` header. Requests without a token get a helpful 401 error with instructions to create an agent.
|
|
79
|
+
### Production Setup (with agent auth)
|
|
145
80
|
|
|
146
81
|
```bash
|
|
147
|
-
#
|
|
148
|
-
aegis agent add --name "
|
|
149
|
-
|
|
150
|
-
# Grant access to specific credentials only
|
|
151
|
-
aegis agent grant --agent "research-bot" --credential "slack-bot"
|
|
82
|
+
# Create an agent identity
|
|
83
|
+
aegis agent add --name "my-agent"
|
|
84
|
+
# Save the printed token — it's shown once only
|
|
152
85
|
|
|
153
|
-
#
|
|
154
|
-
aegis agent
|
|
86
|
+
# Grant it access to specific credentials
|
|
87
|
+
aegis agent grant --agent "my-agent" --credential "slack-bot"
|
|
155
88
|
|
|
156
89
|
# Start Gate (agent auth is on by default)
|
|
157
90
|
aegis gate
|
|
158
91
|
|
|
159
|
-
# Agent must include its token
|
|
92
|
+
# Agent must include its token
|
|
160
93
|
curl http://localhost:3100/slack/api/auth.test \
|
|
161
94
|
-H "X-Target-Host: api.slack.com" \
|
|
162
95
|
-H "X-Aegis-Agent: aegis_a1b2c3d4..."
|
|
163
|
-
|
|
164
|
-
# To disable agent auth (not recommended):
|
|
165
|
-
aegis gate --no-agent-auth
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
Tokens are SHA-256 hashed for storage — they cannot be recovered, only regenerated:
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
aegis agent regenerate --name "research-bot"
|
|
172
|
-
# Old token stops working immediately. New token printed once.
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Policy Engine
|
|
176
|
-
|
|
177
|
-
Declarative YAML policies control what each agent can do:
|
|
178
|
-
|
|
179
|
-
```yaml
|
|
180
|
-
# policies/research-bot.yaml
|
|
181
|
-
agent: research-bot
|
|
182
|
-
rules:
|
|
183
|
-
- service: slack
|
|
184
|
-
methods: [GET]
|
|
185
|
-
paths:
|
|
186
|
-
- /api/conversations.*
|
|
187
|
-
- /api/users.*
|
|
188
|
-
rate_limit: 100/hour
|
|
189
|
-
time_window:
|
|
190
|
-
start: "09:00"
|
|
191
|
-
end: "18:00"
|
|
192
|
-
timezone: "UTC"
|
|
193
|
-
- service: github
|
|
194
|
-
methods: [GET, POST]
|
|
195
|
-
paths:
|
|
196
|
-
- /repos/myorg/.*
|
|
197
|
-
rate_limit: 200/hour
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# Validate policies without starting Gate
|
|
202
|
-
aegis policy validate --policies-dir ./policies
|
|
203
|
-
|
|
204
|
-
# Dry-run: see what would be allowed/blocked without enforcing
|
|
205
|
-
aegis gate --policies-dir ./policies --policy-mode dry-run
|
|
206
|
-
|
|
207
|
-
# Enforce policies
|
|
208
|
-
aegis gate --policies-dir ./policies --policy-mode enforce
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
## Credential Options
|
|
212
|
-
|
|
213
|
-
When adding a credential, you can configure TTL, scopes, rate limits, and body inspection:
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
aegis vault add \
|
|
217
|
-
--name github-bot \
|
|
218
|
-
--service github \
|
|
219
|
-
--secret "ghp_xxxxxxxxxxxxxxxxxxxx" \
|
|
220
|
-
--domains api.github.com \
|
|
221
|
-
--auth-type bearer \
|
|
222
|
-
--scopes read,write \
|
|
223
|
-
--ttl 90 \
|
|
224
|
-
--rate-limit 100/min \
|
|
225
|
-
--body-inspection block
|
|
226
96
|
```
|
|
227
97
|
|
|
228
|
-
|
|
229
|
-
|------|---------|-------------|
|
|
230
|
-
| `--auth-type` | `bearer` | How Aegis injects the credential (see Auth Types below) |
|
|
231
|
-
| `--scopes` | `*` | Comma-separated: `read` (GET/HEAD/OPTIONS), `write` (POST/PUT/PATCH/DELETE), `*` (all) |
|
|
232
|
-
| `--ttl <days>` | *(none)* | Credential expires after this many days |
|
|
233
|
-
| `--rate-limit` | *(none)* | Rate limit: `100/min`, `1000/hour`, `10/sec` |
|
|
234
|
-
| `--body-inspection` | `block` | Scan outbound bodies for credential patterns: `off`, `warn`, `block` |
|
|
235
|
-
| `--header-name` | — | Custom header name (for `--auth-type header`) |
|
|
236
|
-
| `--query-param` | `key` | Query parameter name (for `--auth-type query`) |
|
|
237
|
-
|
|
238
|
-
Update any field later:
|
|
239
|
-
|
|
240
|
-
```bash
|
|
241
|
-
aegis vault update --name github-bot --rate-limit 200/min --body-inspection warn
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
## Auth Types
|
|
245
|
-
|
|
246
|
-
Aegis supports four credential injection methods:
|
|
247
|
-
|
|
248
|
-
| Type | Flag | What Aegis Injects |
|
|
249
|
-
|------|------|--------------------|
|
|
250
|
-
| `bearer` | `--auth-type bearer` (default) | `Authorization: Bearer <secret>` |
|
|
251
|
-
| `header` | `--auth-type header --header-name X-API-Key` | `X-API-Key: <secret>` |
|
|
252
|
-
| `basic` | `--auth-type basic` | `Authorization: Basic <base64(secret)>` |
|
|
253
|
-
| `query` | `--auth-type query --query-param api_key` | Appends `?api_key=<secret>` to the URL |
|
|
254
|
-
|
|
255
|
-
## Configuration
|
|
256
|
-
|
|
257
|
-
Aegis uses a layered configuration model: **CLI flags** > **environment variables** > **config file** > **built-in defaults**.
|
|
258
|
-
|
|
259
|
-
```yaml
|
|
260
|
-
# aegis.config.yaml
|
|
261
|
-
gate:
|
|
262
|
-
port: 3100
|
|
263
|
-
tls:
|
|
264
|
-
cert: ./certs/aegis.crt
|
|
265
|
-
key: ./certs/aegis.key
|
|
266
|
-
require_agent_auth: true
|
|
267
|
-
policy_mode: enforce
|
|
268
|
-
policies_dir: ./policies
|
|
269
|
-
|
|
270
|
-
vault:
|
|
271
|
-
name: default
|
|
272
|
-
data_dir: ./.aegis
|
|
273
|
-
|
|
274
|
-
observability:
|
|
275
|
-
log_level: info
|
|
276
|
-
log_format: json
|
|
277
|
-
metrics: true
|
|
278
|
-
dashboard:
|
|
279
|
-
enabled: true
|
|
280
|
-
port: 3200
|
|
281
|
-
|
|
282
|
-
mcp:
|
|
283
|
-
transport: stdio
|
|
284
|
-
port: 3300
|
|
285
|
-
|
|
286
|
-
webhooks:
|
|
287
|
-
- url: https://your-webhook-endpoint.com/aegis
|
|
288
|
-
events: [blocked_request, credential_expiry]
|
|
289
|
-
secret: your-hmac-secret
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
```bash
|
|
293
|
-
# Validate your config file
|
|
294
|
-
aegis config validate
|
|
295
|
-
|
|
296
|
-
# Show resolved config (with all overrides applied)
|
|
297
|
-
aegis config show
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### Environment Variables
|
|
301
|
-
|
|
302
|
-
All environment variables override config file settings. CLI flags override both.
|
|
303
|
-
|
|
304
|
-
| Variable | Default | Description |
|
|
305
|
-
|----------|---------|-------------|
|
|
306
|
-
| `AEGIS_MASTER_KEY` | *(none)* | Master encryption key (from `aegis init`) |
|
|
307
|
-
| `AEGIS_SALT` | *(none)* | Vault encryption salt (auto-generated, stored in `.aegis/vaults.json`) |
|
|
308
|
-
| `AEGIS_VAULT` | `default` | Active vault name |
|
|
309
|
-
| `AEGIS_PORT` | `3100` | Gate proxy listen port |
|
|
310
|
-
| `AEGIS_DATA_DIR` | `./.aegis` | Directory for vault databases and registry |
|
|
311
|
-
| `AEGIS_LOG_LEVEL` | `info` | Log verbosity: `debug`, `info`, `warn`, `error` |
|
|
312
|
-
| `AEGIS_LOG_FORMAT` | `json` | Log output format: `json` or `pretty` |
|
|
313
|
-
| `AEGIS_REQUIRE_AGENT_AUTH` | `true` | Require `X-Aegis-Agent` header on every request (`true`/`false`) |
|
|
314
|
-
| `AEGIS_POLICY_MODE` | `enforce` | Policy enforcement: `enforce`, `dry-run`, or `off` |
|
|
315
|
-
| `AEGIS_POLICIES_DIR` | *(none)* | Directory containing YAML policy files |
|
|
316
|
-
| `AEGIS_METRICS` | `true` | Enable Prometheus metrics endpoint (`true`/`false`) |
|
|
317
|
-
| `AEGIS_USER_TOKEN` | *(none)* | RBAC user token for CLI authentication |
|
|
318
|
-
|
|
319
|
-
## Webhooks
|
|
320
|
-
|
|
321
|
-
Get real-time notifications when security events occur:
|
|
322
|
-
|
|
323
|
-
```bash
|
|
324
|
-
# Add a webhook for blocked requests and expiring credentials
|
|
325
|
-
aegis webhook add \
|
|
326
|
-
--url https://your-endpoint.com/aegis \
|
|
327
|
-
--events blocked_request,credential_expiry \
|
|
328
|
-
--secret your-hmac-signing-secret
|
|
329
|
-
|
|
330
|
-
# Test delivery
|
|
331
|
-
aegis webhook test --id <webhook-id>
|
|
332
|
-
|
|
333
|
-
# Check for credentials expiring within 7 days
|
|
334
|
-
aegis webhook check-expiry
|
|
335
|
-
|
|
336
|
-
# Manage
|
|
337
|
-
aegis webhook list
|
|
338
|
-
aegis webhook remove --id <webhook-id>
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
Webhook payloads are signed with HMAC-SHA256. Verify the `X-Aegis-Signature` header to authenticate delivery. Five event types: `blocked_request`, `credential_expiry`, `rate_limit_exceeded`, `agent_auth_failure`, `body_inspection`.
|
|
98
|
+
## MCP Integration
|
|
342
99
|
|
|
343
|
-
|
|
100
|
+
Aegis is a first-class [MCP](https://modelcontextprotocol.io) server. Any MCP-compatible AI agent can use it natively — no HTTP calls needed.
|
|
344
101
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
102
|
+
**Before (plaintext key in config):**
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"mcpServers": {
|
|
106
|
+
"slack": {
|
|
107
|
+
"command": "node",
|
|
108
|
+
"args": ["slack-mcp-server"],
|
|
109
|
+
"env": { "SLACK_TOKEN": "xoxb-1234-real-token-here" }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
350
113
|
```
|
|
351
114
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
```bash
|
|
363
|
-
# Create the first admin user (no auth required — bootstrap mode)
|
|
364
|
-
aegis user add --name admin --role admin
|
|
365
|
-
|
|
366
|
-
# ✓ User added to Aegis
|
|
367
|
-
# Name: admin
|
|
368
|
-
# Role: admin
|
|
369
|
-
# API Key (shown ONCE — save it now):
|
|
370
|
-
# aegis_user_xxxxxxxx-xxxx_xxxxxxxxxxxxxxxx
|
|
371
|
-
#
|
|
372
|
-
# Use AEGIS_USER_TOKEN=<key> to authenticate CLI commands.
|
|
115
|
+
**After (Aegis — no key visible):**
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"mcpServers": {
|
|
119
|
+
"aegis": {
|
|
120
|
+
"command": "npx",
|
|
121
|
+
"args": ["-y", "@getaegis/cli", "mcp", "serve"]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
373
125
|
```
|
|
374
126
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
### Authenticating
|
|
378
|
-
|
|
379
|
-
Set `AEGIS_USER_TOKEN` in your environment:
|
|
127
|
+
Generate the config for your AI host:
|
|
380
128
|
|
|
381
129
|
```bash
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
aegis vault list
|
|
386
|
-
aegis agent list
|
|
387
|
-
aegis ledger show
|
|
130
|
+
aegis mcp config claude # Claude Desktop
|
|
131
|
+
aegis mcp config cursor # Cursor
|
|
132
|
+
aegis mcp config vscode # VS Code
|
|
388
133
|
```
|
|
389
134
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
| Permission | Admin | Operator | Viewer |
|
|
393
|
-
|------------|:-----:|:--------:|:------:|
|
|
394
|
-
| `vault:read` — list credentials | ✓ | ✓ | ✓ |
|
|
395
|
-
| `vault:write` — add/remove/rotate credentials | ✓ | | |
|
|
396
|
-
| `vault:manage` — create/destroy vaults | ✓ | | |
|
|
397
|
-
| `agent:read` — list agents | ✓ | ✓ | |
|
|
398
|
-
| `agent:write` — add/remove/grant agents | ✓ | ✓ | |
|
|
399
|
-
| `ledger:read` — view audit logs | ✓ | ✓ | ✓ |
|
|
400
|
-
| `ledger:export` — export audit logs | ✓ | ✓ | |
|
|
401
|
-
| `gate:start` — start the proxy | ✓ | ✓ | |
|
|
402
|
-
| `policy:read` — view policies | ✓ | ✓ | |
|
|
403
|
-
| `policy:write` — manage policies | ✓ | | |
|
|
404
|
-
| `webhook:read` — list webhooks | ✓ | ✓ | |
|
|
405
|
-
| `webhook:write` — add/remove webhooks | ✓ | | |
|
|
406
|
-
| `user:read` — list users | ✓ | | |
|
|
407
|
-
| `user:write` — add/remove users | ✓ | | |
|
|
408
|
-
| `dashboard:view` — access the dashboard | ✓ | ✓ | ✓ |
|
|
409
|
-
| `doctor:run` — run health checks | ✓ | ✓ | ✓ |
|
|
410
|
-
|
|
411
|
-
### Managing Users
|
|
412
|
-
|
|
413
|
-
```bash
|
|
414
|
-
# Add more users (requires admin role)
|
|
415
|
-
aegis user add --name alice --role operator
|
|
416
|
-
aegis user add --name bob --role viewer
|
|
417
|
-
|
|
418
|
-
# Change a user's role
|
|
419
|
-
aegis user role --name alice --role admin
|
|
420
|
-
|
|
421
|
-
# Regenerate a lost token (invalidates the old one immediately)
|
|
422
|
-
aegis user regenerate-token --name alice
|
|
423
|
-
|
|
424
|
-
# Remove a user
|
|
425
|
-
aegis user remove --name bob --confirm
|
|
135
|
+
The MCP server exposes three tools:
|
|
426
136
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
137
|
+
| Tool | Description |
|
|
138
|
+
|------|-------------|
|
|
139
|
+
| `aegis_proxy_request` | Make an authenticated API call (provide service + path, Aegis injects credentials) |
|
|
140
|
+
| `aegis_list_services` | List available services (names only, never secrets) |
|
|
141
|
+
| `aegis_health` | Check Aegis status |
|
|
430
142
|
|
|
431
|
-
|
|
143
|
+
The MCP server replicates the full Gate security pipeline: domain guard, agent auth, body inspection, rate limiting, audit logging.
|
|
432
144
|
|
|
433
|
-
|
|
145
|
+
### Setup Guides
|
|
434
146
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
147
|
+
- [Claude Desktop](docs/guides/claude-desktop.md)
|
|
148
|
+
- [Cursor](docs/guides/cursor.md)
|
|
149
|
+
- [VS Code](docs/guides/vscode.md)
|
|
150
|
+
- [Windsurf](docs/guides/windsurf.md)
|
|
151
|
+
- [Cline](docs/guides/cline.md)
|
|
438
152
|
|
|
439
|
-
|
|
440
|
-
AEGIS_VAULT=staging aegis vault add --name slack --service slack ...
|
|
153
|
+
## Features
|
|
441
154
|
|
|
442
|
-
|
|
443
|
-
|
|
155
|
+
| Feature | Description |
|
|
156
|
+
|---------|-------------|
|
|
157
|
+
| **Encrypted Vault** | AES-256-GCM encrypted credential storage with PBKDF2 key derivation |
|
|
158
|
+
| **HTTP Proxy (Gate)** | Transparent credential injection — agent hits `localhost:3100/{service}/path` |
|
|
159
|
+
| **Domain Guard** | Every outbound request checked against credential allowlists. No bypass |
|
|
160
|
+
| **Audit Ledger** | Every request (allowed and blocked) logged with full context |
|
|
161
|
+
| **Agent Identity** | Per-agent tokens, credential scoping, and rate limits |
|
|
162
|
+
| **Policy Engine** | Declarative YAML policies — method, path, rate-limit, time-of-day restrictions |
|
|
163
|
+
| **Body Inspector** | Outbound request bodies scanned for credential-like patterns |
|
|
164
|
+
| **MCP Server** | Native Model Context Protocol for Claude, Cursor, VS Code, Windsurf, Cline |
|
|
165
|
+
| **Web Dashboard** | Real-time monitoring UI with WebSocket live feed |
|
|
166
|
+
| **Prometheus Metrics** | `/_aegis/metrics` endpoint for Grafana dashboards |
|
|
167
|
+
| **Webhook Alerts** | HMAC-signed notifications for blocked requests, expiring credentials |
|
|
168
|
+
| **RBAC** | Admin, operator, viewer roles with 16 granular permissions |
|
|
169
|
+
| **Multi-Vault** | Separate vaults for dev/staging/prod with isolated encryption keys |
|
|
170
|
+
| **Shamir's Secret Sharing** | M-of-N key splitting for team master key management |
|
|
171
|
+
| **Cross-Platform Key Storage** | OS keychain by default (macOS, Windows, Linux) with file fallback |
|
|
172
|
+
| **TLS Support** | Optional HTTPS on Gate with cert/key configuration |
|
|
173
|
+
| **Configuration File** | `aegis.config.yaml` with env var overrides and CLI flag overrides |
|
|
444
174
|
|
|
445
|
-
|
|
446
|
-
aegis vault destroy --name staging
|
|
447
|
-
```
|
|
175
|
+
## Example Integrations
|
|
448
176
|
|
|
449
|
-
|
|
177
|
+
Step-by-step guides with config files and policies included:
|
|
450
178
|
|
|
451
|
-
|
|
179
|
+
- [**Slack Bot**](examples/slack-bot/) — Protect your Slack bot token with domain-restricted proxy access
|
|
180
|
+
- [**GitHub Integration**](examples/github-integration/) — Secure GitHub PAT with per-agent grants and read-only policies
|
|
181
|
+
- [**Stripe Backend**](examples/stripe-backend/) — Isolate Stripe API keys with body inspection and rate limiting
|
|
452
182
|
|
|
453
|
-
|
|
183
|
+
## Security
|
|
454
184
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
185
|
+
- Published [STRIDE threat model](docs/THREAT_MODEL.md) — 28 threats analysed, 0 critical/high unmitigated findings
|
|
186
|
+
- Full [security architecture](docs/SECURITY_ARCHITECTURE.md) documentation (trust boundaries, crypto pipeline, data flow)
|
|
187
|
+
- AES-256-GCM + ChaCha20-Poly1305 encryption at rest
|
|
188
|
+
- Domain guard enforced on every request — no bypass
|
|
189
|
+
- Agent tokens stored as SHA-256 hashes — cannot be recovered, only regenerated
|
|
190
|
+
- Request body inspection for credential pattern detection
|
|
191
|
+
- Open source (Apache 2.0) — read the code
|
|
458
192
|
|
|
459
|
-
|
|
460
|
-
aegis vault seal
|
|
193
|
+
## How Aegis Compares
|
|
461
194
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
195
|
+
| | `.env` files | Vault/Doppler | Infisical | **Aegis** |
|
|
196
|
+
|---|---|---|---|---|
|
|
197
|
+
| Agent sees raw key | Yes | Yes (after fetch) | Yes (after fetch) | **No — never** |
|
|
198
|
+
| Domain restrictions | No | No | No | **Yes** |
|
|
199
|
+
| MCP-native | No | No | Adding | **Yes** |
|
|
200
|
+
| Local-first | Yes | No | No | **Yes** |
|
|
201
|
+
| Setup | 10 sec | 30+ min | 15+ min | **~2 min** |
|
|
468
202
|
|
|
469
|
-
|
|
203
|
+
See [full comparison](docs/COMPARISON.md) for detailed breakdowns against each approach.
|
|
470
204
|
|
|
471
|
-
|
|
205
|
+
## Documentation
|
|
472
206
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
aegis ledger show --since 2026-03-01
|
|
483
|
-
|
|
484
|
-
# Request statistics
|
|
485
|
-
aegis ledger stats
|
|
486
|
-
aegis ledger stats --agent research-bot
|
|
487
|
-
aegis ledger stats --since 2026-03-01
|
|
488
|
-
|
|
489
|
-
# Export (CSV, JSON, or JSON Lines)
|
|
490
|
-
aegis ledger export -f csv
|
|
491
|
-
aegis ledger export -f json -o audit.json
|
|
492
|
-
aegis ledger export -f jsonl --service slack --since 2026-03-01
|
|
493
|
-
```
|
|
207
|
+
| Document | Description |
|
|
208
|
+
|----------|-------------|
|
|
209
|
+
| [Usage Guide](docs/USAGE.md) | Full reference: CLI commands, configuration, RBAC, policies, webhooks, troubleshooting |
|
|
210
|
+
| [Security Architecture](docs/SECURITY_ARCHITECTURE.md) | Trust boundaries, crypto pipeline, data flow diagrams |
|
|
211
|
+
| [Threat Model](docs/THREAT_MODEL.md) | STRIDE analysis — 28 threats, mitigations, residual risks |
|
|
212
|
+
| [Comparison](docs/COMPARISON.md) | Detailed comparison with .env, Vault, Doppler, Infisical |
|
|
213
|
+
| [FAQ](docs/FAQ.md) | Common questions and objections |
|
|
214
|
+
| [Roadmap](docs/ROADMAP.md) | Feature roadmap from v0.1 to v1.0 |
|
|
215
|
+
| [Contributing](CONTRIBUTING.md) | Code style, PR process, architecture overview |
|
|
494
216
|
|
|
495
|
-
##
|
|
217
|
+
## Install
|
|
496
218
|
|
|
497
219
|
```bash
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
Runs diagnostics on your Aegis installation:
|
|
502
|
-
- Config file validation
|
|
503
|
-
- Database accessibility and schema
|
|
504
|
-
- Master key correctness (test decrypt)
|
|
505
|
-
- Key storage backend (keychain type and status)
|
|
506
|
-
- Expired or expiring-soon credentials
|
|
507
|
-
|
|
508
|
-
Returns pass/warn/fail for each check.
|
|
509
|
-
|
|
510
|
-
## Security Model
|
|
511
|
-
|
|
512
|
-
- **Encryption at rest** — AES-256-GCM with PBKDF2 key derivation (210,000 iterations, SHA-512, random per-deployment salt)
|
|
513
|
-
- **Cross-platform key storage** — master key stored in OS keychain by default (macOS Keychain, Windows Credential Manager, Linux Secret Service). File fallback for CI/headless
|
|
514
|
-
- **Domain guard** — enforced on every outbound request. No bypass, no override. Wildcards supported (`*.slack.com`)
|
|
515
|
-
- **Credential scopes** — `read` (GET/HEAD/OPTIONS), `write` (POST/PUT/PATCH/DELETE), `*` (all). Enforced at the Gate before any request is forwarded
|
|
516
|
-
- **Header stripping** — agent-supplied `Authorization`, `X-API-Key`, `Proxy-Authorization` headers are removed before injection
|
|
517
|
-
- **Body inspection** — outbound request bodies scanned for credential-like patterns (configurable per credential: `off`, `warn`, `block`)
|
|
518
|
-
- **Hash-only token storage** — agent tokens stored as SHA-256 hashes. Lost tokens are regenerated, never recovered
|
|
519
|
-
- **Audit logging** — every request (allowed and blocked) recorded with full context. Export with `aegis ledger export -f csv`
|
|
520
|
-
- **TLS support** — optional HTTPS on Gate (`aegis gate --tls --cert <path> --key <path>`)
|
|
521
|
-
- **Graceful shutdown** — drains in-flight requests on SIGINT/SIGTERM
|
|
522
|
-
|
|
523
|
-
See [SECURITY_ARCHITECTURE.md](docs/SECURITY_ARCHITECTURE.md) for the full security design and trust boundaries, and [THREAT_MODEL.md](docs/THREAT_MODEL.md) for the STRIDE threat analysis.
|
|
220
|
+
# npm
|
|
221
|
+
npm install -g @getaegis/cli
|
|
524
222
|
|
|
525
|
-
|
|
223
|
+
# Homebrew
|
|
224
|
+
brew tap getaegis/aegis && brew install aegis
|
|
526
225
|
|
|
527
|
-
|
|
528
|
-
aegis
|
|
529
|
-
aegis gate [--port] [--tls] [--no-agent-auth] [--policies-dir] [--policy-mode]
|
|
530
|
-
Start the HTTP proxy
|
|
531
|
-
aegis dashboard [--port] [--gate-port] Start the web dashboard + Gate
|
|
532
|
-
|
|
533
|
-
aegis vault add [--name] [--service] [--secret] [--domains] [--auth-type]
|
|
534
|
-
[--header-name] [--scopes] [--ttl] [--rate-limit] [--body-inspection]
|
|
535
|
-
Add a credential
|
|
536
|
-
aegis vault list List credentials (secrets never shown)
|
|
537
|
-
aegis vault remove --name <name> Remove a credential
|
|
538
|
-
aegis vault rotate --name <name> --secret <new>
|
|
539
|
-
Rotate a credential's secret
|
|
540
|
-
aegis vault update --name <name> [--domains] [--auth-type] [--header-name]
|
|
541
|
-
[--scopes] [--rate-limit] [--body-inspection]
|
|
542
|
-
Update credential metadata
|
|
543
|
-
aegis vault create --name <name> Create a new named vault
|
|
544
|
-
aegis vault vaults List all vaults
|
|
545
|
-
aegis vault destroy --name <name> Delete a vault and its credentials
|
|
546
|
-
aegis vault split [--shares] [--threshold]
|
|
547
|
-
Split master key (Shamir)
|
|
548
|
-
aegis vault seal Seal the vault
|
|
549
|
-
aegis vault unseal --key-share <share>... Unseal (provide threshold shares)
|
|
550
|
-
|
|
551
|
-
aegis agent add --name <name> Register agent, print token (one-time)
|
|
552
|
-
aegis agent list List agents (no tokens shown)
|
|
553
|
-
aegis agent remove --name <name> Remove agent + cascade-delete grants
|
|
554
|
-
aegis agent regenerate --name <name> Regenerate token (old one invalidated)
|
|
555
|
-
aegis agent grant --agent <a> --credential <c>
|
|
556
|
-
Grant credential access
|
|
557
|
-
aegis agent revoke --agent <a> --credential <c>
|
|
558
|
-
Revoke credential access
|
|
559
|
-
aegis agent set-rate-limit --agent <a> --limit <rate>
|
|
560
|
-
Set per-agent rate limit
|
|
561
|
-
|
|
562
|
-
aegis policy validate [--policies-dir] Validate policy files
|
|
563
|
-
aegis policy test --agent <a> --service <s> --method <m> --path <p>
|
|
564
|
-
Test a request against policies
|
|
565
|
-
aegis policy list [--policies-dir] List loaded policies
|
|
566
|
-
|
|
567
|
-
aegis ledger show [--service] [--agent] [--blocked] [--system] [--since] [--limit]
|
|
568
|
-
View audit logs
|
|
569
|
-
aegis ledger stats [--agent] [--since] Request statistics
|
|
570
|
-
aegis ledger export -f <csv|json|jsonl> [-o file] [--service] [--since]
|
|
571
|
-
Export audit log
|
|
572
|
-
|
|
573
|
-
aegis webhook add --url <url> --events <types>
|
|
574
|
-
Add a webhook endpoint
|
|
575
|
-
aegis webhook list List webhooks
|
|
576
|
-
aegis webhook remove --id <id> Remove a webhook
|
|
577
|
-
aegis webhook test --id <id> Send a test payload
|
|
578
|
-
aegis webhook check-expiry Check for expiring credentials
|
|
579
|
-
|
|
580
|
-
aegis user add --name <name> --role <role>
|
|
581
|
-
Add RBAC user (admin/operator/viewer)
|
|
582
|
-
aegis user list List users
|
|
583
|
-
aegis user remove --name <name> Remove user
|
|
584
|
-
aegis user role --name <name> --role <role>
|
|
585
|
-
Change user role
|
|
586
|
-
aegis user regenerate-token --name <name> Regenerate user token
|
|
587
|
-
|
|
588
|
-
aegis mcp serve [--transport] [--port] Start the MCP server
|
|
589
|
-
aegis mcp config <claude|cursor|vscode> Generate MCP host config
|
|
590
|
-
|
|
591
|
-
aegis db backup [--output <path>] Backup the vault database
|
|
592
|
-
aegis db restore --input <path> [--force] Restore from a backup
|
|
593
|
-
|
|
594
|
-
aegis config validate Validate config file
|
|
595
|
-
aegis config show Show resolved configuration
|
|
596
|
-
aegis key where Show where the master key is stored
|
|
597
|
-
aegis doctor Health check diagnostics
|
|
226
|
+
# Docker
|
|
227
|
+
docker run ghcr.io/getaegis/aegis --help
|
|
598
228
|
```
|
|
599
229
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
| Error | Cause | Fix |
|
|
603
|
-
|-------|-------|-----|
|
|
604
|
-
| `AEGIS_MASTER_KEY is not set` | No master key in config, env, or keychain | Run `aegis key where` to check storage, or `export AEGIS_MASTER_KEY=<key>` |
|
|
605
|
-
| `Invalid master key` | Wrong key for this vault | Check `AEGIS_MASTER_KEY` matches the key from `aegis init` |
|
|
606
|
-
| `Port 3100 is already in use` | Another process on that port | Use `aegis gate --port 3200` or stop the other process |
|
|
607
|
-
| `Database file is corrupted` | SQLite file damaged | Back up `.aegis/` and re-run `aegis init` |
|
|
608
|
-
| `Domain guard: blocked` | Target domain not in credential allowlist | Update domains: `aegis vault update --name <n> --domains <d>` |
|
|
609
|
-
| `Body inspection: blocked` | Request body contains credential-like patterns | Remove sensitive patterns from the body, or set `--body-inspection warn` on the credential |
|
|
610
|
-
| `Authentication required` | RBAC is active (users exist) but no token set | `export AEGIS_USER_TOKEN=<key>` — get a key from your admin or `aegis user regenerate-token` |
|
|
611
|
-
| `Permission denied` | Your RBAC role lacks the required permission | Ask an admin to upgrade your role with `aegis user role` |
|
|
230
|
+
**Requires Node.js ≥ 20** — check with `node -v`
|
|
612
231
|
|
|
613
232
|
## Development
|
|
614
233
|
|
|
@@ -617,33 +236,11 @@ git clone https://github.com/getaegis/aegis.git
|
|
|
617
236
|
cd aegis
|
|
618
237
|
yarn install
|
|
619
238
|
yarn build
|
|
620
|
-
yarn test
|
|
621
|
-
yarn lint # Biome linter
|
|
622
|
-
yarn verify # Biome check + TypeScript typecheck
|
|
239
|
+
yarn test
|
|
623
240
|
```
|
|
624
241
|
|
|
625
242
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for code style, PR process, and architecture overview.
|
|
626
243
|
|
|
627
|
-
### Tech Stack
|
|
628
|
-
|
|
629
|
-
| Layer | Technology |
|
|
630
|
-
|-------|------------|
|
|
631
|
-
| Language | TypeScript (ES2022, native ESM) |
|
|
632
|
-
| Runtime | Node.js ≥ 20 |
|
|
633
|
-
| Database | SQLite via better-sqlite3-multiple-ciphers (WAL mode, ChaCha20-Poly1305 encryption at rest) |
|
|
634
|
-
| Encryption | AES-256-GCM (field-level), ChaCha20-Poly1305 (full-database), PBKDF2 |
|
|
635
|
-
| Logging | pino (structured JSON, field-level redaction) |
|
|
636
|
-
| Metrics | prom-client (Prometheus) |
|
|
637
|
-
| CLI | Commander.js |
|
|
638
|
-
| MCP | @modelcontextprotocol/sdk |
|
|
639
|
-
| Dashboard | Vite + React 19 + Tailwind CSS v4 |
|
|
640
|
-
| Testing | Vitest |
|
|
641
|
-
| Linting | Biome |
|
|
642
|
-
|
|
643
|
-
## Roadmap
|
|
644
|
-
|
|
645
|
-
See [ROADMAP.md](docs/ROADMAP.md) for the full plan from v0.1 to v1.0.
|
|
646
|
-
|
|
647
244
|
## License
|
|
648
245
|
|
|
649
246
|
[Apache 2.0](LICENSE)
|
package/dist/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM/C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM/C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC,QAAQ,CAsD5D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAIxD;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CA2BnD"}
|
package/dist/db.js
CHANGED
|
@@ -55,6 +55,17 @@ export function getDb(config) {
|
|
|
55
55
|
catch (err) {
|
|
56
56
|
const sqliteErr = err;
|
|
57
57
|
if (sqliteErr.code === 'SQLITE_NOTADB') {
|
|
58
|
+
if (config.masterKey) {
|
|
59
|
+
// Encrypted databases return SQLITE_NOTADB for both wrong-key and genuine
|
|
60
|
+
// corruption — we can't distinguish them, so surface both possibilities.
|
|
61
|
+
throw new Error(`Cannot open database: ${dbPath}\n\n` +
|
|
62
|
+
` Possible causes:\n` +
|
|
63
|
+
` 1. Master key mismatch — the key doesn't match the one used to create this vault.\n` +
|
|
64
|
+
` Run: aegis key where — to check which source is providing the master key.\n` +
|
|
65
|
+
` If .env has AEGIS_MASTER_KEY, it overrides the OS keychain value.\n` +
|
|
66
|
+
` 2. Database corruption — the file may be damaged (disk error, incomplete write).\n` +
|
|
67
|
+
` Back up the file and reinitialize with: aegis init`);
|
|
68
|
+
}
|
|
58
69
|
throw new Error(`Database file is corrupted or not a valid SQLite database: ${dbPath}\n` +
|
|
59
70
|
` Back up the file and reinitialize with: aegis init`);
|
|
60
71
|
}
|
package/dist/db.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB,EAAE,IAAY;IACzD,OAAO,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,IAAI,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;AAChG,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,KAAK,CAAC,MAAmB;IACvC,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,I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A0D;QAC1D,OAAO,EAAE,CAAC;QACV,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+FJ;KACF;IACD,6BAA6B;IAC7B,0CAA0C;CAC3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getaegis/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"mcpName": "io.github.getaegis/aegis",
|
|
5
5
|
"description": "Credential isolation for AI agents. Store, guard, and record — your agent never sees your API keys.",
|
|
6
6
|
"type": "module",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"chalk": "^5.4.1",
|
|
62
62
|
"commander": "^13.1.0",
|
|
63
63
|
"pino": "^10.3.1",
|
|
64
|
+
"pino-pretty": "^13.1.3",
|
|
64
65
|
"prom-client": "^15.1.3",
|
|
65
66
|
"table": "^6.9.0",
|
|
66
67
|
"ws": "^8.19.0",
|
|
@@ -75,7 +76,6 @@
|
|
|
75
76
|
"autocannon": "^8.0.0",
|
|
76
77
|
"husky": "^9.1.7",
|
|
77
78
|
"lint-staged": "^16.2.7",
|
|
78
|
-
"pino-pretty": "^13.1.3",
|
|
79
79
|
"release-it": "^19.2.4",
|
|
80
80
|
"tsx": "^4.19.0",
|
|
81
81
|
"typescript": "^5.7.0",
|