pinata-security-cli 0.1.0
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/LICENSE +21 -0
- package/README.md +168 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +6473 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +1188 -0
- package/dist/index.js +1622 -0
- package/dist/index.js.map +1 -0
- package/package.json +91 -0
- package/wasm/tree-sitter-javascript.wasm +0 -0
- package/wasm/tree-sitter-python.wasm +0 -0
- package/wasm/tree-sitter-typescript.wasm +0 -0
- package/wasm/web-tree-sitter.wasm +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pinata Security
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Pinata
|
|
2
|
+
|
|
3
|
+
AI-powered test coverage analysis and generation. Pinata scans codebases to identify test coverage gaps across security, data integrity, concurrency, and other risk domains, then generates targeted tests using AI-powered templates.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Multi-domain analysis**: security, data, concurrency, input validation, resources, reliability
|
|
8
|
+
- **Pattern detection**: regex and AST-based pattern matching for Python, TypeScript, JavaScript
|
|
9
|
+
- **Test generation**: templates for pytest, jest, vitest, mocha frameworks
|
|
10
|
+
- **Multiple output formats**: terminal, JSON, markdown, SARIF, HTML, JUnit XML
|
|
11
|
+
- **CI/CD ready**: GitHub Actions workflow, SARIF for Code Scanning, JUnit for test reporters
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g pinata
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Initialize config
|
|
23
|
+
pinata init
|
|
24
|
+
|
|
25
|
+
# Analyze codebase
|
|
26
|
+
pinata analyze ./src
|
|
27
|
+
|
|
28
|
+
# Generate tests for detected gaps
|
|
29
|
+
pinata generate --write
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Commands
|
|
33
|
+
|
|
34
|
+
| Command | Description |
|
|
35
|
+
|---------|-------------|
|
|
36
|
+
| `pinata analyze [path]` | Scan for test coverage gaps |
|
|
37
|
+
| `pinata generate` | Generate tests for detected gaps |
|
|
38
|
+
| `pinata list` | List all detection categories |
|
|
39
|
+
| `pinata search <query>` | Search categories by keyword |
|
|
40
|
+
| `pinata init` | Create .pinata.yml config |
|
|
41
|
+
| `pinata auth login` | Configure API key |
|
|
42
|
+
|
|
43
|
+
## Output Formats
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pinata analyze ./src --output terminal # colored terminal output
|
|
47
|
+
pinata analyze ./src --output json # JSON for programmatic use
|
|
48
|
+
pinata analyze ./src --output markdown # markdown report
|
|
49
|
+
pinata analyze ./src --output sarif # GitHub Code Scanning
|
|
50
|
+
pinata analyze ./src --output html # standalone HTML report
|
|
51
|
+
pinata analyze ./src --output junit-xml # CI test reporter
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Performance
|
|
55
|
+
|
|
56
|
+
Benchmarked on synthetic codebases with realistic patterns:
|
|
57
|
+
|
|
58
|
+
| Metric | Target | Actual |
|
|
59
|
+
|--------|--------|--------|
|
|
60
|
+
| 100 files | <5s | ~0.5s |
|
|
61
|
+
| 1,000 files | <60s | ~5s |
|
|
62
|
+
| 10,000 files | <10min | ~50s |
|
|
63
|
+
| Pattern matching p95 | <50ms | ~1.5ms |
|
|
64
|
+
| Template rendering p95 | <100ms | ~0.5ms |
|
|
65
|
+
| Memory (1k files) | <500MB | ~100MB |
|
|
66
|
+
|
|
67
|
+
## Accuracy
|
|
68
|
+
|
|
69
|
+
Measured against labeled vulnerable and safe code samples:
|
|
70
|
+
|
|
71
|
+
| Metric | Current |
|
|
72
|
+
|--------|---------|
|
|
73
|
+
| True positive rate | >50% |
|
|
74
|
+
| False positive rate | tracked |
|
|
75
|
+
| Per-category metrics | tracked |
|
|
76
|
+
|
|
77
|
+
Detection accuracy varies by category. Security-focused patterns (SQL injection, XSS, command injection) have higher confidence. Low-confidence patterns flag code for manual review.
|
|
78
|
+
|
|
79
|
+
## Detection Categories
|
|
80
|
+
|
|
81
|
+
45 detection categories across 10 risk domains:
|
|
82
|
+
|
|
83
|
+
- **Security**: SQL injection, XSS, command injection, path traversal, CSRF, XXE, deserialization, SSRF, secrets, timing attacks
|
|
84
|
+
- **Data**: validation, races, migrations, truncation, encoding, null handling
|
|
85
|
+
- **Concurrency**: deadlocks, race conditions, thread safety, idempotency, timeouts
|
|
86
|
+
- **Input**: boundary testing, null/undefined, injection fuzzing
|
|
87
|
+
- **Network**: timeouts, partitions, latency, connection failures
|
|
88
|
+
- **Resource**: memory leaks, file handles, connection pools
|
|
89
|
+
- **Performance**: blocking I/O, CPU spin, memory bloat
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
Create `.pinata.yml` in your project root:
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
include:
|
|
97
|
+
- "src/**/*.ts"
|
|
98
|
+
- "src/**/*.py"
|
|
99
|
+
|
|
100
|
+
exclude:
|
|
101
|
+
- "node_modules/**"
|
|
102
|
+
- "**/*.test.ts"
|
|
103
|
+
|
|
104
|
+
domains:
|
|
105
|
+
- security
|
|
106
|
+
- data
|
|
107
|
+
- concurrency
|
|
108
|
+
|
|
109
|
+
minSeverity: medium
|
|
110
|
+
|
|
111
|
+
thresholds:
|
|
112
|
+
critical: 0
|
|
113
|
+
high: 5
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## CI/CD Integration
|
|
117
|
+
|
|
118
|
+
### GitHub Actions
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
- name: Run Pinata
|
|
122
|
+
run: pinata analyze ./src --output sarif > results.sarif
|
|
123
|
+
|
|
124
|
+
- name: Upload SARIF
|
|
125
|
+
uses: github/codeql-action/upload-sarif@v2
|
|
126
|
+
with:
|
|
127
|
+
sarif_file: results.sarif
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Fail on Critical Gaps
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
pinata analyze ./src --fail-on critical
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Development
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Install dependencies
|
|
140
|
+
npm install
|
|
141
|
+
|
|
142
|
+
# Build
|
|
143
|
+
npm run build
|
|
144
|
+
|
|
145
|
+
# Run tests
|
|
146
|
+
npm test
|
|
147
|
+
|
|
148
|
+
# Run benchmarks
|
|
149
|
+
npm run benchmark
|
|
150
|
+
|
|
151
|
+
# Lint
|
|
152
|
+
npm run lint
|
|
153
|
+
|
|
154
|
+
# Type check
|
|
155
|
+
npm run typecheck
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Test Suite
|
|
159
|
+
|
|
160
|
+
- **752+ tests** covering core functionality
|
|
161
|
+
- **Benchmarks** for performance regression detection
|
|
162
|
+
- **Accuracy corpus** for detection quality tracking
|
|
163
|
+
- **Security tests** for tool safety (path traversal, ReDoS, injection)
|
|
164
|
+
- **Edge case tests** for robustness (unicode, concurrency, large files)
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|