@collabchron/tharos 0.1.4 โ 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 +58 -79
- package/dist/hooks/manager.js +5 -4
- package/dist/tharos.exe +0 -0
- package/dist/tharos.exe~ +0 -0
- package/package.json +17 -4
package/README.md
CHANGED
|
@@ -1,63 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="docs/public/logo_banner.png" alt="Tharos Logo" width="200"/>
|
|
3
|
+
|
|
4
|
+
# Tharos
|
|
2
5
|
|
|
3
|
-
**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.
|
|
4
9
|
|
|
5
|
-
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.
|
|
6
10
|
|
|
7
11
|
[](LICENSE)
|
|
8
12
|
[](https://www.typescriptlang.org/)
|
|
9
13
|
[](https://golang.org/)
|
|
10
14
|
|
|
15
|
+
</div>
|
|
16
|
+
|
|
11
17
|
## โจ Features
|
|
12
18
|
|
|
13
|
-
###
|
|
14
|
-
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
- **
|
|
19
|
-
- **SARIF Export**: Standardized reporting for GitHub Advanced Security & other tools
|
|
20
|
-
- **Suggested Fixes**: AI-generated code snippets to resolve issues
|
|
21
|
-
|
|
22
|
-
### ๐ Multi-Language Support
|
|
23
|
-
- TypeScript & JavaScript (including React)
|
|
24
|
-
- Python
|
|
25
|
-
- Go
|
|
26
|
-
- Rust
|
|
27
|
-
- Java
|
|
28
|
-
- *More languages coming soon*
|
|
29
|
-
|
|
30
|
-
### ๐ฏ Compliance Frameworks
|
|
31
|
-
Pre-built policies for industry standards:
|
|
32
|
-
- **OWASP Top 10 2021** - Web application security risks
|
|
33
|
-
- **SOC 2 Type II** - Trust Services Criteria
|
|
34
|
-
- **GDPR** - EU data protection compliance
|
|
35
|
-
- **PCI-DSS v4.0** - Payment card security
|
|
36
|
-
- **Code Quality** - Best practices and maintainability
|
|
37
|
-
|
|
38
|
-
### ๐ Multiple Integration Points
|
|
39
|
-
|
|
40
|
-
#### 1. CLI Tool
|
|
41
|
-
```bash
|
|
42
|
-
# Initialize in your project
|
|
43
|
-
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).
|
|
44
25
|
|
|
45
|
-
|
|
46
|
-
tharos check
|
|
26
|
+
- **Self-Healing Hooks**: Automatically manages and repairs git hook integrity.
|
|
47
27
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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.
|
|
51
34
|
|
|
52
|
-
#### 2. Git Hooks
|
|
53
|
-
Automatic pre-commit and pre-push validation with self-healing hooks
|
|
54
35
|
|
|
55
|
-
#### 3. VSCode Extension
|
|
56
|
-
Real-time feedback as you code:
|
|
57
|
-
- Red squiggles under security issues
|
|
58
|
-
- AI insights on hover
|
|
59
|
-
- Quick fixes via lightbulb menu
|
|
60
|
-
- Status bar integration
|
|
61
36
|
|
|
62
37
|
#### 4. GitHub Actions
|
|
63
38
|
```yaml
|
|
@@ -70,21 +45,20 @@ Real-time feedback as you code:
|
|
|
70
45
|
|
|
71
46
|
### ๐ง AI Provider Flexibility
|
|
72
47
|
Automatic fallback chain:
|
|
73
|
-
1. **
|
|
74
|
-
2. **
|
|
75
|
-
3. **
|
|
76
|
-
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)
|
|
77
51
|
|
|
78
52
|
## ๐ฆ Installation
|
|
79
53
|
|
|
80
54
|
### NPM (Recommended)
|
|
81
55
|
```bash
|
|
82
|
-
npm install -g tharos
|
|
56
|
+
npm install -g @collabchron/tharos
|
|
83
57
|
```
|
|
84
58
|
|
|
85
59
|
### From Source
|
|
86
60
|
```bash
|
|
87
|
-
git clone https://github.com/
|
|
61
|
+
git clone https://github.com/chinonsochikelue/tharos.git
|
|
88
62
|
cd tharos
|
|
89
63
|
npm install
|
|
90
64
|
npm run build
|
|
@@ -146,7 +120,7 @@ $env:GROQ_API_KEY="your-groq-key-here"
|
|
|
146
120
|
|
|
147
121
|
**Check your setup:**
|
|
148
122
|
```bash
|
|
149
|
-
tharos
|
|
123
|
+
tharos setup
|
|
150
124
|
```
|
|
151
125
|
|
|
152
126
|
|
|
@@ -159,10 +133,20 @@ tharos check
|
|
|
159
133
|
# Analyze specific file
|
|
160
134
|
tharos analyze src/api/auth.ts
|
|
161
135
|
|
|
162
|
-
#
|
|
163
|
-
tharos analyze .
|
|
136
|
+
# Interactive review (Fix/Explain/Skip findings)
|
|
137
|
+
tharos analyze . --interactive
|
|
164
138
|
```
|
|
165
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
|
+
|
|
166
150
|
## ๐ Configuration
|
|
167
151
|
|
|
168
152
|
### `tharos.yaml` Example
|
|
@@ -170,28 +154,24 @@ tharos analyze .
|
|
|
170
154
|
name: "My Project Security Policy"
|
|
171
155
|
version: "1.0.0"
|
|
172
156
|
|
|
173
|
-
#
|
|
174
|
-
|
|
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.
|
|
175
159
|
|
|
176
|
-
# Security rules
|
|
177
160
|
security:
|
|
178
161
|
enabled: true
|
|
179
162
|
rules:
|
|
180
|
-
- pattern: "
|
|
181
|
-
message: "
|
|
182
|
-
severity: "
|
|
183
|
-
|
|
184
|
-
- pattern: "(?i)(api[_-]?key|secret).*=.*['\"].*['\"]"
|
|
185
|
-
message: "Hardcoded credentials detected"
|
|
186
|
-
severity: "block"
|
|
163
|
+
- pattern: "DANGEROUS_INTERNAL_API"
|
|
164
|
+
message: "Internal API bypass detected"
|
|
165
|
+
severity: "critical"
|
|
187
166
|
|
|
188
167
|
# AI configuration
|
|
189
168
|
ai:
|
|
190
169
|
enabled: true
|
|
191
|
-
provider: "auto"
|
|
192
|
-
min_risk_score: 60
|
|
170
|
+
provider: "auto" # auto, ollama, gemini, groq
|
|
171
|
+
min_risk_score: 60 # Filter noise; only show high-confidence AI insights
|
|
193
172
|
```
|
|
194
173
|
|
|
174
|
+
|
|
195
175
|
## ๐ง VSCode Extension
|
|
196
176
|
|
|
197
177
|
### Installation
|
|
@@ -264,7 +244,7 @@ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guid
|
|
|
264
244
|
### Development Setup
|
|
265
245
|
```bash
|
|
266
246
|
# Clone repository
|
|
267
|
-
git clone https://github.com/
|
|
247
|
+
git clone https://github.com/chinonsochikelue/tharos.git
|
|
268
248
|
cd tharos
|
|
269
249
|
|
|
270
250
|
# Install dependencies
|
|
@@ -284,13 +264,13 @@ npm test
|
|
|
284
264
|
|
|
285
265
|
## ๐ Documentation
|
|
286
266
|
|
|
287
|
-
Full documentation available at [https://tharos.
|
|
267
|
+
Full documentation available at [https://tharos.vercel.app](https://tharos.vercel.app)
|
|
288
268
|
|
|
289
|
-
- [Getting Started Guide](https://tharos.
|
|
290
|
-
- [Policy Configuration](https://tharos.
|
|
291
|
-
- [AI Integration](https://tharos.
|
|
292
|
-
- [VSCode Extension](https://tharos.
|
|
293
|
-
- [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)
|
|
294
274
|
|
|
295
275
|
## ๐ฏ Use Cases
|
|
296
276
|
|
|
@@ -353,14 +333,13 @@ MIT License - see [LICENSE](LICENSE) for details
|
|
|
353
333
|
- OWASP for security guidelines
|
|
354
334
|
- Google Gemini team for AI capabilities
|
|
355
335
|
- Groq for fast inference
|
|
356
|
-
- Ollama for local AI support
|
|
357
336
|
- The open-source community
|
|
358
337
|
|
|
359
338
|
## ๐ฌ Support
|
|
360
339
|
|
|
361
|
-
- **Documentation**: [https://tharos.
|
|
362
|
-
- **Issues**: [GitHub Issues](https://github.com/
|
|
363
|
-
- **Discussions**: [GitHub Discussions](https://github.com/
|
|
340
|
+
- **Documentation**: [https://tharos.vercel.app](https://tharos.vercel.app)
|
|
341
|
+
- **Issues**: [GitHub Issues](https://github.com/chinonsochikelue/tharos/issues)
|
|
342
|
+
- **Discussions**: [GitHub Discussions](https://github.com/chinonsochikelue/tharos/discussions)
|
|
364
343
|
- **Discord**: [Join our community](https://discord.gg/tharos)
|
|
365
344
|
|
|
366
345
|
---
|
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",
|
|
@@ -30,10 +41,12 @@
|
|
|
30
41
|
"tharos": "dist/index.js"
|
|
31
42
|
},
|
|
32
43
|
"scripts": {
|
|
33
|
-
"build": "tsc &&
|
|
44
|
+
"build": "tsc && npm run build:binary",
|
|
45
|
+
"build:binary": "node scripts/build-binary.cjs",
|
|
34
46
|
"start": "node --loader ts-node/esm src/index.ts",
|
|
35
47
|
"dev": "node --loader ts-node/esm src/index.ts",
|
|
36
|
-
"
|
|
48
|
+
"prepare": "npm run build",
|
|
49
|
+
"test": "node scripts/run-tests.cjs"
|
|
37
50
|
},
|
|
38
51
|
"dependencies": {},
|
|
39
52
|
"devDependencies": {
|