secretless-ai 0.12.5 → 0.12.6
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 +10 -364
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
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)
|
|
2
|
-
|
|
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)
|
|
3
2
|
# secretless-ai
|
|
4
3
|
|
|
5
4
|
[](https://www.npmjs.com/package/secretless-ai)
|
|
@@ -21,6 +20,8 @@ npx secretless-ai init
|
|
|
21
20
|
Done. Secrets are now invisible to AI tools.
|
|
22
21
|
```
|
|
23
22
|
|
|
23
|
+

|
|
24
|
+
|
|
24
25
|
For a full security dashboard covering credentials, shadow AI, config integrity, and more:
|
|
25
26
|
|
|
26
27
|
```bash
|
|
@@ -101,381 +102,26 @@ npx secretless-ai backend set 1password # Switch backend
|
|
|
101
102
|
npx secretless-ai migrate --from local --to 1password # Migrate existing secrets
|
|
102
103
|
```
|
|
103
104
|
|
|
104
|
-
## Installation
|
|
105
|
-
|
|
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
|
-
```
|
|
111
|
-
|
|
112
|
-
Requirements: Node.js 18+. Zero runtime dependencies.
|
|
113
|
-
|
|
114
105
|
## Using with opena2a-cli
|
|
115
106
|
|
|
116
|
-
[opena2a-cli](https://github.com/opena2a-org/opena2a) unifies all OpenA2A security tools
|
|
107
|
+
[opena2a-cli](https://github.com/opena2a-org/opena2a) unifies all OpenA2A security tools:
|
|
117
108
|
|
|
118
109
|
```bash
|
|
119
110
|
npm install -g opena2a-cli
|
|
120
|
-
opena2a review # Full security dashboard
|
|
111
|
+
opena2a review # Full security dashboard
|
|
121
112
|
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
|
-
```
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
## Detailed Reference
|
|
129
|
-
|
|
130
|
-
### Secret Management
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
npx secretless-ai secret set STRIPE_KEY=sk_live_... # Store a secret
|
|
134
|
-
npx secretless-ai secret set DATABASE_URL # Read value from stdin
|
|
135
|
-
npx secretless-ai secret list # List secret names (never values)
|
|
136
|
-
npx secretless-ai secret rm STRIPE_KEY # Remove a secret
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
#### Running Commands with Secrets
|
|
140
|
-
|
|
141
|
-
Inject secrets as environment variables into any command. The AI tool sees the command output but never the secret values.
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
npx secretless-ai run -- npm test # Inject all secrets
|
|
145
|
-
npx secretless-ai run --only STRIPE_KEY -- curl -u "$STRIPE_KEY:" https://api.stripe.com/v1/balance
|
|
146
|
-
npx secretless-ai run --only DATABASE_URL -- npm run migrate # Inject specific key
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
#### AI-Safe by Design
|
|
150
|
-
|
|
151
|
-
When an AI tool tries to read a secret value, secretless blocks it:
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
$ npx secretless-ai secret get STRIPE_KEY # (run by AI tool)
|
|
155
|
-
|
|
156
|
-
secretless: Blocked -- secret values cannot be read in non-interactive contexts.
|
|
157
|
-
AI tools capture stdout, which would expose the secret in their context.
|
|
158
|
-
|
|
159
|
-
To inject secrets into a command:
|
|
160
|
-
npx secretless-ai run -- <command>
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
#### Import from .env Files
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
npx secretless-ai import .env # Import from specific file
|
|
167
|
-
npx secretless-ai import --detect # Auto-find and import all .env files
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
#### Project Manifests
|
|
171
|
-
|
|
172
|
-
Define required secrets in a `.secretless` file at the project root:
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
STRIPE_KEY required Stripe API key for payments
|
|
176
|
-
DATABASE_URL required PostgreSQL connection string
|
|
177
|
-
SENTRY_DSN optional Error tracking
|
|
178
113
|
```
|
|
179
114
|
|
|
180
|
-
```bash
|
|
181
|
-
npx secretless-ai setup # Interactive setup for missing secrets
|
|
182
|
-
npx secretless-ai setup --check # CI: fail if required secrets are missing
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### Custom Rules
|
|
186
|
-
|
|
187
|
-
Organizations can define deny patterns for company-specific secrets. Custom rules extend built-in protections.
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
npx secretless-ai rules init # Create a .secretless-rules.yaml template
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
**`.secretless-rules.yaml` format:**
|
|
194
|
-
|
|
195
|
-
```yaml
|
|
196
|
-
env:
|
|
197
|
-
- "ACME_*"
|
|
198
|
-
- "INTERNAL_*_TOKEN"
|
|
199
|
-
|
|
200
|
-
files:
|
|
201
|
-
- "*.corp-secret"
|
|
202
|
-
- "config/production-keys.*"
|
|
203
|
-
|
|
204
|
-
bash:
|
|
205
|
-
- "curl*internal.corp.com*"
|
|
206
|
-
- "vault read*"
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
| Section | Blocks |
|
|
210
|
-
|---------|--------|
|
|
211
|
-
| `env` | Environment variable references matching the pattern |
|
|
212
|
-
| `files` | File reads matching the pattern |
|
|
213
|
-
| `bash` | Bash commands matching the pattern |
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
npx secretless-ai rules list # Show active rules and deny rule count
|
|
217
|
-
npx secretless-ai rules test "ACME_*" # Preview generated deny rules
|
|
218
|
-
npx secretless-ai init # Re-generate protections with custom rules
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### Session Management
|
|
222
|
-
|
|
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:
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
npx secretless-ai warm # Authenticate once, pre-load all secrets
|
|
227
|
-
npx secretless-ai warm --ttl 1h # Set session length (default: 5m)
|
|
228
|
-
npx secretless-ai warm --no-broker # Skip auto-starting the broker daemon
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
After warming, every `resolve()` call hits the encrypted file cache. Zero `op` CLI calls, zero keychain prompts.
|
|
232
|
-
|
|
233
|
-
#### Auto-Start on Login (macOS)
|
|
234
|
-
|
|
235
|
-
```bash
|
|
236
|
-
npx secretless-ai install # Install LaunchAgent
|
|
237
|
-
npx secretless-ai install status # Check installation status
|
|
238
|
-
npx secretless-ai install uninstall # Remove LaunchAgent
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
#### Claude Code Session Gate
|
|
242
|
-
|
|
243
|
-
Add to `.claude/settings.json` to block tool calls when your session has expired:
|
|
244
|
-
|
|
245
|
-
```json
|
|
246
|
-
{
|
|
247
|
-
"hooks": {
|
|
248
|
-
"PreToolUse": [
|
|
249
|
-
{
|
|
250
|
-
"matcher": "Bash",
|
|
251
|
-
"hooks": [
|
|
252
|
-
{
|
|
253
|
-
"type": "command",
|
|
254
|
-
"command": "npx secretless-ai hook --check-only"
|
|
255
|
-
}
|
|
256
|
-
]
|
|
257
|
-
}
|
|
258
|
-
]
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
When warm, the hook passes silently (~57ms). When expired, it blocks with: `Secretless session expired. Run: secretless-ai warm`
|
|
264
|
-
|
|
265
|
-
#### Secret Cache
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
npx secretless-ai cache # Show cache status
|
|
269
|
-
npx secretless-ai cache ttl 1h # Set cache TTL (5m, 1h, 1d, off)
|
|
270
|
-
npx secretless-ai cache clear # Clear cached secrets
|
|
271
|
-
```
|
|
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
|
-
|
|
290
|
-
### Identity-Aware Credential Broker
|
|
291
|
-
|
|
292
|
-
The broker provides identity-aware credential brokering for AI agents. Agents authenticate via AIM identity tokens before credentials are injected.
|
|
293
|
-
|
|
294
|
-
```bash
|
|
295
|
-
npx secretless-ai broker start # Start the credential broker daemon
|
|
296
|
-
npx secretless-ai broker stop # Stop the broker daemon
|
|
297
|
-
npx secretless-ai broker status # Show broker status and request count
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
**Policy example** (`~/.secretless-ai/broker-policies.json`):
|
|
301
|
-
|
|
302
|
-
```json
|
|
303
|
-
{
|
|
304
|
-
"rules": [
|
|
305
|
-
{
|
|
306
|
-
"id": "scan-agents-read-github",
|
|
307
|
-
"agentSelector": "scan-*",
|
|
308
|
-
"credentialSelector": "GITHUB_*",
|
|
309
|
-
"effect": "allow",
|
|
310
|
-
"constraints": {
|
|
311
|
-
"minTrustScore": 0.7,
|
|
312
|
-
"rateLimit": { "maxPerMinute": 10 },
|
|
313
|
-
"scopeCheck": true
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
"id": "deny-all-production-keys",
|
|
318
|
-
"agentSelector": "*",
|
|
319
|
-
"credentialSelector": "PROD_*",
|
|
320
|
-
"effect": "deny"
|
|
321
|
-
}
|
|
322
|
-
]
|
|
323
|
-
}
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
Default-deny policy engine. Supported constraints: `minTrustScore`, `rateLimit`, `timeWindow`, `requireCapability`, `scopeCheck`.
|
|
327
|
-
|
|
328
|
-
### Data Loss Prevention
|
|
329
|
-
|
|
330
|
-
Scan AI tool transcripts for accidentally leaked credentials:
|
|
331
|
-
|
|
332
|
-
```bash
|
|
333
|
-
npx secretless-ai scan --history # Scan shell history
|
|
334
|
-
npx secretless-ai clean-history # Redact credentials in shell history
|
|
335
|
-
npx secretless-ai clean-history --dry-run # Preview without modifying
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### Git Protection
|
|
339
|
-
|
|
340
|
-
```bash
|
|
341
|
-
npx secretless-ai hook install # Install pre-commit secret scanner
|
|
342
|
-
npx secretless-ai hook status # Check hook installation status
|
|
343
|
-
npx secretless-ai hook uninstall # Remove pre-commit hook
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
### Backend Configuration
|
|
347
|
-
|
|
348
|
-
#### 1Password
|
|
349
|
-
|
|
350
|
-
Stores secrets in a dedicated "Secretless" vault using the [`op` CLI](https://developer.1password.com/docs/cli).
|
|
351
|
-
|
|
352
|
-
```bash
|
|
353
|
-
brew install --cask 1password 1password-cli
|
|
354
|
-
# Enable: 1Password > Settings > Developer > "Integrate with 1Password CLI"
|
|
355
|
-
npx secretless-ai backend set 1password
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
**CI/CD:** Set `OP_SERVICE_ACCOUNT_TOKEN` -- same secrets, no desktop app needed.
|
|
359
|
-
|
|
360
|
-
#### HashiCorp Vault
|
|
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
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
#### Backend Inspection
|
|
369
|
-
|
|
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
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### CI/CD Integration
|
|
378
|
-
|
|
379
|
-
All commands support `--json` and `--ci` flags.
|
|
380
|
-
|
|
381
|
-
```yaml
|
|
382
|
-
# GitHub Actions
|
|
383
|
-
name: Credential Check
|
|
384
|
-
on: [push, pull_request]
|
|
385
|
-
jobs:
|
|
386
|
-
secrets:
|
|
387
|
-
runs-on: ubuntu-latest
|
|
388
|
-
steps:
|
|
389
|
-
- uses: actions/checkout@v4
|
|
390
|
-
- uses: actions/setup-node@v4
|
|
391
|
-
with: { node-version: '20' }
|
|
392
|
-
- run: npx secretless-ai scan --json > scan-report.json
|
|
393
|
-
- run: npx secretless-ai setup --check
|
|
394
|
-
```
|
|
395
|
-
|
|
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
|
|
417
|
-
|
|
418
|
-
| Command | Description |
|
|
419
|
-
|---------|-------------|
|
|
420
|
-
| **Core** | |
|
|
421
|
-
| `init` | Set up protections for your AI tools |
|
|
422
|
-
| `scan` | Scan for hardcoded secrets (49 patterns) |
|
|
423
|
-
| `status` | Show protection status |
|
|
424
|
-
| `verify` | Verify keys are usable but hidden from AI |
|
|
425
|
-
| `doctor [--fix]` | Diagnose and auto-fix shell profile issues |
|
|
426
|
-
| `clean [--dry-run] [--path P]` | Scan and redact credentials in transcripts |
|
|
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** | |
|
|
439
|
-
| `protect-mcp [--backend TYPE]` | Encrypt MCP server secrets |
|
|
440
|
-
| `mcp-status` | Show MCP protection status |
|
|
441
|
-
| `mcp-unprotect` | Restore original MCP configs |
|
|
442
|
-
| **Backend** | |
|
|
443
|
-
| `backend [set\|list\|purge]` | Manage storage backends |
|
|
444
|
-
| `migrate --from TYPE --to TYPE` | Migrate secrets between backends |
|
|
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 |
|
|
459
|
-
|
|
460
115
|
## Development
|
|
461
116
|
|
|
462
117
|
```bash
|
|
463
|
-
npm run build
|
|
464
|
-
npm test # Run tests (vitest, 792 tests)
|
|
465
|
-
npm run dev # Watch mode
|
|
466
|
-
npm run clean # Remove dist/
|
|
118
|
+
npm run build && npm test # 792 tests
|
|
467
119
|
```
|
|
468
120
|
|
|
469
|
-
## OpenA2A Ecosystem
|
|
470
|
-
|
|
471
|
-
| Project | Description | Install |
|
|
472
|
-
|---------|-------------|---------|
|
|
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` |
|
|
478
|
-
|
|
479
121
|
## License
|
|
480
122
|
|
|
481
123
|
Apache-2.0
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
Part of the [OpenA2A](https://opena2a.org) ecosystem. Full reference: [opena2a.org/docs/secretless](https://opena2a.org/docs/secretless)
|
package/package.json
CHANGED