@i4ctime/q-ring 0.4.0 → 0.9.1
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 +325 -6
- package/dist/{chunk-IGNU622R.js → chunk-5JBU7TWN.js} +715 -124
- package/dist/chunk-5JBU7TWN.js.map +1 -0
- package/dist/chunk-WG4ZKN7Q.js +1632 -0
- package/dist/chunk-WG4ZKN7Q.js.map +1 -0
- package/dist/{dashboard-32PCZF7D.js → dashboard-JT5ZNLT5.js} +41 -16
- package/dist/dashboard-JT5ZNLT5.js.map +1 -0
- package/dist/{dashboard-HVIQO6NT.js → dashboard-Q5OQRQCX.js} +41 -16
- package/dist/dashboard-Q5OQRQCX.js.map +1 -0
- package/dist/index.js +1213 -39
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +1066 -48
- package/dist/mcp.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-6IQ5SFLI.js +0 -967
- package/dist/chunk-6IQ5SFLI.js.map +0 -1
- package/dist/chunk-IGNU622R.js.map +0 -1
- package/dist/dashboard-32PCZF7D.js.map +0 -1
- package/dist/dashboard-HVIQO6NT.js.map +0 -1
package/README.md
CHANGED
|
@@ -104,15 +104,22 @@ qring health
|
|
|
104
104
|
|
|
105
105
|
### Observer Effect — Audit Everything
|
|
106
106
|
|
|
107
|
-
Every secret read, write, and delete is logged. Access patterns are tracked for anomaly detection.
|
|
107
|
+
Every secret read, write, and delete is logged with a tamper-evident hash chain. Access patterns are tracked for anomaly detection.
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
110
|
# View audit log
|
|
111
111
|
qring audit
|
|
112
112
|
qring audit --key OPENAI_KEY --limit 50
|
|
113
113
|
|
|
114
|
-
# Detect anomalies (burst access, unusual hours)
|
|
114
|
+
# Detect anomalies (burst access, unusual hours, chain tampering)
|
|
115
115
|
qring audit --anomalies
|
|
116
|
+
|
|
117
|
+
# Verify audit chain integrity
|
|
118
|
+
qring audit:verify
|
|
119
|
+
|
|
120
|
+
# Export audit log
|
|
121
|
+
qring audit:export --format json --since 2026-03-01
|
|
122
|
+
qring audit:export --format csv --output audit-report.csv
|
|
116
123
|
```
|
|
117
124
|
|
|
118
125
|
### Quantum Noise — Secret Generation
|
|
@@ -313,6 +320,8 @@ qring hook test <id>
|
|
|
313
320
|
|
|
314
321
|
Hooks are fire-and-forget: a failing hook never blocks secret operations. The hook registry is stored at `~/.config/q-ring/hooks.json`.
|
|
315
322
|
|
|
323
|
+
**SSRF protection:** HTTP hook URLs targeting private/loopback IP ranges (`127.0.0.0/8`, `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `169.254.0.0/16`, `::1`, `fc00::/7`) are blocked by default. DNS resolution is checked before the request is sent. To allow hooks targeting local services (e.g. during development), set the environment variable `Q_RING_ALLOW_PRIVATE_HOOKS=1`.
|
|
324
|
+
|
|
316
325
|
### Configurable Rotation
|
|
317
326
|
|
|
318
327
|
Set a rotation format per secret so the agent auto-rotates with the correct value shape.
|
|
@@ -325,6 +334,266 @@ qring set STRIPE_KEY "sk-..." --rotation-format api-key --rotation-prefix "sk-"
|
|
|
325
334
|
qring set DB_PASS "..." --rotation-format password
|
|
326
335
|
```
|
|
327
336
|
|
|
337
|
+
### Secure Execution & Auto-Redaction
|
|
338
|
+
|
|
339
|
+
Run commands with secrets securely injected into the environment. All known secret values are automatically redacted from stdout and stderr to prevent leaking into terminal logs or agent transcripts. Exec profiles restrict which commands may be run.
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# Execute a deployment script with secrets injected
|
|
343
|
+
qring exec -- npm run deploy
|
|
344
|
+
|
|
345
|
+
# Inject only specific tags
|
|
346
|
+
qring exec --tags backend -- node server.js
|
|
347
|
+
|
|
348
|
+
# Run with a restricted profile (blocks curl/wget/ssh, 30s timeout)
|
|
349
|
+
qring exec --profile restricted -- npm test
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Codebase Secret Scanner
|
|
353
|
+
|
|
354
|
+
Migrating a legacy codebase? Quickly scan directories for hardcoded credentials using regex heuristics and Shannon entropy analysis.
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
# Scan current directory
|
|
358
|
+
qring scan .
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Output:
|
|
362
|
+
```
|
|
363
|
+
✗ src/db/connection.js:12
|
|
364
|
+
Key: DB_PASSWORD
|
|
365
|
+
Entropy: 4.23
|
|
366
|
+
Context: const DB_PASSWORD = "..."
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Composite / Templated Secrets
|
|
370
|
+
|
|
371
|
+
Store complex connection strings that dynamically resolve other secrets. If `DB_PASS` rotates, `DB_URL` is automatically correct without manual updates.
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
qring set DB_USER "admin"
|
|
375
|
+
qring set DB_PASS "supersecret"
|
|
376
|
+
qring set DB_URL "postgres://{{DB_USER}}:{{DB_PASS}}@localhost/mydb"
|
|
377
|
+
|
|
378
|
+
# Resolves embedded templates automatically
|
|
379
|
+
qring get DB_URL
|
|
380
|
+
# Output: postgres://admin:supersecret@localhost/mydb
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### User Approvals (Zero-Trust Agent)
|
|
384
|
+
|
|
385
|
+
Protect sensitive production secrets from being read autonomously by the MCP server without explicit user approval. Each approval token is HMAC-verified, scoped, reasoned, and time-limited.
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
# Mark a secret as requiring approval
|
|
389
|
+
qring set PROD_DB_URL "..." --requires-approval
|
|
390
|
+
|
|
391
|
+
# Temporarily grant MCP access for 1 hour with a reason
|
|
392
|
+
qring approve PROD_DB_URL --for 3600 --reason "deploying v2.0"
|
|
393
|
+
|
|
394
|
+
# List all approvals with verification status
|
|
395
|
+
qring approvals
|
|
396
|
+
|
|
397
|
+
# Revoke an approval
|
|
398
|
+
qring approve PROD_DB_URL --revoke
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Just-In-Time (JIT) Provisioning
|
|
402
|
+
|
|
403
|
+
Instead of storing static credentials, configure `q-ring` to dynamically generate short-lived tokens on the fly when requested (e.g. AWS STS, generic HTTP endpoints).
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
# Store the STS role configuration
|
|
407
|
+
qring set AWS_TEMP_KEYS '{"roleArn":"arn:aws:iam::123:role/AgentRole", "durationSeconds":3600}' --jit-provider aws-sts
|
|
408
|
+
|
|
409
|
+
# Resolving the secret automatically assumes the role and caches the temporary token
|
|
410
|
+
qring get AWS_TEMP_KEYS
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Project Context for AI Agents
|
|
414
|
+
|
|
415
|
+
A safe, redacted overview of the project's secrets, configuration, and state. Designed to be fed into an AI agent's system prompt without ever exposing secret values.
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
# Human-readable summary
|
|
419
|
+
qring context
|
|
420
|
+
|
|
421
|
+
# JSON output (for MCP / programmatic use)
|
|
422
|
+
qring context --json
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Secret-Aware Linter
|
|
426
|
+
|
|
427
|
+
Scan specific files for hardcoded secrets with optional auto-fix. When `--fix` is used, detected secrets are replaced with `process.env.KEY` references and stored in q-ring.
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
# Lint files for hardcoded secrets
|
|
431
|
+
qring lint src/config.ts src/db.ts
|
|
432
|
+
|
|
433
|
+
# Auto-fix: replace hardcoded values and store in q-ring
|
|
434
|
+
qring lint src/config.ts --fix
|
|
435
|
+
|
|
436
|
+
# Scan entire directory with auto-fix
|
|
437
|
+
qring scan . --fix
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Agent Memory
|
|
441
|
+
|
|
442
|
+
Encrypted, persistent key-value store that survives across AI agent sessions. Useful for remembering rotation history, project decisions, or context.
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
# Store a memory
|
|
446
|
+
qring remember last_rotation "Rotated STRIPE_KEY on 2026-03-21"
|
|
447
|
+
|
|
448
|
+
# Retrieve it
|
|
449
|
+
qring recall last_rotation
|
|
450
|
+
|
|
451
|
+
# List all memories
|
|
452
|
+
qring recall
|
|
453
|
+
|
|
454
|
+
# Forget
|
|
455
|
+
qring forget last_rotation
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Pre-Commit Secret Scanning
|
|
459
|
+
|
|
460
|
+
Install a git pre-commit hook that automatically blocks commits containing hardcoded secrets.
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
# Install the hook
|
|
464
|
+
qring hook:install
|
|
465
|
+
|
|
466
|
+
# Uninstall
|
|
467
|
+
qring hook:uninstall
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### Secret Analytics
|
|
471
|
+
|
|
472
|
+
Analyze usage patterns and get optimization suggestions for your secrets.
|
|
473
|
+
|
|
474
|
+
```bash
|
|
475
|
+
qring analyze
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
Output includes most accessed secrets, unused/stale secrets, scope optimization suggestions, and rotation recommendations.
|
|
479
|
+
|
|
480
|
+
### Service Setup Wizard
|
|
481
|
+
|
|
482
|
+
Quickly set up a new service integration with secrets, manifest entries, and hooks in one command.
|
|
483
|
+
|
|
484
|
+
```bash
|
|
485
|
+
# Create secrets for a new Stripe integration
|
|
486
|
+
qring wizard stripe --keys STRIPE_KEY,STRIPE_SECRET --provider stripe --tags payment
|
|
487
|
+
|
|
488
|
+
# With a hook to restart the app on change
|
|
489
|
+
qring wizard myservice --hook-exec "pm2 restart app"
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### Governance Policy
|
|
493
|
+
|
|
494
|
+
Define project-level governance rules in `.q-ring.json` to control which MCP tools can be used, which keys are accessible, and which commands can be executed. Policy is enforced at both the MCP server and keyring level.
|
|
495
|
+
|
|
496
|
+
```bash
|
|
497
|
+
# View the active policy
|
|
498
|
+
qring policy
|
|
499
|
+
|
|
500
|
+
# JSON output
|
|
501
|
+
qring policy --json
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Example policy in `.q-ring.json`:
|
|
505
|
+
|
|
506
|
+
```json
|
|
507
|
+
{
|
|
508
|
+
"policy": {
|
|
509
|
+
"mcp": {
|
|
510
|
+
"denyTools": ["delete_secret"],
|
|
511
|
+
"deniedKeys": ["PROD_DB_PASSWORD"],
|
|
512
|
+
"deniedTags": ["production"]
|
|
513
|
+
},
|
|
514
|
+
"exec": {
|
|
515
|
+
"denyCommands": ["curl", "wget", "ssh"],
|
|
516
|
+
"maxRuntimeSeconds": 30
|
|
517
|
+
},
|
|
518
|
+
"secrets": {
|
|
519
|
+
"requireApprovalForTags": ["production"],
|
|
520
|
+
"maxTtlSeconds": 86400
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### Exec Profiles
|
|
527
|
+
|
|
528
|
+
Restrict command execution with named profiles that control allowed commands, network access, timeouts, and environment sanitization.
|
|
529
|
+
|
|
530
|
+
```bash
|
|
531
|
+
# Run with the "restricted" profile (blocks curl, wget, ssh; 30s timeout)
|
|
532
|
+
qring exec --profile restricted -- npm test
|
|
533
|
+
|
|
534
|
+
# Run with the "ci" profile (5min timeout, allows network)
|
|
535
|
+
qring exec --profile ci -- npm run deploy
|
|
536
|
+
|
|
537
|
+
# Default: unrestricted
|
|
538
|
+
qring exec -- echo "hello"
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
**Built-in profiles:** `unrestricted`, `restricted` (no network tools, 30s limit), `ci` (5min limit, blocks destructive commands).
|
|
542
|
+
|
|
543
|
+
### Tamper-Evident Audit
|
|
544
|
+
|
|
545
|
+
Every audit event includes a SHA-256 hash of the previous event, creating a tamper-evident chain. Verify integrity and export logs in multiple formats.
|
|
546
|
+
|
|
547
|
+
```bash
|
|
548
|
+
# Verify the entire audit chain
|
|
549
|
+
qring audit:verify
|
|
550
|
+
|
|
551
|
+
# Export as JSON
|
|
552
|
+
qring audit:export --format json --since 2026-03-01
|
|
553
|
+
|
|
554
|
+
# Export as CSV
|
|
555
|
+
qring audit:export --format csv --output audit-report.csv
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### Team & Org Scopes
|
|
559
|
+
|
|
560
|
+
Extend beyond `global` and `project` scopes with `team` and `org` scopes for shared secrets across groups. Resolution order: project → team → org → global (most specific wins).
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
# Store a secret in team scope
|
|
564
|
+
qring set SHARED_API_KEY "sk-..." --team my-team
|
|
565
|
+
|
|
566
|
+
# Store in org scope
|
|
567
|
+
qring set ORG_LICENSE "lic-..." --org acme-corp
|
|
568
|
+
|
|
569
|
+
# Resolution cascades: project > team > org > global
|
|
570
|
+
qring get API_KEY --team my-team --org acme-corp
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
### Issuer-Native Rotation
|
|
574
|
+
|
|
575
|
+
Attempt provider-native secret rotation (for providers that support it) or fall back to local generation.
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
# Rotate via the detected provider
|
|
579
|
+
qring rotate STRIPE_KEY
|
|
580
|
+
|
|
581
|
+
# Force a specific provider
|
|
582
|
+
qring rotate API_KEY --provider openai
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### CI Secret Validation
|
|
586
|
+
|
|
587
|
+
Batch-validate all secrets against their providers in a CI-friendly mode. Returns a structured pass/fail report with exit code 1 on failure.
|
|
588
|
+
|
|
589
|
+
```bash
|
|
590
|
+
# Validate all secrets (CI mode)
|
|
591
|
+
qring ci:validate
|
|
592
|
+
|
|
593
|
+
# JSON output for pipeline parsing
|
|
594
|
+
qring ci:validate --json
|
|
595
|
+
```
|
|
596
|
+
|
|
328
597
|
### Agent Mode — Autonomous Monitoring
|
|
329
598
|
|
|
330
599
|
A background daemon that continuously monitors secret health, detects anomalies, and optionally auto-rotates expired secrets.
|
|
@@ -359,7 +628,7 @@ qring status --no-open
|
|
|
359
628
|
|
|
360
629
|
## MCP Server
|
|
361
630
|
|
|
362
|
-
q-ring includes a full MCP server with
|
|
631
|
+
q-ring includes a full MCP server with 44 tools for AI agent integration.
|
|
363
632
|
|
|
364
633
|
### Core Tools
|
|
365
634
|
|
|
@@ -416,15 +685,45 @@ q-ring includes a full MCP server with 31 tools for AI agent integration.
|
|
|
416
685
|
| `list_hooks` | List all registered hooks with match criteria and status |
|
|
417
686
|
| `remove_hook` | Remove a registered hook by ID |
|
|
418
687
|
|
|
688
|
+
### Execution & Scanning Tools
|
|
689
|
+
|
|
690
|
+
| Tool | Description |
|
|
691
|
+
|------|-------------|
|
|
692
|
+
| `exec_with_secrets` | Run a shell command securely with secrets injected, auto-redacted output, and exec profile enforcement |
|
|
693
|
+
| `scan_codebase_for_secrets` | Scan a directory for hardcoded secrets using regex heuristics and entropy analysis |
|
|
694
|
+
| `lint_files` | Lint specific files for hardcoded secrets with optional auto-fix |
|
|
695
|
+
|
|
696
|
+
### AI Agent Tools
|
|
697
|
+
|
|
698
|
+
| Tool | Description |
|
|
699
|
+
|------|-------------|
|
|
700
|
+
| `get_project_context` | Safe, redacted overview of project secrets, environment, manifest, and activity |
|
|
701
|
+
| `agent_remember` | Store a key-value pair in encrypted agent memory (persists across sessions) |
|
|
702
|
+
| `agent_recall` | Retrieve from agent memory, or list all stored keys |
|
|
703
|
+
| `agent_forget` | Delete a key from agent memory |
|
|
704
|
+
| `analyze_secrets` | Usage analytics: most accessed, stale, unused, and rotation recommendations |
|
|
705
|
+
|
|
419
706
|
### Observer & Health Tools
|
|
420
707
|
|
|
421
708
|
| Tool | Description |
|
|
422
709
|
|------|-------------|
|
|
423
710
|
| `audit_log` | Query access history |
|
|
424
711
|
| `detect_anomalies` | Scan for unusual access patterns |
|
|
712
|
+
| `verify_audit_chain` | Verify tamper-evident hash chain integrity |
|
|
713
|
+
| `export_audit` | Export audit events in jsonl, json, or csv format |
|
|
425
714
|
| `health_check` | Full health report |
|
|
715
|
+
| `status_dashboard` | Launch the quantum status dashboard via MCP |
|
|
426
716
|
| `agent_scan` | Run autonomous agent scan |
|
|
427
717
|
|
|
718
|
+
### Governance & Policy Tools
|
|
719
|
+
|
|
720
|
+
| Tool | Description |
|
|
721
|
+
|------|-------------|
|
|
722
|
+
| `check_policy` | Check if an action (tool use, key read, exec) is allowed by project policy |
|
|
723
|
+
| `get_policy_summary` | Get a summary of the project's governance policy configuration |
|
|
724
|
+
| `rotate_secret` | Attempt issuer-native rotation via detected or specified provider |
|
|
725
|
+
| `ci_validate_secrets` | CI-oriented batch validation of all secrets with structured pass/fail report |
|
|
726
|
+
|
|
428
727
|
### Cursor / Kiro Configuration
|
|
429
728
|
|
|
430
729
|
Add to `.cursor/mcp.json` or `.kiro/mcp.json`:
|
|
@@ -490,14 +789,22 @@ qring CLI ─────┐
|
|
|
490
789
|
├──▶ Core Engine ──▶ @napi-rs/keyring ──▶ OS Keyring
|
|
491
790
|
MCP Server ────┘ │
|
|
492
791
|
├── Envelope (quantum metadata)
|
|
493
|
-
├── Scope Resolver (global / project)
|
|
792
|
+
├── Scope Resolver (global / project / team / org)
|
|
494
793
|
├── Collapse (env detection + branchMap globs)
|
|
495
|
-
├── Observer (audit
|
|
794
|
+
├── Observer (tamper-evident audit chain)
|
|
795
|
+
├── Policy (governance-as-code engine)
|
|
496
796
|
├── Noise (secret generation)
|
|
497
797
|
├── Entanglement (cross-secret linking)
|
|
498
|
-
├── Validate (provider-based liveness
|
|
798
|
+
├── Validate (provider-based liveness + rotation)
|
|
499
799
|
├── Hooks (shell/HTTP/signal callbacks)
|
|
500
800
|
├── Import (.env file ingestion)
|
|
801
|
+
├── Exec (profile-restricted injection + redaction)
|
|
802
|
+
├── Scan (codebase entropy heuristics)
|
|
803
|
+
├── Provision (JIT ephemeral credentials)
|
|
804
|
+
├── Approval (HMAC-verified zero-trust tokens)
|
|
805
|
+
├── Context (safe redacted project view)
|
|
806
|
+
├── Linter (secret-aware code scanning)
|
|
807
|
+
├── Memory (encrypted agent persistence)
|
|
501
808
|
├── Tunnel (ephemeral in-memory)
|
|
502
809
|
├── Teleport (encrypted sharing)
|
|
503
810
|
├── Agent (autonomous monitor + rotation)
|
|
@@ -523,6 +830,17 @@ Optional per-project configuration:
|
|
|
523
830
|
"OPENAI_API_KEY": { "required": true, "description": "OpenAI API key", "format": "api-key", "prefix": "sk-", "provider": "openai" },
|
|
524
831
|
"DATABASE_URL": { "required": true, "description": "Postgres connection string", "validationUrl": "https://api.example.com/health" },
|
|
525
832
|
"SENTRY_DSN": { "required": false, "description": "Sentry error tracking" }
|
|
833
|
+
},
|
|
834
|
+
"policy": {
|
|
835
|
+
"mcp": {
|
|
836
|
+
"denyTools": ["delete_secret"],
|
|
837
|
+
"deniedKeys": ["PROD_DB_PASSWORD"],
|
|
838
|
+
"deniedTags": ["production"]
|
|
839
|
+
},
|
|
840
|
+
"exec": {
|
|
841
|
+
"denyCommands": ["curl", "wget"],
|
|
842
|
+
"maxRuntimeSeconds": 60
|
|
843
|
+
}
|
|
526
844
|
}
|
|
527
845
|
}
|
|
528
846
|
```
|
|
@@ -531,6 +849,7 @@ Optional per-project configuration:
|
|
|
531
849
|
- **`secrets`** declares the project's required secrets — use `qring check` to validate, `qring env:generate` to produce a `.env` file
|
|
532
850
|
- **`provider`** associates a liveness validation provider with a secret (e.g., `"openai"`, `"stripe"`, `"github"`) — use `qring validate` to test
|
|
533
851
|
- **`validationUrl`** configures the generic HTTP provider's endpoint for custom validation
|
|
852
|
+
- **`policy`** defines governance rules for MCP tool gating, key access restrictions, exec allowlists, and secret lifecycle requirements
|
|
534
853
|
|
|
535
854
|
## 📜 License
|
|
536
855
|
|