secretless-ai 0.12.3 → 0.12.5

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 CHANGED
@@ -1,128 +1,131 @@
1
- > **[OpenA2A](https://github.com/opena2a-org/opena2a)**: [CLI](https://github.com/opena2a-org/opena2a) · [HackMyAgent](https://github.com/opena2a-org/hackmyagent) · **Secretless AI** · [AIM](https://github.com/opena2a-org/agent-identity-management) · [Browser Guard](https://github.com/opena2a-org/AI-BrowserGuard) · [DVAA](https://github.com/opena2a-org/damn-vulnerable-ai-agent) · Registry (coming soon)
1
+ > **[OpenA2A](https://github.com/opena2a-org/opena2a)**: [CLI](https://github.com/opena2a-org/opena2a) · [HackMyAgent](https://github.com/opena2a-org/hackmyagent) · [Secretless](https://github.com/opena2a-org/secretless-ai) · [AIM](https://github.com/opena2a-org/agent-identity-management) · [Browser Guard](https://github.com/opena2a-org/AI-BrowserGuard) · [DVAA](https://github.com/opena2a-org/damn-vulnerable-ai-agent) · Registry (April 2026)
2
2
 
3
- # Secretless AI
3
+ # secretless-ai
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/secretless-ai.svg)](https://www.npmjs.com/package/secretless-ai)
6
6
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
- [![Tests](https://img.shields.io/badge/tests-791-brightgreen)](https://github.com/opena2a-org/secretless-ai)
7
+ [![Tests](https://img.shields.io/badge/tests-792-brightgreen)](https://github.com/opena2a-org/secretless-ai)
8
8
 
9
- AI coding tools can read `~/.aws/credentials`, `echo $OPENAI_API_KEY`, and access any secret on your machine. Secretless makes secrets invisible to AI context without changing your workflow.
9
+ Keep API keys and secrets invisible to AI coding tools. Works with Claude Code, Cursor, GitHub Copilot, Windsurf, Cline, and Aider.
10
10
 
11
- Works with Claude Code, Cursor, Copilot, Windsurf, Cline, and Aider.
11
+ ## Quick Start
12
12
 
13
- [Website](https://opena2a.org) | [Demos](https://opena2a.org/demos) | [OpenA2A CLI](https://github.com/opena2a-org/opena2a) | [Discord](https://discord.gg/opena2a)
13
+ ```bash
14
+ npx secretless-ai init
15
+ ```
14
16
 
15
- ## Get Started in 30 Seconds
17
+ ```
18
+ Detected: Claude Code, Cursor
19
+ Protected: .env, .aws/credentials, *.key, *.pem (21 file patterns)
20
+ Blocked: 49 credential patterns from AI context
21
+ Done. Secrets are now invisible to AI tools.
22
+ ```
16
23
 
17
- The recommended way to use Secretless AI is through [opena2a-cli](https://github.com/opena2a-org/opena2a) — the unified CLI for all OpenA2A security tools. It runs Secretless under the hood along with security scanning, config integrity, and more.
24
+ For a full security dashboard covering credentials, shadow AI, config integrity, and more:
18
25
 
19
26
  ```bash
20
- # Recommended: full security review via opena2a-cli
21
27
  npx opena2a-cli review
22
-
23
- # Or use Secretless AI directly
24
- npx secretless-ai init
25
28
  ```
26
29
 
27
- That's it. No config files, no setup, no flags needed.
30
+ ## MCP Server Protection
28
31
 
29
- **What happens when you run it?**
30
-
31
- Detects which AI coding tools you use, installs the right protections for each, and blocks secrets from ever entering an AI context window.
32
+ Every MCP server config has plaintext API keys in JSON files on your machine. The LLM sees them. Secretless encrypts them.
32
33
 
34
+ ```bash
35
+ npx secretless-ai protect-mcp
33
36
  ```
34
- ┌──────────────────────────────────────────────────┐
35
- │ Secretless v0.12.3 │
36
- │ Keeping secrets out of AI │
37
- │ │
38
- │ Detected: │
39
- │ + Claude Code │
40
- │ + Cursor │
41
- │ │
42
- │ Configured: │
43
- │ * Claude Code │
44
- │ * Cursor │
45
- │ │
46
- │ Created: │
47
- │ + .claude/hooks/secretless-guard.sh │
48
- │ + CLAUDE.md │
49
- │ │
50
- │ Modified: │
51
- │ ~ .claude/settings.json │
52
- │ ~ .cursorrules │
53
- │ │
54
- │ Done. Secrets are now blocked from AI context. │
55
- └──────────────────────────────────────────────────┘
37
+
56
38
  ```
39
+ Scanned 1 client(s)
57
40
 
58
- ![Secretless AI Demo](docs/secretless-ai-demo.gif)
41
+ + claude-desktop/browserbase
42
+ BROWSERBASE_API_KEY (encrypted)
43
+ + claude-desktop/github
44
+ GITHUB_PERSONAL_ACCESS_TOKEN (encrypted)
45
+ + claude-desktop/stripe
46
+ STRIPE_SECRET_KEY (encrypted)
59
47
 
60
- > See all demos at [opena2a.org/demos](https://opena2a.org/demos)
48
+ 3 secret(s) encrypted across 3 server(s).
49
+ MCP servers start normally -- no workflow changes needed.
50
+ ```
61
51
 
62
- ## Installation
52
+ Scans configs across Claude Desktop, Cursor, Claude Code, VS Code, and Windsurf. Secrets move to your configured backend. Non-secret env vars (URLs, regions) stay untouched.
63
53
 
64
54
  ```bash
65
- # Run without installing (recommended to start)
66
- npx secretless-ai init
55
+ npx secretless-ai protect-mcp --backend 1password # Store MCP secrets in 1Password
56
+ npx secretless-ai mcp-status # Show which servers are protected
57
+ npx secretless-ai mcp-unprotect # Restore original configs from backup
58
+ ```
67
59
 
68
- # Install globally
69
- npm install -g secretless-ai
60
+ ## How It Works
70
61
 
71
- # Add to your project
72
- npm install --save-dev secretless-ai
73
- ```
62
+ 1. **Scans** your project for hardcoded credentials (49 patterns)
63
+ 2. **Migrates** them to secure storage (OS keychain, 1Password, Vault, GCP Secret Manager)
64
+ 3. **Blocks** AI tools from reading credential files (21 file patterns)
65
+ 4. **Brokers** access through environment variables -- secrets never enter AI context
74
66
 
75
- Requirements: Node.js 18+. Zero runtime dependencies.
67
+ ## Use Cases
68
+
69
+ Step-by-step guides for common workflows: [docs/USE-CASES.md](docs/USE-CASES.md)
70
+
71
+ - [Protect My Credentials](docs/use-cases/protect-my-credentials.md) -- Keep API keys out of AI tools (2 min)
72
+ - [Secure MCP Configs](docs/use-cases/secure-mcp-configs.md) -- Encrypt MCP server credentials (3 min)
73
+ - [Team Setup](docs/use-cases/team-setup.md) -- Shared backend, CI/CD, onboarding (5 min)
74
+ - [Migrate from .env](docs/use-cases/migrate-from-dotenv.md) -- Move .env files to encrypted storage (3 min)
75
+
76
+ ## Supported Tools
77
+
78
+ | Tool | Protection Method |
79
+ |------|------------------|
80
+ | Claude Code | PreToolUse hook (blocks reads before they happen) + deny rules + CLAUDE.md |
81
+ | Cursor | `.cursorrules` instructions |
82
+ | GitHub Copilot | `.github/copilot-instructions.md` instructions |
83
+ | Windsurf | `.windsurfrules` instructions |
84
+ | Cline | `.clinerules` instructions |
85
+ | Aider | `.aiderignore` file patterns |
76
86
 
77
- ## Using with opena2a-cli (Recommended)
87
+ Claude Code gets the strongest protection because it supports [hooks](https://docs.anthropic.com/en/docs/claude-code/hooks) -- a shell script runs *before* every file read and blocks access at the tool level.
78
88
 
79
- [opena2a-cli](https://github.com/opena2a-org/opena2a) is the main CLI that unifies all OpenA2A security tools. Secretless AI powers the credential management commands:
89
+ ## Storage Backends
80
90
 
81
- | opena2a-cli command | What it runs | Description |
82
- |---------------------|-------------|-------------|
83
- | `opena2a review` | All tools | Full security dashboard (HTML) |
84
- | `opena2a protect` | HackMyAgent + Secretless | Auto-fix findings + credential protection |
85
- | `opena2a secrets init` | Secretless AI | Initialize secretless protection |
86
- | `opena2a secrets verify` | Secretless AI | Verify secrets are hidden from AI |
87
- | `opena2a broker start` | Secretless AI | Identity-aware credential brokering |
88
- | `opena2a dlp scan` | Secretless AI | Scan transcripts for leaked credentials |
89
- | `opena2a shield init` | All tools | Full security setup in one command |
91
+ | Backend | Storage | Best For |
92
+ |---------|---------|----------|
93
+ | `local` | AES-256-GCM encrypted file | Quick start, single machine |
94
+ | `keychain` | macOS Keychain / Linux Secret Service | Native OS integration |
95
+ | `1password` | 1Password vault | Teams, CI/CD, multi-device |
96
+ | `vault` | HashiCorp Vault KV v2 | Enterprise, self-hosted |
97
+ | `gcp-sm` | GCP Secret Manager | GCP-native workloads |
90
98
 
91
99
  ```bash
92
- npm install -g opena2a-cli
93
- opena2a review # best place to start
100
+ npx secretless-ai backend set 1password # Switch backend
101
+ npx secretless-ai migrate --from local --to 1password # Migrate existing secrets
94
102
  ```
95
103
 
96
- ## How It Works
104
+ ## Installation
97
105
 
98
- Secretless auto-detects which AI tools you use and installs the right protections for each one:
106
+ ```bash
107
+ npx secretless-ai init # Run without installing
108
+ npm install -g secretless-ai # Install globally
109
+ npm install --save-dev secretless-ai # Add to project
110
+ ```
99
111
 
100
- | Tool | Protection Method |
101
- |------|------------------|
102
- | **Claude Code** | PreToolUse hook (blocks file reads before they happen) + deny rules + CLAUDE.md instructions |
103
- | **Cursor** | `.cursorrules` instructions |
104
- | **GitHub Copilot** | `.github/copilot-instructions.md` instructions |
105
- | **Windsurf** | `.windsurfrules` instructions |
106
- | **Cline** | `.clinerules` instructions |
107
- | **Aider** | `.aiderignore` file patterns |
112
+ Requirements: Node.js 18+. Zero runtime dependencies.
108
113
 
109
- Claude Code gets the strongest protection because it supports [hooks](https://docs.anthropic.com/en/docs/claude-code/hooks) — a shell script runs *before* every file read and blocks access to secret files at the tool level. Other tools get instruction-based protection.
114
+ ## Using with opena2a-cli
110
115
 
111
- ## Commands
116
+ [opena2a-cli](https://github.com/opena2a-org/opena2a) unifies all OpenA2A security tools. Secretless powers the credential management commands:
112
117
 
113
- ### Core
118
+ ```bash
119
+ npm install -g opena2a-cli
120
+ opena2a review # Full security dashboard (HTML)
121
+ opena2a secrets init # Initialize secretless protection
122
+ opena2a secrets verify # Verify secrets are hidden from AI
123
+ opena2a broker start # Identity-aware credential brokering
124
+ ```
114
125
 
115
- | Command | What It Does |
116
- |---------|-------------|
117
- | `init` | Set up protections for your AI tools |
118
- | `scan` | Scan for hardcoded secrets (49 patterns) |
119
- | `status` | Show protection status (session, broker, transcripts) |
120
- | `verify` | Verify keys are usable but hidden from AI |
121
- | `doctor [--fix]` | Diagnose and auto-fix shell profile issues |
122
- | `clean [--dry-run] [--path P]` | Scan and redact credentials in transcripts |
123
- | `watch start` | Start real-time transcript monitoring |
124
- | `watch stop` | Stop the transcript watcher |
125
- | `watch status` | Show watcher status |
126
+ ---
127
+
128
+ ## Detailed Reference
126
129
 
127
130
  ### Secret Management
128
131
 
@@ -157,8 +160,6 @@ $ npx secretless-ai secret get STRIPE_KEY # (run by AI tool)
157
160
  npx secretless-ai run -- <command>
158
161
  ```
159
162
 
160
- Direct terminal access (human) works normally. The guard detects non-interactive execution (how AI tools run commands) and refuses to output.
161
-
162
163
  #### Import from .env Files
163
164
 
164
165
  ```bash
@@ -183,9 +184,7 @@ npx secretless-ai setup --check # CI: fail if required secrets are
183
184
 
184
185
  ### Custom Rules
185
186
 
186
- Organizations can define their own deny patterns to block company-specific secrets from AI context. Custom rules extend the built-in protections with patterns tailored to your environment.
187
-
188
- **Quick start:**
187
+ Organizations can define deny patterns for company-specific secrets. Custom rules extend built-in protections.
189
188
 
190
189
  ```bash
191
190
  npx secretless-ai rules init # Create a .secretless-rules.yaml template
@@ -207,215 +206,41 @@ bash:
207
206
  - "vault read*"
208
207
  ```
209
208
 
210
- Each section maps to a deny rule type:
211
-
212
209
  | Section | Blocks |
213
210
  |---------|--------|
214
211
  | `env` | Environment variable references matching the pattern |
215
212
  | `files` | File reads matching the pattern |
216
213
  | `bash` | Bash commands matching the pattern |
217
214
 
218
- Patterns use glob syntax (`*` matches any characters).
219
-
220
- **Managing rules:**
221
-
222
215
  ```bash
223
216
  npx secretless-ai rules list # Show active rules and deny rule count
224
- npx secretless-ai rules test "ACME_*" # Preview generated deny rules for a pattern
225
- npx secretless-ai rules test "curl*internal.corp.com*" --bash # Force bash type detection
226
- ```
227
-
228
- After editing `.secretless-rules.yaml`, apply changes:
229
-
230
- ```bash
231
- npx secretless-ai init # Re-generates protections with custom rules included
232
- ```
233
-
234
- The rules file is safe to commit to version control -- it contains patterns, not secrets.
235
-
236
- ### Secret Storage Backends
237
-
238
- Secrets are never in environment variables, shell profiles, or config files — they exist only in the backend and get injected into process memory at runtime.
239
-
240
- | Backend | Storage | Sync | Auth | Best For |
241
- |---------|---------|------|------|----------|
242
- | `local` | AES-256-GCM encrypted file | None (single machine) | Filesystem | Quick start, simple setups |
243
- | `keychain` | macOS Keychain / Linux Secret Service | Device-local | OS login | Native OS integration |
244
- | `1password` | 1Password vault | Cross-device | Biometric (Touch ID) / Service Account | Teams, CI/CD, multi-device |
245
- | `vault` | HashiCorp Vault KV v2 | Cross-device / cluster | Vault token | Enterprise, self-hosted, team secrets |
246
- | `gcp-sm` | GCP Secret Manager | Cross-device / cloud | ADC / Service Account | GCP-native, Cloud Run, GKE |
247
-
248
- ```bash
249
- npx secretless-ai backend # Show available backends
250
- npx secretless-ai backend set 1password # Switch to 1Password
251
- npx secretless-ai backend set keychain # Switch to OS keychain
252
- npx secretless-ai backend set gcp-sm # Switch to GCP Secret Manager
253
- npx secretless-ai migrate --from local --to 1password # Migrate existing secrets
254
- ```
255
-
256
- #### 1Password Backend
257
-
258
- Stores secrets in a dedicated "Secretless" vault using the [`op` CLI](https://developer.1password.com/docs/cli). Secrets never touch disk.
259
-
260
- **Setup:**
261
-
262
- ```bash
263
- brew install --cask 1password # Install 1Password desktop app
264
- brew install --cask 1password-cli # Install op CLI
265
- ```
266
-
267
- Then enable CLI integration: **1Password > Settings > Developer > "Integrate with 1Password CLI"**. This allows the CLI to authenticate through the desktop app with biometric unlock (Touch ID / Windows Hello).
268
-
269
- ```bash
270
- npx secretless-ai backend set 1password # Switch backend
271
- ```
272
-
273
- **Prevent repeated popups:** Run `npx secretless-ai warm --ttl 1h` before starting an AI coding session. This pre-loads all secrets into the encrypted cache so no `op` CLI calls (and no biometric popups) happen during the session. See [Session Management](#session-management).
274
-
275
- **CI/CD:** Set `OP_SERVICE_ACCOUNT_TOKEN` — same secrets, no code changes. No desktop app needed.
276
-
277
- #### HashiCorp Vault Backend
278
-
279
- Stores secrets in a Vault KV v2 engine using the HTTP API. Zero SDK dependency — raw `fetch` calls.
280
-
281
- **Setup:**
282
-
283
- ```bash
284
- brew install vault # Install Vault CLI
285
- vault server -dev # Start dev server (for testing)
286
- ```
287
-
288
- ```bash
289
- export VAULT_ADDR=http://127.0.0.1:8200
290
- export VAULT_TOKEN=<your-token>
291
- npx secretless-ai backend set vault # Switch backend
292
- npx secretless-ai secret set DB_PASSWORD=... # Stored in Vault KV v2
293
- ```
294
-
295
- Supports custom mount paths via backend config. Default mount: `secret`.
296
-
297
- #### Backend Inspection
298
-
299
- ```bash
300
- npx secretless-ai backend list # Show all entries grouped by prefix
301
- npx secretless-ai backend purge # Dry-run: show what would be deleted
302
- npx secretless-ai backend purge --yes # Delete all entries
303
- npx secretless-ai backend purge --prefix mcp --yes # Delete only mcp/ entries
217
+ npx secretless-ai rules test "ACME_*" # Preview generated deny rules
218
+ npx secretless-ai init # Re-generate protections with custom rules
304
219
  ```
305
220
 
306
- ### MCP Secret Protection
307
-
308
- Every MCP server config has plaintext API keys sitting in JSON files on your laptop. The LLM sees them. Secretless encrypts them.
309
-
310
- ```bash
311
- npx secretless-ai protect-mcp
312
- ```
313
-
314
- ```
315
- Secretless MCP Protection
316
-
317
- Scanned 1 client(s)
318
-
319
- + claude-desktop/browserbase
320
- BROWSERBASE_API_KEY (encrypted)
321
- + claude-desktop/github
322
- GITHUB_PERSONAL_ACCESS_TOKEN (encrypted)
323
- + claude-desktop/stripe
324
- STRIPE_SECRET_KEY (encrypted)
325
-
326
- 3 secret(s) encrypted across 3 server(s).
327
-
328
- MCP servers will start normally — no workflow changes needed.
329
- ```
330
-
331
- **What happens:**
332
-
333
- 1. Scans MCP configs across Claude Desktop, Cursor, Claude Code, VS Code, and Windsurf
334
- 2. Identifies which env vars are secrets (key name patterns + value regex matching)
335
- 3. Stores secrets in your configured backend (local, keychain, 1Password, Vault, or GCP Secret Manager)
336
- 4. Rewrites configs to use the `secretless-mcp` wrapper — decrypts at runtime, injects as env vars
337
- 5. Non-secret env vars (URLs, org names, regions) stay in the config untouched
338
-
339
- ```bash
340
- npx secretless-ai protect-mcp --backend 1password # Store MCP secrets in 1Password
341
- npx secretless-ai mcp-status # Show which servers are protected/exposed
342
- npx secretless-ai mcp-unprotect # Restore original configs from backup
343
- ```
344
-
345
- ### Credential Scope Discovery
346
-
347
- Credentials are not static — their effective permissions change when platforms evolve. Secretless detects when a credential's scope expands beyond its baseline, catching privilege escalation before it becomes a breach.
348
-
349
- ```bash
350
- npx secretless-ai scope discover MY_CREDENTIAL # Discover current permissions, save baseline
351
- npx secretless-ai scope check MY_CREDENTIAL # Compare to baseline, report drift
352
- npx secretless-ai scope list # Show all baselines
353
- npx secretless-ai scope reset MY_CREDENTIAL # Clear baseline
354
- ```
355
-
356
- #### Supported Providers
357
-
358
- | Provider | Detection | API Used | Permissions Needed |
359
- |----------|-----------|----------|-------------------|
360
- | **GCP** | Service account key JSON | `testIamPermissions` (Cloud Resource Manager) | None (self-inspection) |
361
- | **Vault** | Token prefix (`hvs.`, `s.`) | `capabilities-self` (Sys) | None (self-inspection) |
362
- | **AWS** | Access key prefix (`AKIA`) | STS `GetCallerIdentity` + IAM policy introspection | None (self-inspection) |
363
-
364
- #### Broker Integration
365
-
366
- Add `scopeCheck: true` to any broker policy rule. The broker will block credential access if the credential's scope has expanded beyond its baseline.
367
-
368
221
  ### Session Management
369
222
 
370
- If you use 1Password or OS keychain as your backend, every secret access triggers a biometric prompt (Touch ID, 1Password popup). During an AI coding session, these fire repeatedly and interrupt your workflow.
371
-
372
- The `warm` command front-loads all authentication into one intentional moment:
223
+ If you use 1Password or OS keychain, every secret access triggers a biometric prompt. The `warm` command front-loads all authentication into one moment:
373
224
 
374
225
  ```bash
375
- npx secretless-ai warm # Authenticate once, pre-load all secrets into cache
376
- npx secretless-ai warm --ttl 1h # Set session length (default: 5m, accepts 300, 10m, 1h, 1d)
226
+ npx secretless-ai warm # Authenticate once, pre-load all secrets
227
+ npx secretless-ai warm --ttl 1h # Set session length (default: 5m)
377
228
  npx secretless-ai warm --no-broker # Skip auto-starting the broker daemon
378
229
  ```
379
230
 
380
- **What happens during warm:**
381
-
382
- 1. Touch ID authenticates your biometric session (macOS)
383
- 2. All secrets are resolved from your backend (1Password, keychain, vault) and cached in an AES-256-GCM encrypted file at `~/.secretless-ai/store/.secret-cache`
384
- 3. Cache TTL is synced with your session TTL so entries don't expire mid-session
385
- 4. The broker daemon starts if not already running
386
-
387
- **After warm, for the entire session:** every `resolve()` call hits the encrypted file cache. Zero `op` CLI calls, zero keychain prompts, zero popups.
388
-
389
- ```
390
- $ npx secretless-ai warm --ttl 1h
391
-
392
- Secretless Session
393
-
394
- Warming session...
395
- Session is warm.
396
-
397
- TTL: 3600s (1h 0m)
398
- Expires at: 2026-03-04T17:30:00.000Z
399
- Touch ID: used
400
- Cache: 12 secrets preloaded
401
- Broker: running
402
-
403
- You can now use AI tools without repeated auth prompts.
404
- ```
231
+ After warming, every `resolve()` call hits the encrypted file cache. Zero `op` CLI calls, zero keychain prompts.
405
232
 
406
233
  #### Auto-Start on Login (macOS)
407
234
 
408
- Install as a macOS LaunchAgent so the broker starts automatically:
409
-
410
235
  ```bash
411
236
  npx secretless-ai install # Install LaunchAgent
412
237
  npx secretless-ai install status # Check installation status
413
238
  npx secretless-ai install uninstall # Remove LaunchAgent
414
239
  ```
415
240
 
416
- #### Claude Code Integration
241
+ #### Claude Code Session Gate
417
242
 
418
- Add a session gate to Claude Code so it blocks tool calls when your session has expired:
243
+ Add to `.claude/settings.json` to block tool calls when your session has expired:
419
244
 
420
245
  ```json
421
246
  {
@@ -435,43 +260,44 @@ Add a session gate to Claude Code so it blocks tool calls when your session has
435
260
  }
436
261
  ```
437
262
 
438
- When the session is warm, the hook passes silently (exit 0, ~57ms). When expired, it blocks with an actionable message:
439
-
440
- ```
441
- Secretless session expired. Run: secretless-ai warm
442
- ```
443
-
444
- If secretless has never been set up (no session file exists), the hook passes — it won't block users who haven't opted in.
263
+ When warm, the hook passes silently (~57ms). When expired, it blocks with: `Secretless session expired. Run: secretless-ai warm`
445
264
 
446
265
  #### Secret Cache
447
266
 
448
- The cache reduces OS authentication prompts for keychain and 1Password backends by storing resolved secrets in an AES-256-GCM encrypted file. The `warm` command pre-populates the cache automatically.
449
-
450
267
  ```bash
451
268
  npx secretless-ai cache # Show cache status
452
269
  npx secretless-ai cache ttl 1h # Set cache TTL (5m, 1h, 1d, off)
453
270
  npx secretless-ai cache clear # Clear cached secrets
454
271
  ```
455
272
 
273
+ ### Credential Scope Discovery
274
+
275
+ Detect when a credential's permissions expand beyond its baseline -- catching privilege escalation before it becomes a breach.
276
+
277
+ ```bash
278
+ npx secretless-ai scope discover MY_CREDENTIAL # Discover permissions, save baseline
279
+ npx secretless-ai scope check MY_CREDENTIAL # Compare to baseline, report drift
280
+ npx secretless-ai scope list # Show all baselines
281
+ npx secretless-ai scope reset MY_CREDENTIAL # Clear baseline
282
+ ```
283
+
284
+ | Provider | Detection | API Used |
285
+ |----------|-----------|----------|
286
+ | GCP | Service account key JSON | `testIamPermissions` |
287
+ | Vault | Token prefix (`hvs.`, `s.`) | `capabilities-self` |
288
+ | AWS | Access key prefix (`AKIA`) | STS `GetCallerIdentity` + IAM introspection |
289
+
456
290
  ### Identity-Aware Credential Broker
457
291
 
458
- The broker is a daemon that provides identity-aware credential brokering for AI agents. Instead of giving agents direct access to secrets, the broker requires agents to authenticate (via AIM identity tokens) before credentials are injected into their process environment.
292
+ The broker provides identity-aware credential brokering for AI agents. Agents authenticate via AIM identity tokens before credentials are injected.
459
293
 
460
294
  ```bash
461
295
  npx secretless-ai broker start # Start the credential broker daemon
462
296
  npx secretless-ai broker stop # Stop the broker daemon
463
- npx secretless-ai broker status # Show broker status, uptime, and request count
297
+ npx secretless-ai broker status # Show broker status and request count
464
298
  ```
465
299
 
466
- **Broker start flags:**
467
-
468
- | Flag | Default | Description |
469
- |------|---------|-------------|
470
- | `--aim-url URL` | None | AIM server URL for agent identity verification |
471
- | `--port N` | Auto | Port for the broker daemon |
472
- | `--policy-file PATH` | `~/.secretless-ai/broker-policies.json` | Path to policy rules file |
473
-
474
- **Policy example** — define rules in `~/.secretless-ai/broker-policies.json`:
300
+ **Policy example** (`~/.secretless-ai/broker-policies.json`):
475
301
 
476
302
  ```json
477
303
  {
@@ -491,99 +317,64 @@ npx secretless-ai broker status # Show broker status, uptime, and request c
491
317
  "id": "deny-all-production-keys",
492
318
  "agentSelector": "*",
493
319
  "credentialSelector": "PROD_*",
494
- "effect": "deny",
495
- "constraints": {}
320
+ "effect": "deny"
496
321
  }
497
322
  ]
498
323
  }
499
324
  ```
500
325
 
501
- The policy engine is default-deny: deny rules are evaluated first, then allow rules. All constraints must pass for an allow rule to grant access. Supported constraints include `minTrustScore` (AIM trust score), `rateLimit`, `timeWindow`, `requireCapability`, and `scopeCheck` (blocks access if a credential's scope has expanded beyond its baseline).
326
+ Default-deny policy engine. Supported constraints: `minTrustScore`, `rateLimit`, `timeWindow`, `requireCapability`, `scopeCheck`.
502
327
 
503
- **Request flow:**
328
+ ### Data Loss Prevention
504
329
 
505
- 1. `broker start` starts the broker daemon on a local socket
506
- 2. An agent requests a credential (e.g., `GITHUB_TOKEN`)
507
- 3. The broker verifies the agent's AIM identity token
508
- 4. The policy engine evaluates the request against loaded rules
509
- 5. If allowed, the broker resolves the secret from the configured backend and returns it
510
- 6. If denied, the broker returns an error and logs the attempt to the audit log
511
-
512
- ### Data Loss Prevention (DLP)
513
-
514
- DLP commands scan AI tool transcripts (conversation logs, shell history, tool output) for accidentally leaked credentials. If an API key, token, or connection string appears in a transcript, DLP flags it so you can rotate the exposed credential.
330
+ Scan AI tool transcripts for accidentally leaked credentials:
515
331
 
516
332
  ```bash
517
- npx secretless-ai scan --history # Scan shell history for credentials
333
+ npx secretless-ai scan --history # Scan shell history
518
334
  npx secretless-ai clean-history # Redact credentials in shell history
519
335
  npx secretless-ai clean-history --dry-run # Preview without modifying
520
336
  ```
521
337
 
522
338
  ### Git Protection
523
339
 
524
- Prevent secrets from being committed:
525
-
526
340
  ```bash
527
341
  npx secretless-ai hook install # Install pre-commit secret scanner
528
342
  npx secretless-ai hook status # Check hook installation status
529
343
  npx secretless-ai hook uninstall # Remove pre-commit hook
530
344
  ```
531
345
 
532
- ### Moving Keys from AI Context to Env Vars
533
-
534
- The safest setup: keys live in environment variables, AI tools reference them by name.
346
+ ### Backend Configuration
535
347
 
536
- **Step 1: Move keys to the correct shell profile**
348
+ #### 1Password
537
349
 
538
- Non-interactive subprocesses (Claude Code's Bash tool, CI/CD, Docker) don't source interactive-only profiles. Use the right file for your platform:
539
-
540
- | Platform | Shell | Correct File | Why |
541
- |----------|-------|-------------|-----|
542
- | macOS | zsh | `~/.zshenv` | Sourced by ALL shells (interactive + non-interactive) |
543
- | Linux | bash | `~/.bashrc` | Sourced by interactive bash; most tools source it explicitly |
544
- | Windows | — | System Environment Variables | Use `setx` or Settings > System > Environment Variables |
545
-
546
- **Step 2: Run secretless init**
350
+ Stores secrets in a dedicated "Secretless" vault using the [`op` CLI](https://developer.1password.com/docs/cli).
547
351
 
548
352
  ```bash
549
- npx secretless-ai init
353
+ brew install --cask 1password 1password-cli
354
+ # Enable: 1Password > Settings > Developer > "Integrate with 1Password CLI"
355
+ npx secretless-ai backend set 1password
550
356
  ```
551
357
 
552
- **Step 3: Verify**
358
+ **CI/CD:** Set `OP_SERVICE_ACCOUNT_TOKEN` -- same secrets, no desktop app needed.
553
359
 
554
- ```bash
555
- npx secretless-ai verify
556
- ```
360
+ #### HashiCorp Vault
557
361
 
362
+ ```bash
363
+ export VAULT_ADDR=http://127.0.0.1:8200
364
+ export VAULT_TOKEN=<your-token>
365
+ npx secretless-ai backend set vault
558
366
  ```
559
- Env vars available (usable by tools):
560
- + ANTHROPIC_API_KEY
561
- + OPENAI_API_KEY
562
367
 
563
- AI context files: clean (no credentials found)
368
+ #### Backend Inspection
564
369
 
565
- PASS: Secrets are accessible via env vars but hidden from AI context.
370
+ ```bash
371
+ npx secretless-ai backend list # Show all entries grouped by prefix
372
+ npx secretless-ai backend purge # Dry-run: show what would be deleted
373
+ npx secretless-ai backend purge --yes # Delete all entries
374
+ npx secretless-ai backend purge --prefix mcp --yes # Delete only mcp/ entries
566
375
  ```
567
376
 
568
- ## What Gets Blocked
569
-
570
- ### File patterns (21)
571
-
572
- `.env`, `.env.*`, `*.key`, `*.pem`, `*.p12`, `*.pfx`, `*.crt`, `.aws/credentials`, `.ssh/*`, `.docker/config.json`, `.git-credentials`, `.npmrc`, `.pypirc`, `*.tfstate`, `*.tfvars`, `secrets/`, `credentials/`
573
-
574
- ### Credential patterns (49)
575
-
576
- Anthropic API keys, OpenAI keys, AWS access keys, GitHub PATs, Slack tokens, Google API keys, Stripe keys, SendGrid keys, Supabase keys, Azure keys, GitLab tokens, Twilio keys, Mailgun keys, MongoDB URIs, JWTs, and more
577
-
578
- ### Bash commands
579
-
580
- Commands that dump secret files (`cat .env`, `head *.key`) and commands that echo secret environment variables (`echo $API_KEY`, `echo $SECRET`)
581
-
582
- ## Claude Code Hook
583
-
584
- For Claude Code, Secretless installs a PreToolUse hook that intercepts every `Read`, `Grep`, `Glob`, `Bash`, `Write`, and `Edit` tool call. The hook runs *before* the tool executes, so secrets never enter the AI context window.
585
-
586
- ## CI/CD Integration
377
+ ### CI/CD Integration
587
378
 
588
379
  All commands support `--json` and `--ci` flags.
589
380
 
@@ -602,119 +393,88 @@ jobs:
602
393
  - run: npx secretless-ai setup --check
603
394
  ```
604
395
 
605
- ## All Commands
396
+ ### What Gets Blocked
397
+
398
+ **File patterns (21):** `.env`, `.env.*`, `*.key`, `*.pem`, `*.p12`, `*.pfx`, `*.crt`, `.aws/credentials`, `.ssh/*`, `.docker/config.json`, `.git-credentials`, `.npmrc`, `.pypirc`, `*.tfstate`, `*.tfvars`, `secrets/`, `credentials/`
399
+
400
+ **Credential patterns (49):** Anthropic, OpenAI, AWS, GitHub, Slack, Google, Stripe, SendGrid, Supabase, Azure, GitLab, Twilio, Mailgun, MongoDB, JWTs, and more
401
+
402
+ **Bash commands:** Commands that dump secret files (`cat .env`, `head *.key`) and commands that echo secret environment variables (`echo $API_KEY`)
403
+
404
+ ### Security Architecture
405
+
406
+ | Layer | Algorithm | Purpose |
407
+ |-------|-----------|---------|
408
+ | Secret encryption | AES-256-GCM | Encrypt secrets at rest |
409
+ | Key derivation | scrypt (N=16384, r=8, p=1) | Derive keys from machine identity + random salt |
410
+ | Session integrity | HMAC-SHA256 | Tamper detection on session state |
411
+ | Broker auth | crypto.randomBytes(32) | Bearer token for credential broker |
412
+ | Cloud signing | HMAC-SHA256 / RS256 | Authenticate to cloud secret managers |
413
+
414
+ All encryption uses Node.js built-in `crypto` module. No external crypto dependencies. Key material zeroed after use. File permissions 0o600/0o700.
415
+
416
+ ### All Commands
606
417
 
607
418
  | Command | Description |
608
419
  |---------|-------------|
609
420
  | **Core** | |
610
421
  | `init` | Set up protections for your AI tools |
611
422
  | `scan` | Scan for hardcoded secrets (49 patterns) |
612
- | `status` | Show protection status (session, broker, transcripts) |
423
+ | `status` | Show protection status |
613
424
  | `verify` | Verify keys are usable but hidden from AI |
614
425
  | `doctor [--fix]` | Diagnose and auto-fix shell profile issues |
615
426
  | `clean [--dry-run] [--path P]` | Scan and redact credentials in transcripts |
616
- | `watch start` | Start real-time transcript monitoring |
617
- | `watch stop` | Stop the transcript watcher |
618
- | `watch status` | Show watcher status |
619
- | `watch install` | Install watcher as a system daemon |
620
- | `watch uninstall` | Remove watcher daemon |
621
- | `scan-history` | Scan shell history and transcripts for leaked credentials |
622
- | **Session Management** | |
623
- | `warm` | Warm biometric session and pre-load secrets into cache |
624
- | `warm --ttl 10m` | Set session TTL (accepts seconds, 5m, 1h, 1d) |
625
- | `warm --no-broker` | Skip auto-starting the broker daemon |
626
- | `install` | Install broker as macOS login daemon (LaunchAgent) |
627
- | `install uninstall` | Remove LaunchAgent |
628
- | `install status` | Check daemon installation status |
629
- | `hook --check-only` | Session gate for Claude Code PreToolUse hooks |
630
- | **Secret Management** | |
631
- | `secret set <NAME[=VALUE]>` | Store a secret |
632
- | `secret list` | List stored secret names |
633
- | `secret get <NAME>` | Retrieve a secret value (blocked in non-interactive contexts) |
634
- | `secret rm <NAME>` | Remove a secret |
635
- | `run [--only K1,K2] -- <cmd>` | Run command with secrets injected as env vars |
636
- | `import <file>` | Import secrets from .env file |
637
- | `import --detect` | Auto-find and import .env files |
638
- | **Project Setup** | |
639
- | `setup` | Interactive setup from `.secretless` manifest |
640
- | `setup --check` | CI: fail if required secrets are missing |
641
- | **Git Protection** | |
642
- | `hook install` | Install pre-commit secret scanner |
643
- | `hook uninstall` | Remove pre-commit hook |
644
- | `hook status` | Check hook installation status |
645
- | **Shell History** | |
646
- | `scan --history` | Scan shell history for credentials |
647
- | `clean-history` | Redact credentials in shell history |
648
- | `clean-history --dry-run` | Preview redaction without modifying |
649
- | **MCP Protection** | |
427
+ | `watch start\|stop\|status\|install\|uninstall` | Real-time transcript monitoring |
428
+ | `scan-history` | Scan shell history for leaked credentials |
429
+ | **Session** | |
430
+ | `warm [--ttl T] [--no-broker]` | Warm biometric session, pre-load secrets |
431
+ | `install [status\|uninstall]` | macOS LaunchAgent management |
432
+ | `hook --check-only` | Session gate for Claude Code hooks |
433
+ | **Secrets** | |
434
+ | `secret set\|list\|get\|rm` | Manage stored secrets |
435
+ | `run [--only K1,K2] -- <cmd>` | Run command with secrets injected |
436
+ | `import <file>\|--detect` | Import from .env files |
437
+ | `setup [--check]` | Interactive setup from `.secretless` manifest |
438
+ | **MCP** | |
650
439
  | `protect-mcp [--backend TYPE]` | Encrypt MCP server secrets |
651
440
  | `mcp-status` | Show MCP protection status |
652
441
  | `mcp-unprotect` | Restore original MCP configs |
653
- | **Backend Management** | |
654
- | `backend` | Show current backend status |
655
- | `backend set <TYPE>` | Set backend (local, keychain, 1password, vault, gcp-sm) |
656
- | `backend list` | List all stored entries |
657
- | `backend purge [--prefix] [--yes]` | Delete entries from backend |
442
+ | **Backend** | |
443
+ | `backend [set\|list\|purge]` | Manage storage backends |
658
444
  | `migrate --from TYPE --to TYPE` | Migrate secrets between backends |
659
- | **Scope Discovery** | |
660
- | `scope discover <NAME>` | Discover credential permissions and save baseline |
661
- | `scope check <NAME>` | Compare current permissions to baseline |
662
- | `scope list` | Show all scope baselines |
663
- | `scope reset <NAME>` | Clear a scope baseline |
664
- | **Shell Integration** | |
665
- | `env [--only K1,K2]` | Output export statements for stored secrets (use with `eval`) |
666
- | `scan-staged` | Scan git staged files for secrets (used by pre-commit hook) |
667
- | **Cache Management** | |
668
- | `cache` | Show cache status (backend, TTL, entries) |
669
- | `cache clear` | Clear the encrypted secret cache |
670
- | `cache ttl [DURATION]` | Show or set cache TTL (e.g., `5m`, `1h`, `off`) |
671
- | **Credential Broker** | |
672
- | `broker start [--aim-url URL] [--port N] [--policy-file PATH]` | Start the credential broker daemon |
673
- | `broker stop` | Stop the broker daemon |
674
- | `broker status` | Show broker status, uptime, and request count |
675
- | **Custom Rules** | |
676
- | `rules init` | Create a `.secretless-rules.yaml` template |
677
- | `rules list` | Show active custom rules and deny rule count |
678
- | `rules test "PATTERN" [--bash]` | Preview generated deny rules for a pattern |
679
-
680
- ## Security Architecture
681
-
682
- | Layer | Algorithm | Purpose |
683
- |-------|-----------|---------|
684
- | Secret encryption | AES-256-GCM | Encrypt secrets at rest (local store, cache, MCP backups) |
685
- | Key derivation | scrypt (N=16384, r=8, p=1) | Derive encryption keys from machine identity + random salt |
686
- | Session integrity | HMAC-SHA256 | Tamper detection on session state files |
687
- | Broker auth | crypto.randomBytes(32) | Bearer token for localhost credential broker |
688
- | Cloud signing | HMAC-SHA256 (AWS SigV4), RS256 (GCP JWT) | Authenticate to cloud secret managers |
689
-
690
- **Design principles:**
691
- - All encryption uses symmetric cryptography only (no RSA/ECDSA in core)
692
- - Encryption keys derived via scrypt with 16-byte random salts (not password-derived)
693
- - Constant-time comparison (`timingSafeEqual`) for all token and HMAC verification
694
- - Crypto agility: encryption isolated behind backend interfaces for algorithm portability
695
- - Key material zeroed after use (`Buffer.fill(0)`)
696
- - Restrictive file permissions (0o600 files, 0o700 directories)
697
- - No external crypto dependencies -- Node.js built-in `crypto` module only
445
+ | **Scope** | |
446
+ | `scope discover\|check\|list\|reset` | Credential scope discovery |
447
+ | **Broker** | |
448
+ | `broker start\|stop\|status` | Identity-aware credential broker |
449
+ | **Rules** | |
450
+ | `rules init\|list\|test` | Custom deny rules |
451
+ | **Git** | |
452
+ | `hook install\|uninstall\|status` | Pre-commit secret scanner |
453
+ | **Cache** | |
454
+ | `cache [clear\|ttl]` | Secret cache management |
455
+ | **Shell** | |
456
+ | `env [--only K1,K2]` | Output export statements for secrets |
457
+ | `scan-staged` | Scan git staged files |
458
+ | `clean-history [--dry-run]` | Redact credentials in shell history |
698
459
 
699
460
  ## Development
700
461
 
701
462
  ```bash
702
463
  npm run build # Compile TypeScript to dist/
703
- npm test # Run tests (vitest, 791 tests)
704
- npm run dev # Watch mode — recompile on file changes
705
- npm run clean # Remove dist/ directory
464
+ npm test # Run tests (vitest, 792 tests)
465
+ npm run dev # Watch mode
466
+ npm run clean # Remove dist/
706
467
  ```
707
468
 
708
469
  ## OpenA2A Ecosystem
709
470
 
710
471
  | Project | Description | Install |
711
472
  |---------|-------------|---------|
712
- | [**OpenA2A CLI**](https://github.com/opena2a-org/opena2a) | Unified security CLI -- orchestrates all OpenA2A tools | `npx opena2a` |
713
- | [**HackMyAgent**](https://github.com/opena2a-org/hackmyagent) | Security scanner and red-team toolkit -- checks, attack mode, benchmarks, runtime protection | `npx hackmyagent secure` |
714
- | [**AIM**](https://github.com/opena2a-org/agent-identity-management) | Agent Identity Management -- identity, access control, and trust scoring for AI agents | Self-hosted |
715
- | [**AI Browser Guard**](https://github.com/opena2a-org/AI-BrowserGuard) | Browser agent detection and control -- 4-layer detection, delegation engine | Chrome Web Store |
716
- | [**DVAA**](https://github.com/opena2a-org/damn-vulnerable-ai-agent) | Damn Vulnerable AI Agent -- security training target | `docker pull opena2a/dvaa` |
717
- | **Registry** | Trust registry -- agent discovery, trust scores, supply chain verification | Coming soon |
473
+ | [**OpenA2A CLI**](https://github.com/opena2a-org/opena2a) | Unified security CLI | `npx opena2a` |
474
+ | [**HackMyAgent**](https://github.com/opena2a-org/hackmyagent) | Security scanner and red-team toolkit | `npx hackmyagent secure` |
475
+ | [**AIM**](https://github.com/opena2a-org/agent-identity-management) | Agent identity, access control, trust scoring | Self-hosted |
476
+ | [**AI Browser Guard**](https://github.com/opena2a-org/AI-BrowserGuard) | Browser agent detection and control | Chrome Web Store |
477
+ | [**DVAA**](https://github.com/opena2a-org/damn-vulnerable-ai-agent) | Security training target | `docker pull opena2a/dvaa` |
718
478
 
719
479
  ## License
720
480