@collabchron/tharos 0.1.5 โ 1.0.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 +48 -74
- package/dist/hooks/manager.js +5 -4
- package/dist/tharos.exe +0 -0
- package/dist/tharos.exe~ +0 -0
- package/package.json +15 -3
package/README.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
# Tharos
|
|
5
5
|
|
|
6
|
-
**AI-Powered
|
|
6
|
+
**Modern AI-Powered Git Hook Security Scanner**
|
|
7
|
+
|
|
8
|
+
Tharos is a specialized git commit hook scanner that acts as an intelligent gatekeeper for your codebase. It combines lightning-fast AST analysis with deep AI semantic insights to catch security vulnerabilities and leaks *before* they are committed to your repository.
|
|
7
9
|
|
|
8
|
-
Tharos is a comprehensive security analysis tool that combines static code analysis with AI-powered semantic insights to catch security vulnerabilities, enforce compliance standards, and improve code quality before they reach production.
|
|
9
10
|
|
|
10
11
|
[](LICENSE)
|
|
11
12
|
[](https://www.typescriptlang.org/)
|
|
@@ -15,54 +16,23 @@ Tharos is a comprehensive security analysis tool that combines static code analy
|
|
|
15
16
|
|
|
16
17
|
## โจ Features
|
|
17
18
|
|
|
18
|
-
###
|
|
19
|
-
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
- **
|
|
24
|
-
- **SARIF Export**: Standardized reporting for GitHub Advanced Security & other tools
|
|
25
|
-
- **Suggested Fixes**: AI-generated code snippets to resolve issues
|
|
26
|
-
|
|
27
|
-
### ๐ Multi-Language Support
|
|
28
|
-
- TypeScript & JavaScript (including React)
|
|
29
|
-
- Python
|
|
30
|
-
- Go
|
|
31
|
-
- Rust
|
|
32
|
-
- Java
|
|
33
|
-
- *More languages coming soon*
|
|
34
|
-
|
|
35
|
-
### ๐ฏ Compliance Frameworks
|
|
36
|
-
Pre-built policies for industry standards:
|
|
37
|
-
- **OWASP Top 10 2021** - Web application security risks
|
|
38
|
-
- **SOC 2 Type II** - Trust Services Criteria
|
|
39
|
-
- **GDPR** - EU data protection compliance
|
|
40
|
-
- **PCI-DSS v4.0** - Payment card security
|
|
41
|
-
- **Code Quality** - Best practices and maintainability
|
|
42
|
-
|
|
43
|
-
### ๐ Multiple Integration Points
|
|
44
|
-
|
|
45
|
-
#### 1. CLI Tool
|
|
46
|
-
```bash
|
|
47
|
-
# Initialize in your project
|
|
48
|
-
tharos init
|
|
19
|
+
### ๐ก๏ธ Core: Intelligent Git Hooks
|
|
20
|
+
Tharos's primary interface is your git workflow. It provides automated security gating that prevents high-risk code from ever leaving your machine.
|
|
21
|
+
- **Pre-commit Gating**: Block commits containing secrets, SQLi, or high-risk vulnerabilities.
|
|
22
|
+
- **Polyglot AST Support**: Native semantic analysis for **TypeScript, JavaScript, Go, and Python**.
|
|
23
|
+
- **Interactive Magic Fixes**: Collaboratively review, fix, or explain findings in the CLI.
|
|
24
|
+
- **Policy-as-Code**: Load organizational security policies from YAML (SOC2, GDPR, OWASP).
|
|
49
25
|
|
|
50
|
-
|
|
51
|
-
tharos check
|
|
26
|
+
- **Self-Healing Hooks**: Automatically manages and repairs git hook integrity.
|
|
52
27
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
28
|
+
### ๐ AI-Powered Security Analysis
|
|
29
|
+
- **AST-Based Detection**: Fast, accurate pattern matching for common vulnerabilities (SQLi, XSS, Secrets).
|
|
30
|
+
- **Scanner Mindset**: Context-aware analysis that ignores test files and mock data.
|
|
31
|
+
- **AI Semantic Analysis**: Deep understanding of code context and intent using Gemini/Groq.
|
|
32
|
+
- **Risk Scoring**: Intelligent commit blocking based on cumulative finding severity and AI risk scores.
|
|
33
|
+
- **Suggested Fixes**: AI-generated code snippets to resolve issues instantly at commit time.
|
|
56
34
|
|
|
57
|
-
#### 2. Git Hooks
|
|
58
|
-
Automatic pre-commit and pre-push validation with self-healing hooks
|
|
59
35
|
|
|
60
|
-
#### 3. VSCode Extension
|
|
61
|
-
Real-time feedback as you code:
|
|
62
|
-
- Red squiggles under security issues
|
|
63
|
-
- AI insights on hover
|
|
64
|
-
- Quick fixes via lightbulb menu
|
|
65
|
-
- Status bar integration
|
|
66
36
|
|
|
67
37
|
#### 4. GitHub Actions
|
|
68
38
|
```yaml
|
|
@@ -75,16 +45,15 @@ Real-time feedback as you code:
|
|
|
75
45
|
|
|
76
46
|
### ๐ง AI Provider Flexibility
|
|
77
47
|
Automatic fallback chain:
|
|
78
|
-
1. **
|
|
79
|
-
2. **
|
|
80
|
-
3. **
|
|
81
|
-
4. **Groq** (Fast, cost-effective)
|
|
48
|
+
1. **Google Gemini** (Recommended, generous free tier)
|
|
49
|
+
2. **Groq** (Fast & Free inference)
|
|
50
|
+
3. **Managed AI** (Zero-config cloud fallback)
|
|
82
51
|
|
|
83
52
|
## ๐ฆ Installation
|
|
84
53
|
|
|
85
54
|
### NPM (Recommended)
|
|
86
55
|
```bash
|
|
87
|
-
npm install -g tharos
|
|
56
|
+
npm install -g @collabchron/tharos
|
|
88
57
|
```
|
|
89
58
|
|
|
90
59
|
### From Source
|
|
@@ -151,7 +120,7 @@ $env:GROQ_API_KEY="your-groq-key-here"
|
|
|
151
120
|
|
|
152
121
|
**Check your setup:**
|
|
153
122
|
```bash
|
|
154
|
-
tharos
|
|
123
|
+
tharos setup
|
|
155
124
|
```
|
|
156
125
|
|
|
157
126
|
|
|
@@ -164,10 +133,20 @@ tharos check
|
|
|
164
133
|
# Analyze specific file
|
|
165
134
|
tharos analyze src/api/auth.ts
|
|
166
135
|
|
|
167
|
-
#
|
|
168
|
-
tharos analyze .
|
|
136
|
+
# Interactive review (Fix/Explain/Skip findings)
|
|
137
|
+
tharos analyze . --interactive
|
|
169
138
|
```
|
|
170
139
|
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### ๐งช Automated Testing
|
|
143
|
+
Tharos includes a built-in test suite to verify security policies and engine performance.
|
|
144
|
+
```bash
|
|
145
|
+
# Run the automated security test suite
|
|
146
|
+
node scripts/run-tests.cjs
|
|
147
|
+
```
|
|
148
|
+
This suite tests Tharos against the `audit_samples/` directory, ensuring no regressions in vulnerability detection.
|
|
149
|
+
|
|
171
150
|
## ๐ Configuration
|
|
172
151
|
|
|
173
152
|
### `tharos.yaml` Example
|
|
@@ -175,28 +154,24 @@ tharos analyze .
|
|
|
175
154
|
name: "My Project Security Policy"
|
|
176
155
|
version: "1.0.0"
|
|
177
156
|
|
|
178
|
-
#
|
|
179
|
-
|
|
157
|
+
# Built-in AST analysis is ALWAYS enabled for TS, JS, Go, and Python.
|
|
158
|
+
# You can add custom regex patterns under the security section.
|
|
180
159
|
|
|
181
|
-
# Security rules
|
|
182
160
|
security:
|
|
183
161
|
enabled: true
|
|
184
162
|
rules:
|
|
185
|
-
- pattern: "
|
|
186
|
-
message: "
|
|
187
|
-
severity: "
|
|
188
|
-
|
|
189
|
-
- pattern: "(?i)(api[_-]?key|secret).*=.*['\"].*['\"]"
|
|
190
|
-
message: "Hardcoded credentials detected"
|
|
191
|
-
severity: "block"
|
|
163
|
+
- pattern: "DANGEROUS_INTERNAL_API"
|
|
164
|
+
message: "Internal API bypass detected"
|
|
165
|
+
severity: "critical"
|
|
192
166
|
|
|
193
167
|
# AI configuration
|
|
194
168
|
ai:
|
|
195
169
|
enabled: true
|
|
196
|
-
provider: "auto"
|
|
197
|
-
min_risk_score: 60
|
|
170
|
+
provider: "auto" # auto, ollama, gemini, groq
|
|
171
|
+
min_risk_score: 60 # Filter noise; only show high-confidence AI insights
|
|
198
172
|
```
|
|
199
173
|
|
|
174
|
+
|
|
200
175
|
## ๐ง VSCode Extension
|
|
201
176
|
|
|
202
177
|
### Installation
|
|
@@ -289,13 +264,13 @@ npm test
|
|
|
289
264
|
|
|
290
265
|
## ๐ Documentation
|
|
291
266
|
|
|
292
|
-
Full documentation available at [https://tharos.
|
|
267
|
+
Full documentation available at [https://tharos.vercel.app](https://tharos.vercel.app)
|
|
293
268
|
|
|
294
|
-
- [Getting Started Guide](https://tharos.
|
|
295
|
-
- [Policy Configuration](https://tharos.
|
|
296
|
-
- [AI Integration](https://tharos.
|
|
297
|
-
- [VSCode Extension](https://tharos.
|
|
298
|
-
- [API Reference](https://tharos.
|
|
269
|
+
- [Getting Started Guide](https://tharos.vercel.app/docs)
|
|
270
|
+
- [Policy Configuration](https://tharos.vercel.app/docs/policies)
|
|
271
|
+
- [AI Integration](https://tharos.vercel.app/docs/quickstart#2-configure-ai-recommended)
|
|
272
|
+
- [VSCode Extension](https://tharos.vercel.app/docs/vscode)
|
|
273
|
+
- [API Reference](https://tharos.vercel.app/docs/api)
|
|
299
274
|
|
|
300
275
|
## ๐ฏ Use Cases
|
|
301
276
|
|
|
@@ -358,12 +333,11 @@ MIT License - see [LICENSE](LICENSE) for details
|
|
|
358
333
|
- OWASP for security guidelines
|
|
359
334
|
- Google Gemini team for AI capabilities
|
|
360
335
|
- Groq for fast inference
|
|
361
|
-
- Ollama for local AI support
|
|
362
336
|
- The open-source community
|
|
363
337
|
|
|
364
338
|
## ๐ฌ Support
|
|
365
339
|
|
|
366
|
-
- **Documentation**: [https://tharos.
|
|
340
|
+
- **Documentation**: [https://tharos.vercel.app](https://tharos.vercel.app)
|
|
367
341
|
- **Issues**: [GitHub Issues](https://github.com/chinonsochikelue/tharos/issues)
|
|
368
342
|
- **Discussions**: [GitHub Discussions](https://github.com/chinonsochikelue/tharos/discussions)
|
|
369
343
|
- **Discord**: [Join our community](https://discord.gg/tharos)
|
package/dist/hooks/manager.js
CHANGED
|
@@ -5,8 +5,8 @@ import { promisify } from 'util';
|
|
|
5
5
|
const execAsync = promisify(exec);
|
|
6
6
|
const HOOK_CONTENT = `#!/bin/sh
|
|
7
7
|
# Tharos Git Hook
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
# This hook is managed by Tharos. Do not modify manually.
|
|
9
|
+
# VERSION: 0.1.2
|
|
10
10
|
|
|
11
11
|
# Self-healing check
|
|
12
12
|
if ! command -v tharos > /dev/null 2>&1; then
|
|
@@ -14,10 +14,11 @@ if ! command -v tharos > /dev/null 2>&1; then
|
|
|
14
14
|
exit 0
|
|
15
15
|
fi
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# Periodic setup audit & policy sync (non-blocking)
|
|
18
18
|
tharos sync > /dev/null 2>&1 &
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
# Run pre-commit security check
|
|
21
|
+
tharos check
|
|
21
22
|
`;
|
|
22
23
|
export async function initHooks() {
|
|
23
24
|
const gitDir = await findGitDir();
|
package/dist/tharos.exe
CHANGED
|
Binary file
|
package/dist/tharos.exe~
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@collabchron/tharos",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Tharos: Intelligent, Unbreakable Code Policy Enforcement",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"security",
|
|
7
7
|
"linter",
|
|
8
8
|
"analysis",
|
|
9
9
|
"policy",
|
|
10
|
-
"tharos"
|
|
10
|
+
"tharos",
|
|
11
|
+
"code-security",
|
|
12
|
+
"collabchron",
|
|
13
|
+
"code-quality",
|
|
14
|
+
"chinonsochikelue",
|
|
15
|
+
"fluantix",
|
|
16
|
+
"Chinonso Chikelue",
|
|
17
|
+
"git-hooks",
|
|
18
|
+
"code-scanner",
|
|
19
|
+
"ai-security",
|
|
20
|
+
"code-policy",
|
|
21
|
+
"ast-analysis"
|
|
11
22
|
],
|
|
12
23
|
"author": "Chinonso Chikelue <chinonsoneft@gmail.com>",
|
|
13
24
|
"license": "MIT",
|
|
@@ -34,7 +45,8 @@
|
|
|
34
45
|
"build:binary": "node scripts/build-binary.cjs",
|
|
35
46
|
"start": "node --loader ts-node/esm src/index.ts",
|
|
36
47
|
"dev": "node --loader ts-node/esm src/index.ts",
|
|
37
|
-
"
|
|
48
|
+
"prepare": "npm run build",
|
|
49
|
+
"test": "node scripts/run-tests.cjs"
|
|
38
50
|
},
|
|
39
51
|
"dependencies": {},
|
|
40
52
|
"devDependencies": {
|