prismor-cli 1.3.0__py3-none-any.whl
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.
- prismor/__init__.py +6 -0
- prismor/api.py +770 -0
- prismor/cli.py +1305 -0
- prismor/cli_config.py +55 -0
- prismor/local_fix.py +338 -0
- prismor/sanitize.py +179 -0
- prismor_cli-1.3.0.dist-info/METADATA +919 -0
- prismor_cli-1.3.0.dist-info/RECORD +12 -0
- prismor_cli-1.3.0.dist-info/WHEEL +5 -0
- prismor_cli-1.3.0.dist-info/entry_points.txt +2 -0
- prismor_cli-1.3.0.dist-info/licenses/LICENSE +22 -0
- prismor_cli-1.3.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,919 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prismor-cli
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: A CLI tool for scanning GitHub repositories for vulnerabilities, secrets, and generating SBOMs
|
|
5
|
+
Home-page: https://github.com/PrismorSec/prismor-cli
|
|
6
|
+
Author: Prismor
|
|
7
|
+
Author-email: support@prismor.dev
|
|
8
|
+
Project-URL: Bug Reports, https://github.com/PrismorSec/prismor-cli/issues
|
|
9
|
+
Project-URL: Source, https://github.com/PrismorSec/prismor-cli
|
|
10
|
+
Project-URL: Documentation, https://docs.prismor.dev
|
|
11
|
+
Project-URL: Homepage, https://prismor.dev
|
|
12
|
+
Keywords: security scanning vulnerability sbom secrets github
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Topic :: Security
|
|
16
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Requires-Python: >=3.7
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: click>=8.0.0
|
|
29
|
+
Requires-Dist: requests>=2.25.0
|
|
30
|
+
Requires-Dist: rich>=13.0.0
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: description-content-type
|
|
36
|
+
Dynamic: home-page
|
|
37
|
+
Dynamic: keywords
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: project-url
|
|
40
|
+
Dynamic: requires-dist
|
|
41
|
+
Dynamic: requires-python
|
|
42
|
+
Dynamic: summary
|
|
43
|
+
|
|
44
|
+
# Prismor CLI
|
|
45
|
+
|
|
46
|
+
A powerful command-line tool for scanning GitHub repositories for security vulnerabilities, secrets, and generating Software Bill of Materials (SBOM). Now with **AI-powered auto-fix** — let Prismor open a pull request that patches your vulnerabilities automatically.
|
|
47
|
+
|
|
48
|
+
**Get started at [https://prismor.dev](https://prismor.dev)** - Sign up for free to get your API key and access full dashboarding and analysis features!
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
- 🔍 **Vulnerability Scanning (scan)** - Detect security vulnerabilities in your codebase
|
|
53
|
+
- 🔐 **Secret Detection** - Find exposed secrets, API keys, and credentials
|
|
54
|
+
- 📦 **SBOM Generation** - Generate comprehensive Software Bill of Materials
|
|
55
|
+
- ⚡ **Full Scan** - Run all security checks in one command
|
|
56
|
+
- 🤖 **AI Auto-Fix** - Automatically open a PR that patches detected vulnerabilities
|
|
57
|
+
- 🎨 **Beautiful CLI Output** - Colorful, easy-to-read results
|
|
58
|
+
- 🔗 **Flexible Repository Input** - Support for multiple GitHub URL formats including SSH, HTTPS, and bare domain formats
|
|
59
|
+
|
|
60
|
+
## Quick Start
|
|
61
|
+
|
|
62
|
+
1. **Sign up** at [https://prismor.dev](https://prismor.dev)
|
|
63
|
+
2. **Generate your API Key** from the dashboard
|
|
64
|
+
3. **Install** the CLI: `pip install prismor`
|
|
65
|
+
4. **Set your API key**: `export PRISMOR_API_KEY=your_api_key`
|
|
66
|
+
5. **Run your first scan**: `prismor --repo username/repo --fullscan`
|
|
67
|
+
|
|
68
|
+
For the complete analysis with dashboards and reports, visit [Prismor.dev](https://prismor.dev) after running scans!
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
Install Prismor CLI via pip:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install prismor
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Prerequisites
|
|
79
|
+
|
|
80
|
+
### Getting Your API Key
|
|
81
|
+
|
|
82
|
+
Before using Prismor CLI, you need to get your API key from [Prismor.dev](https://prismor.dev):
|
|
83
|
+
|
|
84
|
+
1. Visit [https://prismor.dev](https://prismor.dev)
|
|
85
|
+
2. **Sign up** for a free account
|
|
86
|
+
3. Navigate to your dashboard
|
|
87
|
+
4. **Generate an API Key**
|
|
88
|
+
5. Copy your API key
|
|
89
|
+
|
|
90
|
+
### Setting Up Your API Key
|
|
91
|
+
|
|
92
|
+
Once you have your API key, set it as an environment variable:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
export PRISMOR_API_KEY=your_api_key_here
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
To make this permanent, add it to your shell configuration file (`~/.bashrc`, `~/.zshrc`, etc.):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
echo 'export PRISMOR_API_KEY=your_api_key_here' >> ~/.zshrc
|
|
102
|
+
source ~/.zshrc
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Private Repositories
|
|
106
|
+
|
|
107
|
+
To scan **private repositories**, you need to integrate your GitHub account:
|
|
108
|
+
|
|
109
|
+
1. Go to [Prismor.dev](https://prismor.dev)
|
|
110
|
+
2. Navigate to **Settings** or **Integrations**
|
|
111
|
+
3. **Connect your GitHub account**
|
|
112
|
+
4. Authorize Prismor to access your private repositories
|
|
113
|
+
|
|
114
|
+
This allows Prismor to securely access and scan your private repositories.
|
|
115
|
+
|
|
116
|
+
## Usage
|
|
117
|
+
|
|
118
|
+
### Basic Syntax
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
prismor --repo <repository> [scan-type]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Note**: The `--scan` flag is used to enable vulnerability scanning, while `--repo` specifies the repository to scan.
|
|
125
|
+
|
|
126
|
+
### Repository Format
|
|
127
|
+
|
|
128
|
+
Prismor CLI supports multiple GitHub repository URL formats for maximum flexibility:
|
|
129
|
+
|
|
130
|
+
#### 1. **Username/Repository format** (recommended):
|
|
131
|
+
```bash
|
|
132
|
+
prismor --repo Ar9av/trychai-web-revamped --fullscan
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### 2. **HTTPS URLs**:
|
|
136
|
+
```bash
|
|
137
|
+
prismor --repo https://github.com/Ar9av/trychai-web-revamped --fullscan
|
|
138
|
+
prismor --repo https://www.github.com/Ar9av/trychai-web-revamped --fullscan
|
|
139
|
+
prismor --repo https://github.com/Ar9av/trychai-web-revamped.git --fullscan
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### 3. **HTTP URLs**:
|
|
143
|
+
```bash
|
|
144
|
+
prismor --repo http://github.com/Ar9av/trychai-web-revamped --fullscan
|
|
145
|
+
prismor --repo http://www.github.com/Ar9av/trychai-web-revamped --fullscan
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### 4. **Bare domain formats**:
|
|
149
|
+
```bash
|
|
150
|
+
prismor --repo github.com/Ar9av/trychai-web-revamped --fullscan
|
|
151
|
+
prismor --repo www.github.com/Ar9av/trychai-web-revamped --fullscan
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### 5. **SSH format**:
|
|
155
|
+
```bash
|
|
156
|
+
prismor --repo git@github.com:Ar9av/trychai-web-revamped.git --fullscan
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### 6. **URLs with paths and fragments**:
|
|
160
|
+
```bash
|
|
161
|
+
prismor --repo https://github.com/Ar9av/trychai-web-revamped/tree/main --fullscan
|
|
162
|
+
prismor --repo https://github.com/Ar9av/trychai-web-revamped/blob/main/file.py --fullscan
|
|
163
|
+
prismor --repo https://github.com/Ar9av/trychai-web-revamped#branch --fullscan
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**All formats are automatically parsed and normalized to extract the `user/repo_name` format for processing.**
|
|
167
|
+
|
|
168
|
+
### Smart URL Parsing
|
|
169
|
+
|
|
170
|
+
Prismor CLI features intelligent GitHub URL parsing that automatically:
|
|
171
|
+
|
|
172
|
+
- ✅ **Detects and extracts** repository information from any supported format
|
|
173
|
+
- ✅ **Handles edge cases** like trailing slashes, `.git` suffixes, and branch references
|
|
174
|
+
- ✅ **Validates input** to ensure it's a valid GitHub repository
|
|
175
|
+
- ✅ **Provides clear error messages** for unsupported formats
|
|
176
|
+
- ✅ **Supports special characters** in repository names (hyphens, underscores, numbers)
|
|
177
|
+
|
|
178
|
+
**Examples of what gets automatically parsed:**
|
|
179
|
+
```bash
|
|
180
|
+
# All of these resolve to "facebook/react":
|
|
181
|
+
prismor --repo facebook/react --scan
|
|
182
|
+
prismor --repo https://github.com/facebook/react --scan
|
|
183
|
+
prismor --repo git@github.com:facebook/react.git --scan
|
|
184
|
+
prismor --repo github.com/facebook/react --scan
|
|
185
|
+
prismor --repo https://github.com/facebook/react/tree/main --scan
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Scan Types
|
|
189
|
+
|
|
190
|
+
#### 1. Vulnerability Scanning (scan)
|
|
191
|
+
|
|
192
|
+
Scan for security vulnerabilities in your dependencies and code:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
prismor --repo myrepository --scan
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Note**: Vulnerability scans now run asynchronously for large repositories. The CLI will wait for completion automatically, but you can also use `prismor start-scan` to get a job ID and check status separately.
|
|
199
|
+
|
|
200
|
+
#### 2. Secret Detection
|
|
201
|
+
|
|
202
|
+
Detect exposed secrets, API keys, passwords, and other sensitive information:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
prismor --repo myrepository --detect-secret
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### 3. SBOM Generation
|
|
209
|
+
|
|
210
|
+
Generate a Software Bill of Materials for your repository:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
prismor --repo myrepository --sbom
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### 4. Full Scan
|
|
217
|
+
|
|
218
|
+
Run all security checks (scan + Secret Detection + SBOM):
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
prismor --repo myrepository --fullscan
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### 5. AI Auto-Fix
|
|
225
|
+
|
|
226
|
+
Scan and immediately trigger an AI agent to open a pull request with fixes:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
prismor --repo myrepository --scan --fix
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
The `--fix` flag runs a vulnerability scan first, then hands the results to Prismor's AI agent which opens a PR with dependency updates and security patches. Use `prismor fix-status <job_id>` to track progress.
|
|
233
|
+
|
|
234
|
+
#### 6. Local AI Auto-Fix (your own infrastructure)
|
|
235
|
+
|
|
236
|
+
Prefer to keep your source code and credentials on your own machine? `prismor fix-local`
|
|
237
|
+
applies the fixes **locally** instead of in Prismor's cloud. Scanning still runs in the
|
|
238
|
+
cloud, but the fix is performed by a coding agent you already have installed
|
|
239
|
+
(**Claude Code**, **Codex**, …) using **your own LLM credits**, editing your **local
|
|
240
|
+
checkout**. Your code and GitHub token never leave your machine, and Prismor's hosted
|
|
241
|
+
fix agent is not invoked.
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# 1. Scan in the cloud and save the findings
|
|
245
|
+
prismor --repo username/repo --scan -o findings.json
|
|
246
|
+
|
|
247
|
+
# 2. Fix locally with your own agent, in your current checkout
|
|
248
|
+
cd ~/code/repo
|
|
249
|
+
prismor fix-local --results findings.json
|
|
250
|
+
|
|
251
|
+
# Or pull findings straight from a completed scan job:
|
|
252
|
+
prismor fix-local . --from-scan <job_id>
|
|
253
|
+
|
|
254
|
+
# Preview the prompt without changing anything:
|
|
255
|
+
prismor fix-local --results findings.json --dry-run
|
|
256
|
+
|
|
257
|
+
# Work on a dedicated branch, non-interactively (CI):
|
|
258
|
+
prismor fix-local . --results findings.json --branch security-fixes --yes
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Cloud (`--fix`) vs. local (`fix-local`):**
|
|
262
|
+
|
|
263
|
+
| | `--fix` (cloud) | `fix-local` (your machine) |
|
|
264
|
+
|---|---|---|
|
|
265
|
+
| Where the fix runs | Prismor's hosted agent | Your installed agent (Claude Code / Codex) |
|
|
266
|
+
| LLM credits | Prismor's | **Yours** |
|
|
267
|
+
| Source code leaves machine | Yes (to scan + fix) | Only for the scan; the fix is local |
|
|
268
|
+
| GitHub token | Sent to Prismor | **Stays local** |
|
|
269
|
+
| Output | A pull request | Edits in your working tree / branch |
|
|
270
|
+
| `PRISMOR_API_KEY` | Required | Only for `--from-scan` |
|
|
271
|
+
|
|
272
|
+
**Options:**
|
|
273
|
+
|
|
274
|
+
| Option | Description |
|
|
275
|
+
|---|---|
|
|
276
|
+
| `PATH` | Local checkout to fix (default: current directory). |
|
|
277
|
+
| `--results FILE` | Findings JSON from `prismor --scan -o FILE`. Use `-` for stdin. |
|
|
278
|
+
| `--from-scan JOB_ID` | Pull findings from a completed cloud scan job. |
|
|
279
|
+
| `--agent auto\|claude\|codex` | Which installed agent to drive (default: auto-detect). |
|
|
280
|
+
| `--instruction TEXT` | Extra instruction appended to the fix prompt. |
|
|
281
|
+
| `--branch NAME` | Create & switch to a local git branch before fixing. |
|
|
282
|
+
| `--dry-run` | Print the resolved agent and prompt, then exit. |
|
|
283
|
+
| `-y, --yes` | Skip the confirmation prompt (required for non-interactive use). |
|
|
284
|
+
|
|
285
|
+
Don't have Claude Code or Codex? Point Prismor at any agent with a `{prompt}`
|
|
286
|
+
placeholder via an environment variable:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
export PRISMOR_LOCAL_AGENT_CMD='aider --yes --message {prompt}'
|
|
290
|
+
prismor fix-local --results findings.json
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Multiple Scan Types
|
|
294
|
+
|
|
295
|
+
You can combine multiple scan types:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
prismor --repo myrepository --scan --detect-secret
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### JSON Output
|
|
302
|
+
|
|
303
|
+
Get results in JSON format for automation and integration:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
prismor --repo myrepository --fullscan --json
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Examples
|
|
310
|
+
|
|
311
|
+
### Example 1: Quick Vulnerability Scan (Username/Repo format)
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
prismor --repo facebook/react --scan
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Example 2: Comprehensive Security Audit (HTTPS URL)
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
prismor --repo https://github.com/microsoft/vscode --fullscan
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Example 3: Secret Detection with SSH URL
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
prismor --repo git@github.com:openai/gpt-3.git --detect-secret
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Example 4: SBOM Generation with Bare Domain
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
prismor --repo github.com/kubernetes/kubernetes --sbom --json > sbom-results.json
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Example 5: Full Scan with Branch Reference
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
prismor --repo https://github.com/tensorflow/tensorflow/tree/v2.13.0 --fullscan
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Example 6: Multiple Scan Types with Different URL Formats
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# Using HTTPS URL
|
|
345
|
+
prismor --repo https://github.com/pytorch/pytorch --scan --sbom
|
|
346
|
+
|
|
347
|
+
# Using SSH URL
|
|
348
|
+
prismor --repo git@github.com:nodejs/node.git --detect-secret --sbom
|
|
349
|
+
|
|
350
|
+
# Using bare domain
|
|
351
|
+
prismor --repo www.github.com/vercel/next.js --fullscan
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Example 7: Save Results to File
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
# Save full scan results to JSON file
|
|
358
|
+
prismor --repo username/repo --fullscan --output results.json
|
|
359
|
+
|
|
360
|
+
# Save vulnerability scan with specific branch
|
|
361
|
+
prismor --repo username/repo --scan --branch develop --output vuln-scan.json
|
|
362
|
+
|
|
363
|
+
# Quiet mode with file output (no console output)
|
|
364
|
+
prismor --repo username/repo --sbom --output sbom.json --quiet
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Example 8: CI/CD Integration
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# Minimal output for CI/CD pipelines
|
|
371
|
+
prismor --repo $REPO_NAME --scan --quiet --json > scan-results.json
|
|
372
|
+
|
|
373
|
+
# Exit with error code if scan fails
|
|
374
|
+
prismor --repo username/repo --fullscan --quiet || exit 1
|
|
375
|
+
|
|
376
|
+
# Save results and continue pipeline
|
|
377
|
+
prismor --repo username/repo --scan --output scan.json --quiet && \
|
|
378
|
+
echo "Scan completed, results saved to scan.json"
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Example 7: AI Auto-Fix
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
# Scan and auto-fix in one step
|
|
385
|
+
prismor --repo username/repo --scan --fix
|
|
386
|
+
|
|
387
|
+
# Or trigger a fix directly (skip the scan)
|
|
388
|
+
prismor trigger-fix username/repo --branch main
|
|
389
|
+
|
|
390
|
+
# Poll until the PR is ready
|
|
391
|
+
prismor fix-status agent_cli_1234567890_abc123 --wait
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Example 9: Async Scan with Status Checking
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
# Start a scan and get job ID
|
|
398
|
+
prismor start-scan username/repo --branch main
|
|
399
|
+
|
|
400
|
+
# Check scan status (use job ID from previous command)
|
|
401
|
+
prismor scan-status <job_id>
|
|
402
|
+
|
|
403
|
+
# Check status with JSON output
|
|
404
|
+
prismor scan-status <job_id> --json
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
## Additional Commands
|
|
408
|
+
|
|
409
|
+
### AI Auto-Fix
|
|
410
|
+
|
|
411
|
+
Prismor's AI agent analyzes your vulnerabilities and opens a pull request with patches — no manual work required. Your GitHub account must be connected at [prismor.dev/dashboard](https://prismor.dev/dashboard).
|
|
412
|
+
|
|
413
|
+
#### Scan + fix in one command
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
prismor --repo username/repo --scan --fix
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
#### Trigger a fix without scanning first
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
# Fix with default instruction
|
|
423
|
+
prismor trigger-fix username/repo
|
|
424
|
+
|
|
425
|
+
# Fix a specific branch
|
|
426
|
+
prismor trigger-fix username/repo --branch develop
|
|
427
|
+
|
|
428
|
+
# Provide a custom instruction for the AI agent
|
|
429
|
+
prismor trigger-fix username/repo --instruction "Upgrade lodash to 4.17.21 and patch all related CVEs"
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
#### Check fix job status
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
# Print current status
|
|
436
|
+
prismor fix-status <job_id>
|
|
437
|
+
|
|
438
|
+
# Block until the PR is created (up to 30 min)
|
|
439
|
+
prismor fix-status <job_id> --wait
|
|
440
|
+
|
|
441
|
+
# JSON output
|
|
442
|
+
prismor fix-status <job_id> --json
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
**Example output:**
|
|
446
|
+
```
|
|
447
|
+
============================================================
|
|
448
|
+
Fix Job Status
|
|
449
|
+
============================================================
|
|
450
|
+
|
|
451
|
+
Job ID: agent_cli_1234567890_abc123
|
|
452
|
+
Status: success
|
|
453
|
+
|
|
454
|
+
Pull Request: https://github.com/username/repo/pull/42
|
|
455
|
+
Branch: prismor-fix/dep-updates-1234567890
|
|
456
|
+
Files Changed: 2
|
|
457
|
+
|
|
458
|
+
Summary: Upgraded keyv from 4.x to 5.6.0 and added a compatibility
|
|
459
|
+
adapter for cacheable-request.
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
### Start Async Vulnerability Scan
|
|
465
|
+
|
|
466
|
+
Start a vulnerability scan asynchronously and get a job ID for status checking:
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
prismor start-scan username/repo
|
|
470
|
+
prismor start-scan username/repo --branch develop
|
|
471
|
+
prismor start-scan username/repo --token ghp_xxxxx
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
**Note**: Requires GitHub token. Set `GITHUB_TOKEN` environment variable or use `--token` option.
|
|
475
|
+
|
|
476
|
+
### Check Scan Status
|
|
477
|
+
|
|
478
|
+
Check the status of a running or completed vulnerability scan:
|
|
479
|
+
|
|
480
|
+
```bash
|
|
481
|
+
prismor scan-status <job_id>
|
|
482
|
+
prismor scan-status <job_id> --json
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
**Status Response Includes**:
|
|
486
|
+
- Job status (running/completed/failed)
|
|
487
|
+
- Repository and branch information
|
|
488
|
+
- Results URLs (public and presigned)
|
|
489
|
+
- Vulnerability summary with severity breakdown
|
|
490
|
+
- Scan date and duration
|
|
491
|
+
|
|
492
|
+
**Example Output**:
|
|
493
|
+
```
|
|
494
|
+
============================================================
|
|
495
|
+
Scan Status
|
|
496
|
+
============================================================
|
|
497
|
+
|
|
498
|
+
Job ID: abc123def456...
|
|
499
|
+
|
|
500
|
+
Status: completed
|
|
501
|
+
|
|
502
|
+
Repository:
|
|
503
|
+
https://github.com/username/repo
|
|
504
|
+
|
|
505
|
+
Branch:
|
|
506
|
+
main
|
|
507
|
+
|
|
508
|
+
Vulnerability Summary:
|
|
509
|
+
Total Vulnerabilities: 15
|
|
510
|
+
Total Targets Scanned: 3
|
|
511
|
+
|
|
512
|
+
Severity Breakdown:
|
|
513
|
+
CRITICAL: 2
|
|
514
|
+
HIGH: 5
|
|
515
|
+
MEDIUM: 6
|
|
516
|
+
LOW: 2
|
|
517
|
+
|
|
518
|
+
Results URL:
|
|
519
|
+
https://prismor-sbom-public-dev.s3.amazonaws.com/...
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### Check Configuration
|
|
523
|
+
|
|
524
|
+
View your current Prismor CLI configuration:
|
|
525
|
+
|
|
526
|
+
```bash
|
|
527
|
+
prismor config
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### Version Information
|
|
531
|
+
|
|
532
|
+
Display the version of Prismor CLI:
|
|
533
|
+
|
|
534
|
+
```bash
|
|
535
|
+
prismor version
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
Or:
|
|
539
|
+
|
|
540
|
+
```bash
|
|
541
|
+
prismor --version
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### Help
|
|
545
|
+
|
|
546
|
+
Get help and see all available options:
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
prismor --help
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
## Organization & Policy
|
|
553
|
+
|
|
554
|
+
Manage your organization's runtime security policy **as code** and inspect your team from the terminal or CI. Reads work with any API key; **publishing policy requires an admin-scoped key** (see the note below).
|
|
555
|
+
|
|
556
|
+
### Select an organization
|
|
557
|
+
|
|
558
|
+
```bash
|
|
559
|
+
prismor org list # orgs you belong to (★ = active)
|
|
560
|
+
prismor org switch <slug> # set the active org (scans/fixes/policy target it)
|
|
561
|
+
prismor org current
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
### Policy as code
|
|
565
|
+
|
|
566
|
+
Pull the active org policy to a file, version-control and review it, then apply it. `apply` is signed server-side and enrolled devices pick it up within ~30s. The policy is YAML (see the policy authoring guide at https://prismor.dev/docs/policy).
|
|
567
|
+
|
|
568
|
+
```bash
|
|
569
|
+
prismor policy show # print the active policy (version + YAML)
|
|
570
|
+
prismor policy pull -o policy.yaml # export for version control / editing
|
|
571
|
+
prismor policy lint policy.yaml # validate against the non-weakening floor
|
|
572
|
+
prismor policy apply policy.yaml # publish (prompts to confirm)
|
|
573
|
+
prismor policy apply policy.yaml --dry-run # validate only, no changes (CI)
|
|
574
|
+
prismor policy apply policy.yaml --yes # publish without the prompt (CI)
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### Devices & members
|
|
578
|
+
|
|
579
|
+
```bash
|
|
580
|
+
prismor devices # enrolled devices: owner, status, applied policy version
|
|
581
|
+
prismor members # org members and their roles
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
### API key scopes — keep admin keys off agent/CI machines
|
|
585
|
+
|
|
586
|
+
Reads (`policy show/pull`, `devices`, `members`) work with any key. **Publishing policy (`policy apply`) requires an admin-scoped key** — a **scan-scoped** key is rejected even if you're an owner. Give CI pipelines and AI coding agents **scan-scoped** keys so they can never weaken your security policy; reserve admin keys for a human-controlled secret store.
|
|
587
|
+
|
|
588
|
+
## Output
|
|
589
|
+
|
|
590
|
+
Prismor CLI provides clear, colorful output with:
|
|
591
|
+
|
|
592
|
+
- ✓ Success indicators
|
|
593
|
+
- ✗ Error messages
|
|
594
|
+
- ℹ Information updates
|
|
595
|
+
- ⚠ Warnings
|
|
596
|
+
- Detailed scan results including:
|
|
597
|
+
- Repository information
|
|
598
|
+
- Vulnerability counts
|
|
599
|
+
- Secret detection findings
|
|
600
|
+
- SBOM artifact counts
|
|
601
|
+
- Download links for detailed reports
|
|
602
|
+
|
|
603
|
+
## Full Analysis & Dashboarding
|
|
604
|
+
|
|
605
|
+
For comprehensive analysis and visualization of your scan results, visit the **[Prismor Dashboard](https://prismor.dev)**:
|
|
606
|
+
|
|
607
|
+
### Features Available on Prismor.dev:
|
|
608
|
+
- 📊 **Interactive Dashboards** - Visualize security trends and metrics
|
|
609
|
+
- 📈 **Historical Analysis** - Track vulnerabilities over time
|
|
610
|
+
- 🎯 **Detailed Reports** - In-depth analysis of all findings
|
|
611
|
+
- 🔔 **Alerts & Notifications** - Get notified of critical issues
|
|
612
|
+
- 👥 **Team Collaboration** - Share reports with your team
|
|
613
|
+
- 🔄 **CI/CD Integration** - Automate scans in your pipeline
|
|
614
|
+
- 📁 **Repository Management** - Manage multiple repositories in one place
|
|
615
|
+
|
|
616
|
+
### Accessing Full Reports:
|
|
617
|
+
|
|
618
|
+
After running a scan with the CLI, you can:
|
|
619
|
+
|
|
620
|
+
1. Visit [https://prismor.dev](https://prismor.dev)
|
|
621
|
+
2. Log into your dashboard
|
|
622
|
+
3. View all your scan results with rich visualizations
|
|
623
|
+
4. Export reports in various formats
|
|
624
|
+
5. Set up automated scanning schedules
|
|
625
|
+
|
|
626
|
+
The CLI provides quick results in your terminal, while the web dashboard offers comprehensive analysis and long-term security monitoring.
|
|
627
|
+
|
|
628
|
+
## API Information
|
|
629
|
+
|
|
630
|
+
Prismor CLI communicates with the Prismor API at `https://api.prismor.dev`. The CLI handles:
|
|
631
|
+
|
|
632
|
+
- Authentication via API key
|
|
633
|
+
- Request formatting
|
|
634
|
+
- Error handling
|
|
635
|
+
- Response parsing
|
|
636
|
+
- Result presentation
|
|
637
|
+
|
|
638
|
+
## Advanced Usage
|
|
639
|
+
|
|
640
|
+
### Save Results to File
|
|
641
|
+
|
|
642
|
+
Save scan results to a JSON file for later analysis:
|
|
643
|
+
|
|
644
|
+
```bash
|
|
645
|
+
prismor --repo username/repo --fullscan --output results.json
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
### Quiet Mode
|
|
649
|
+
|
|
650
|
+
Run scans with minimal output (useful for CI/CD pipelines):
|
|
651
|
+
|
|
652
|
+
```bash
|
|
653
|
+
prismor --repo username/repo --scan --quiet
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
### Combining Options
|
|
657
|
+
|
|
658
|
+
Combine multiple options for customized workflows:
|
|
659
|
+
|
|
660
|
+
```bash
|
|
661
|
+
# Scan specific branch and save to file
|
|
662
|
+
prismor --repo username/repo --scan --branch develop --output scan-results.json
|
|
663
|
+
|
|
664
|
+
# Quiet mode with JSON output
|
|
665
|
+
prismor --repo username/repo --fullscan --quiet --json
|
|
666
|
+
|
|
667
|
+
# Save results without console output
|
|
668
|
+
prismor --repo username/repo --sbom --output sbom.json --quiet
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
## Troubleshooting
|
|
672
|
+
|
|
673
|
+
### API Key Not Set
|
|
674
|
+
|
|
675
|
+
**Error:**
|
|
676
|
+
```
|
|
677
|
+
✗ PRISMOR_API_KEY environment variable is not set.
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
**Solution:**
|
|
681
|
+
```bash
|
|
682
|
+
# Set temporarily (current session only)
|
|
683
|
+
export PRISMOR_API_KEY=your_api_key_here
|
|
684
|
+
|
|
685
|
+
# Set permanently (add to ~/.bashrc or ~/.zshrc)
|
|
686
|
+
echo 'export PRISMOR_API_KEY=your_api_key_here' >> ~/.zshrc
|
|
687
|
+
source ~/.zshrc
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
**Get your API key:**
|
|
691
|
+
1. Visit [https://prismor.dev/cli](https://prismor.dev/cli)
|
|
692
|
+
2. Sign up for a free account
|
|
693
|
+
3. Generate an API key from your dashboard
|
|
694
|
+
|
|
695
|
+
---
|
|
696
|
+
|
|
697
|
+
### Invalid Repository Format
|
|
698
|
+
|
|
699
|
+
**Error:**
|
|
700
|
+
```
|
|
701
|
+
✗ Unrecognized repository format
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
**Supported formats:**
|
|
705
|
+
- ✅ `username/repository` (recommended)
|
|
706
|
+
- ✅ `https://github.com/username/repository`
|
|
707
|
+
- ✅ `https://www.github.com/username/repository`
|
|
708
|
+
- ✅ `http://github.com/username/repository`
|
|
709
|
+
- ✅ `http://www.github.com/username/repository`
|
|
710
|
+
- ✅ `github.com/username/repository`
|
|
711
|
+
- ✅ `www.github.com/username/repository`
|
|
712
|
+
- ✅ `git@github.com:username/repository.git`
|
|
713
|
+
- ✅ `https://github.com/username/repository/tree/branch`
|
|
714
|
+
- ✅ `https://github.com/username/repository/blob/branch/file`
|
|
715
|
+
|
|
716
|
+
**Not supported:**
|
|
717
|
+
- ❌ Non-GitHub URLs (GitLab, Bitbucket, etc.)
|
|
718
|
+
- ❌ Invalid URL formats
|
|
719
|
+
- ❌ Empty or malformed repository names
|
|
720
|
+
- ❌ Repository names with invalid characters
|
|
721
|
+
|
|
722
|
+
**Valid characters:**
|
|
723
|
+
- Alphanumeric (a-z, A-Z, 0-9)
|
|
724
|
+
- Hyphens (-)
|
|
725
|
+
- Underscores (_)
|
|
726
|
+
- Dots (.)
|
|
727
|
+
- Cannot start or end with special characters
|
|
728
|
+
|
|
729
|
+
---
|
|
730
|
+
|
|
731
|
+
### Connection Issues
|
|
732
|
+
|
|
733
|
+
**Error:**
|
|
734
|
+
```
|
|
735
|
+
✗ Failed to connect to Prismor API
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
**Solutions:**
|
|
739
|
+
|
|
740
|
+
1. **Check Internet Connection**
|
|
741
|
+
```bash
|
|
742
|
+
ping prismor.dev
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
2. **Verify API Endpoint**
|
|
746
|
+
```bash
|
|
747
|
+
curl -I https://prismor.dev
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
3. **Test API Key**
|
|
751
|
+
```bash
|
|
752
|
+
prismor config
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
4. **Check Firewall/Proxy**
|
|
756
|
+
- Ensure your firewall allows HTTPS connections
|
|
757
|
+
- Configure proxy if needed:
|
|
758
|
+
```bash
|
|
759
|
+
export HTTPS_PROXY=http://proxy.example.com:8080
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
5. **Retry with Automatic Retries**
|
|
763
|
+
- The CLI automatically retries failed requests 3 times with exponential backoff
|
|
764
|
+
- If issues persist, check your network configuration
|
|
765
|
+
|
|
766
|
+
---
|
|
767
|
+
|
|
768
|
+
### Timeout Issues
|
|
769
|
+
|
|
770
|
+
**Error:**
|
|
771
|
+
```
|
|
772
|
+
✗ Request timed out
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
**Solutions:**
|
|
776
|
+
|
|
777
|
+
1. **Large Repositories**
|
|
778
|
+
- Vulnerability scans can take up to 10 minutes for large repositories
|
|
779
|
+
- The CLI will wait automatically
|
|
780
|
+
- Use `--quiet` mode to reduce output during long scans
|
|
781
|
+
|
|
782
|
+
2. **Network Latency**
|
|
783
|
+
- Check your internet speed
|
|
784
|
+
- Try again during off-peak hours
|
|
785
|
+
- Consider using a wired connection
|
|
786
|
+
|
|
787
|
+
3. **Check Scan Status**
|
|
788
|
+
```bash
|
|
789
|
+
# Start scan asynchronously
|
|
790
|
+
prismor start-scan username/repo
|
|
791
|
+
|
|
792
|
+
# Check status later
|
|
793
|
+
prismor scan-status <job_id>
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
---
|
|
797
|
+
|
|
798
|
+
### Private Repository Access
|
|
799
|
+
|
|
800
|
+
**Error:**
|
|
801
|
+
```
|
|
802
|
+
✗ GitHub integration required
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
**Solution:**
|
|
806
|
+
1. Visit [https://prismor.dev/dashboard](https://prismor.dev/dashboard)
|
|
807
|
+
2. Navigate to Settings → Integrations
|
|
808
|
+
3. Connect your GitHub account
|
|
809
|
+
4. Authorize Prismor to access private repositories
|
|
810
|
+
5. Try scanning again
|
|
811
|
+
|
|
812
|
+
---
|
|
813
|
+
|
|
814
|
+
### Invalid Characters in Repository Name
|
|
815
|
+
|
|
816
|
+
**Error:**
|
|
817
|
+
```
|
|
818
|
+
✗ Invalid Username: 'user@name'. Must contain only alphanumeric characters...
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
**Solution:**
|
|
822
|
+
- Ensure repository name follows GitHub naming conventions
|
|
823
|
+
- Remove special characters like `@`, `#`, `$`, etc.
|
|
824
|
+
- Valid example: `username/my-repo-name`
|
|
825
|
+
- Invalid example: `user@name/repo#123`
|
|
826
|
+
|
|
827
|
+
---
|
|
828
|
+
|
|
829
|
+
### Rate Limiting
|
|
830
|
+
|
|
831
|
+
**Error:**
|
|
832
|
+
```
|
|
833
|
+
✗ API error: Rate limit exceeded
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
**Solution:**
|
|
837
|
+
1. Wait a few minutes before retrying
|
|
838
|
+
2. Check your account limits at [prismor.dev/dashboard](https://prismor.dev/dashboard)
|
|
839
|
+
3. Upgrade your plan if needed for higher limits
|
|
840
|
+
|
|
841
|
+
---
|
|
842
|
+
|
|
843
|
+
### Getting Help
|
|
844
|
+
|
|
845
|
+
If you're still experiencing issues:
|
|
846
|
+
|
|
847
|
+
1. **Check Configuration**
|
|
848
|
+
```bash
|
|
849
|
+
prismor config
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
2. **View Account Status**
|
|
853
|
+
```bash
|
|
854
|
+
prismor status
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
3. **Enable Verbose Output**
|
|
858
|
+
- Remove `--quiet` flag to see detailed error messages
|
|
859
|
+
|
|
860
|
+
4. **Contact Support**
|
|
861
|
+
- Visit [https://prismor.dev](https://prismor.dev)
|
|
862
|
+
- Check documentation at [https://docs.prismor.dev](https://docs.prismor.dev)
|
|
863
|
+
- Report issues at [GitHub Issues](https://github.com/PrismorSec/prismor-cli/issues)
|
|
864
|
+
|
|
865
|
+
## Development
|
|
866
|
+
|
|
867
|
+
### Local Installation
|
|
868
|
+
|
|
869
|
+
For development, clone the repository and install in editable mode:
|
|
870
|
+
|
|
871
|
+
```bash
|
|
872
|
+
git clone https://github.com/PrismorSec/prismor-cli.git
|
|
873
|
+
cd prismor-cli
|
|
874
|
+
pip install -e .
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
### Project Structure
|
|
878
|
+
|
|
879
|
+
```
|
|
880
|
+
prismor-cli/
|
|
881
|
+
├── prismor/
|
|
882
|
+
│ ├── __init__.py # Package initialization
|
|
883
|
+
│ ├── cli.py # CLI interface and commands
|
|
884
|
+
│ └── api.py # API client and communication
|
|
885
|
+
├── setup.py # Package configuration
|
|
886
|
+
├── requirements.txt # Dependencies
|
|
887
|
+
└── README.md # Documentation
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
## Requirements
|
|
891
|
+
|
|
892
|
+
- Python 3.7 or higher
|
|
893
|
+
- `click` >= 8.0.0
|
|
894
|
+
- `requests` >= 2.25.0
|
|
895
|
+
|
|
896
|
+
## License
|
|
897
|
+
|
|
898
|
+
MIT License - See LICENSE file for details
|
|
899
|
+
|
|
900
|
+
## Support
|
|
901
|
+
|
|
902
|
+
- **Website**: [https://prismor.dev](https://prismor.dev)
|
|
903
|
+
- **Dashboard**: [https://prismor.dev](https://prismor.dev) (Sign up for full features)
|
|
904
|
+
- **Documentation**: [https://docs.prismor.dev](https://docs.prismor.dev)
|
|
905
|
+
- **Issues**: [https://github.com/PrismorSec/prismor-cli/issues](https://github.com/prismor/prismor-cli/issues)
|
|
906
|
+
|
|
907
|
+
### Need Help?
|
|
908
|
+
|
|
909
|
+
1. Visit [Prismor.dev](https://prismor.dev) for full documentation and support
|
|
910
|
+
2. Check the dashboard for detailed scan results and analysis
|
|
911
|
+
3. Join our community for questions and discussions
|
|
912
|
+
|
|
913
|
+
## Contributing
|
|
914
|
+
|
|
915
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
916
|
+
|
|
917
|
+
---
|
|
918
|
+
|
|
919
|
+
Made with ❤️ by Prismor
|