opena2a-cli 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +280 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,280 @@
1
+ <div align="center">
2
+
3
+ # opena2a-cli
4
+
5
+ **Open-source security platform for AI agents**
6
+
7
+ Credential detection, scope drift analysis, config integrity, runtime monitoring, and supply chain verification -- one CLI.
8
+
9
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/opena2a-org/opena2a/blob/main/LICENSE)
10
+ [![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg)]()
11
+ [![npm](https://img.shields.io/npm/v/opena2a-cli.svg)](https://www.npmjs.com/package/opena2a-cli)
12
+
13
+ [Website](https://opena2a.org) | [Docs](https://opena2a.org/docs) | [Registry](https://registry.opena2a.org) | [Discord](https://discord.gg/uRZa3KXgEn) | [GitHub](https://github.com/opena2a-org/opena2a)
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ # Try without installing
23
+ npx opena2a-cli init
24
+
25
+ # Install globally
26
+ npm install -g opena2a-cli
27
+
28
+ # Homebrew (macOS/Linux)
29
+ brew tap opena2a-org/tap && brew install opena2a
30
+ ```
31
+
32
+ No configuration required. Works with Node.js, Python, Go, and MCP server projects.
33
+
34
+ ## What It Does
35
+
36
+ Run `opena2a init` in any project directory to get an instant security assessment:
37
+
38
+ ```
39
+ OpenA2A Security Initialization v0.1.0
40
+
41
+ Project myapp v2.1.0
42
+ Type Node.js + MCP server
43
+ Directory /home/user/myapp
44
+
45
+ Security Posture
46
+ -----------------------------------------------
47
+ Credential scan 3 findings
48
+ .gitignore present
49
+ .env protection NOT in .gitignore
50
+ Lock file package-lock.json
51
+ Security config none
52
+ MCP config found
53
+ -----------------------------------------------
54
+ Trust Score 30 / 100 [Grade: F]
55
+
56
+ Next Steps
57
+ -----------------------------------------------
58
+ [CRITICAL] Migrate 3 hardcoded credentials
59
+ opena2a protect
60
+
61
+ [HIGH] Add .env to .gitignore
62
+ echo '.env' >> .gitignore
63
+
64
+ [MEDIUM] Sign config files for integrity
65
+ opena2a guard sign
66
+ -----------------------------------------------
67
+
68
+ Scope Drift Detected
69
+ -----------------------------------------------
70
+ DRIFT-001 Google Maps key may access Gemini AI
71
+ src/config.js:5
72
+
73
+ Scope drift: keys provisioned for one service silently
74
+ gain access to AI services, expanding attack surface.
75
+ Run: opena2a protect
76
+ ```
77
+
78
+ Then fix what it finds:
79
+
80
+ ```bash
81
+ opena2a protect # Migrate credentials to env vars + vault
82
+ opena2a guard sign # Sign config files for tamper detection
83
+ opena2a init # Re-assess -- watch your score improve
84
+ ```
85
+
86
+ ## Scope Drift Detection
87
+
88
+ API keys provisioned for one service often silently grant access to others. A Google Maps key can call Gemini. An AWS S3 key may reach Bedrock.
89
+
90
+ OpenA2A detects these cross-service privilege escalations:
91
+
92
+ | Finding | What It Means |
93
+ |---------|---------------|
94
+ | **DRIFT-001** | Google API key can access Gemini AI models beyond intended Maps/Places scope |
95
+ | **DRIFT-002** | AWS access key can invoke Bedrock LLM models beyond intended S3/EC2 scope |
96
+
97
+ When drift is detected, `opena2a protect` migrates the key to environment variables and creates a deny-all broker policy so you can explicitly control which services each key is allowed to reach.
98
+
99
+ ## Core Commands
100
+
101
+ ### `opena2a init`
102
+
103
+ Assess your project's security posture. Detects project type, scans for credentials, checks hygiene (`.gitignore`, `.env` protection, lock file, security config), calculates a trust score (0-100), and provides prioritized next steps.
104
+
105
+ ```bash
106
+ opena2a init # Assess current directory
107
+ opena2a init --dir ./my-agent # Assess specific directory
108
+ opena2a init --verbose # Show individual credential details
109
+ opena2a init --format json # Machine-readable output for CI
110
+ ```
111
+
112
+ ### `opena2a protect`
113
+
114
+ Detect hardcoded credentials and migrate them to environment variables. Supports Anthropic, OpenAI, Google, AWS, GitHub, and generic API key patterns. Language-aware replacements for JS/TS, Python, Go, Ruby, Java, and Rust.
115
+
116
+ ```bash
117
+ opena2a protect # Scan and migrate credentials
118
+ opena2a protect --dry-run # Preview changes without modifying files
119
+ opena2a protect --report out.html # Generate interactive HTML report
120
+ opena2a protect --format json # JSON output for CI pipelines
121
+ ```
122
+
123
+ Migration flow:
124
+ 1. **Detect** -- Regex-based pattern matching across all source files
125
+ 2. **Store** -- Save credential values in Secretless vault (or `.env` fallback with 0600 permissions)
126
+ 3. **Replace** -- Swap hardcoded values with language-appropriate env var references
127
+ 4. **Verify** -- Re-scan to confirm all credentials are removed from source
128
+
129
+ ### `opena2a guard`
130
+
131
+ Config file integrity protection. Sign your config files and detect unauthorized modifications.
132
+
133
+ ```bash
134
+ opena2a guard sign # Sign all detected config files (SHA-256)
135
+ opena2a guard verify # Check for tampering or unsigned files
136
+ opena2a guard status # Show signature summary
137
+ ```
138
+
139
+ Default files: `mcp.json`, `package.json`, `tsconfig.json`, `arp.yaml`, `go.mod`, `Dockerfile`, and more.
140
+
141
+ ### `opena2a runtime`
142
+
143
+ Agent Runtime Protection (ARP) wrapper. Monitor process, network, and filesystem activity.
144
+
145
+ ```bash
146
+ opena2a runtime init # Generate arp.yaml for your project
147
+ opena2a runtime start # Start monitoring
148
+ opena2a runtime status # Show monitor/interceptor status
149
+ opena2a runtime tail # View recent security events
150
+ ```
151
+
152
+ ### `opena2a verify`
153
+
154
+ Binary integrity verification. Compares installed package hashes against the OpenA2A Trust Registry to detect supply chain tampering.
155
+
156
+ ```bash
157
+ opena2a verify # Check all OpenA2A packages
158
+ opena2a verify --package hackmyagent # Check specific package
159
+ ```
160
+
161
+ ### `opena2a self-register`
162
+
163
+ Register OpenA2A tools in the public Trust Registry with security scan results.
164
+
165
+ ```bash
166
+ opena2a self-register --dry-run # Preview what would be registered
167
+ opena2a self-register # Register all 13 tools
168
+ ```
169
+
170
+ ### `opena2a config`
171
+
172
+ Manage user preferences and feature toggles.
173
+
174
+ ```bash
175
+ opena2a config show # Display current configuration
176
+ opena2a config contribute on # Enable community data sharing
177
+ opena2a config llm on # Enable LLM-powered command matching
178
+ ```
179
+
180
+ ## Smart Input Modes
181
+
182
+ The CLI includes built-in intelligence for command discovery:
183
+
184
+ ```bash
185
+ opena2a # Interactive guided wizard
186
+ opena2a ~drift # Semantic search (finds protect, init)
187
+ opena2a ~api keys # Semantic search with domain expansion
188
+ opena2a ? # Context-aware recommendations
189
+ opena2a "find leaked credentials" # Natural language matching
190
+ ```
191
+
192
+ Semantic search uses a weighted index of tags, synonyms, and domains -- no API calls required. Natural language mode falls back to Claude Haiku when static matching is insufficient (opt-in, costs ~$0.0002 per query).
193
+
194
+ ## Adapter Commands
195
+
196
+ The CLI orchestrates these specialized tools through a unified interface:
197
+
198
+ | Command | Tool | Description |
199
+ |---------|------|-------------|
200
+ | `opena2a scan` | [HackMyAgent](https://github.com/opena2a-org/hackmyagent) | 150+ security checks, attack simulation, auto-fix |
201
+ | `opena2a secrets` | [Secretless AI](https://github.com/opena2a-org/secretless-ai) | Credential management for AI coding tools |
202
+ | `opena2a benchmark` | [OASB](https://github.com/opena2a-org/oasb) | 222 attack scenarios, compliance scoring |
203
+ | `opena2a registry` | [AI Trust](https://github.com/opena2a-org/ai-trust) | Trust Registry queries, package verification |
204
+ | `opena2a train` | [DVAA](https://github.com/opena2a-org/damn-vulnerable-ai-agent) | Vulnerable AI agent for training |
205
+ | `opena2a crypto` | [CryptoServe](https://github.com/ecolibria/crypto-serve) | Cryptographic inventory, PQC readiness |
206
+ | `opena2a identity` | [AIM](https://github.com/opena2a-org/agent-identity-management) | Agent identity management |
207
+ | `opena2a broker` | Secretless AI | Identity-aware credential broker daemon |
208
+ | `opena2a dlp` | Secretless AI | Data loss prevention for AI tool transcripts |
209
+
210
+ Adapters install tools on first use. Each tool works standalone or through the CLI.
211
+
212
+ ## CI/CD Integration
213
+
214
+ All commands support `--format json` and `--ci` flags for pipeline integration:
215
+
216
+ ```yaml
217
+ # GitHub Actions example
218
+ - name: Security assessment
219
+ run: npx opena2a-cli init --ci --format json > security-report.json
220
+
221
+ - name: Credential check
222
+ run: |
223
+ npx opena2a-cli protect --dry-run --ci --format json > cred-report.json
224
+ # Fail if credentials found
225
+ jq -e '.totalFound == 0' cred-report.json
226
+
227
+ - name: Config integrity
228
+ run: npx opena2a-cli guard verify --ci
229
+ ```
230
+
231
+ ## Output Formats
232
+
233
+ | Format | Flag | Use Case |
234
+ |--------|------|----------|
235
+ | Text | `--format text` (default) | Human-readable terminal output |
236
+ | JSON | `--format json` | CI pipelines, programmatic consumption |
237
+ | HTML | `--report <path>` | Interactive report with filtering (protect command) |
238
+
239
+ ## Credential Patterns
240
+
241
+ Detected credential types and their finding IDs:
242
+
243
+ | ID | Pattern | Severity |
244
+ |----|---------|----------|
245
+ | CRED-001 | Anthropic API Key (`sk-ant-api*`) | Critical |
246
+ | CRED-002 | OpenAI API Key (`sk-*`, `sk-proj-*`, `sk-test-*`) | Critical |
247
+ | CRED-003 | GitHub Token (`ghp_*`, `ghs_*`) | High |
248
+ | CRED-004 | Generic API Key in assignment | Medium |
249
+ | DRIFT-001 | Google API Key with Gemini drift (`AIza*`) | High |
250
+ | DRIFT-002 | AWS Access Key with Bedrock drift (`AKIA*`) | High |
251
+
252
+ Language-aware replacements:
253
+
254
+ | Language | Replacement |
255
+ |----------|-------------|
256
+ | JavaScript/TypeScript | `process.env.VAR_NAME` |
257
+ | Python | `os.environ.get('VAR_NAME')` |
258
+ | Go | `os.Getenv("VAR_NAME")` |
259
+ | Ruby | `ENV['VAR_NAME']` |
260
+ | Java/Kotlin | `System.getenv("VAR_NAME")` |
261
+ | Rust | `std::env::var("VAR_NAME").unwrap_or_default()` |
262
+ | YAML/TOML/JSON | `${VAR_NAME}` |
263
+
264
+ ## Requirements
265
+
266
+ - Node.js >= 18
267
+ - Optional: Docker (for `opena2a train`)
268
+ - Optional: Python 3.9+ (for `opena2a crypto`)
269
+
270
+ ## License
271
+
272
+ Apache-2.0
273
+
274
+ ---
275
+
276
+ <div align="center">
277
+
278
+ [Report an Issue](https://github.com/opena2a-org/opena2a/issues) | [Contribute](https://github.com/opena2a-org/opena2a/blob/main/CONTRIBUTING.md)
279
+
280
+ </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opena2a-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Unified CLI for the OpenA2A security platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",