fivosense 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/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +22 -0
- package/.github/workflows/ci.yml +52 -0
- package/BLUEPRINT.md +215 -0
- package/BUILD_PLAN.md +175 -0
- package/CONTRIBUTING.md +80 -0
- package/DOCS_VERIFICATION.md +232 -0
- package/FINAL_CHECKLIST.md +263 -0
- package/FINAL_SUMMARY.md +238 -0
- package/GITHUB_PUSH.md +64 -0
- package/LICENSE +21 -0
- package/PROGRESS.md +153 -0
- package/README.md +443 -0
- package/RELEASE_READY.md +201 -0
- package/SECURITY.md +211 -0
- package/SECURITY_DEEP_AUDIT.md +331 -0
- package/TODO.md +52 -0
- package/dist/ai/judge.d.ts +36 -0
- package/dist/ai/judge.d.ts.map +1 -0
- package/dist/ai/judge.js +75 -0
- package/dist/ai/judge.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +39 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/editors/vscode.d.ts +30 -0
- package/dist/editors/vscode.d.ts.map +1 -0
- package/dist/editors/vscode.js +103 -0
- package/dist/editors/vscode.js.map +1 -0
- package/dist/engine/adversary.d.ts +24 -0
- package/dist/engine/adversary.d.ts.map +1 -0
- package/dist/engine/adversary.js +83 -0
- package/dist/engine/adversary.js.map +1 -0
- package/dist/engine/graph.d.ts +38 -0
- package/dist/engine/graph.d.ts.map +1 -0
- package/dist/engine/graph.js +131 -0
- package/dist/engine/graph.js.map +1 -0
- package/dist/engine/reach.d.ts +22 -0
- package/dist/engine/reach.d.ts.map +1 -0
- package/dist/engine/reach.js +107 -0
- package/dist/engine/reach.js.map +1 -0
- package/dist/engine/sinks.d.ts +52 -0
- package/dist/engine/sinks.d.ts.map +1 -0
- package/dist/engine/sinks.js +96 -0
- package/dist/engine/sinks.js.map +1 -0
- package/dist/engine/sources.d.ts +35 -0
- package/dist/engine/sources.d.ts.map +1 -0
- package/dist/engine/sources.js +59 -0
- package/dist/engine/sources.js.map +1 -0
- package/dist/engine/taint.d.ts +37 -0
- package/dist/engine/taint.d.ts.map +1 -0
- package/dist/engine/taint.js +83 -0
- package/dist/engine/taint.js.map +1 -0
- package/dist/engine/verify.d.ts +20 -0
- package/dist/engine/verify.d.ts.map +1 -0
- package/dist/engine/verify.js +65 -0
- package/dist/engine/verify.js.map +1 -0
- package/dist/features/badge.d.ts +20 -0
- package/dist/features/badge.d.ts.map +1 -0
- package/dist/features/badge.js +86 -0
- package/dist/features/badge.js.map +1 -0
- package/dist/features/fix.d.ts +20 -0
- package/dist/features/fix.d.ts.map +1 -0
- package/dist/features/fix.js +115 -0
- package/dist/features/fix.js.map +1 -0
- package/dist/features/roast.d.ts +23 -0
- package/dist/features/roast.d.ts.map +1 -0
- package/dist/features/roast.js +96 -0
- package/dist/features/roast.js.map +1 -0
- package/dist/hooks/agent.d.ts +19 -0
- package/dist/hooks/agent.d.ts.map +1 -0
- package/dist/hooks/agent.js +69 -0
- package/dist/hooks/agent.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +116 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/destructive.d.ts +35 -0
- package/dist/rules/destructive.d.ts.map +1 -0
- package/dist/rules/destructive.js +117 -0
- package/dist/rules/destructive.js.map +1 -0
- package/dist/rules/secrets.d.ts +29 -0
- package/dist/rules/secrets.d.ts.map +1 -0
- package/dist/rules/secrets.js +100 -0
- package/dist/rules/secrets.js.map +1 -0
- package/package.json +56 -0
- package/skill/SKILL.md +86 -0
- package/skill/prompts/path-judge.md +22 -0
- package/src/ai/judge.ts +100 -0
- package/src/cli/index.ts +46 -0
- package/src/editors/vscode.ts +125 -0
- package/src/engine/adversary.ts +100 -0
- package/src/engine/graph.ts +167 -0
- package/src/engine/reach.ts +141 -0
- package/src/engine/sinks.ts +113 -0
- package/src/engine/sources.ts +71 -0
- package/src/engine/taint.ts +117 -0
- package/src/engine/verify.ts +94 -0
- package/src/features/badge.ts +102 -0
- package/src/features/fix.ts +138 -0
- package/src/features/roast.ts +110 -0
- package/src/hooks/agent.ts +84 -0
- package/src/index.ts +147 -0
- package/src/rules/destructive.ts +131 -0
- package/src/rules/secrets.ts +120 -0
- package/test/engine.test.ts +110 -0
- package/test/features.test.ts +131 -0
- package/test/phase3.test.ts +129 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest a feature for FivoSense
|
|
4
|
+
title: '[FEATURE] '
|
|
5
|
+
labels: enhancement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Feature Description
|
|
9
|
+
Clear description of the feature you'd like.
|
|
10
|
+
|
|
11
|
+
## Use Case
|
|
12
|
+
Why is this feature needed? What problem does it solve?
|
|
13
|
+
|
|
14
|
+
## Proposed Solution
|
|
15
|
+
How do you envision this working?
|
|
16
|
+
|
|
17
|
+
## Alternatives
|
|
18
|
+
Any alternative solutions you've considered?
|
|
19
|
+
|
|
20
|
+
## Additional Context
|
|
21
|
+
Any other context or screenshots.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
Brief description of changes.
|
|
3
|
+
|
|
4
|
+
## Type of Change
|
|
5
|
+
- [ ] Bug fix
|
|
6
|
+
- [ ] New feature
|
|
7
|
+
- [ ] Breaking change
|
|
8
|
+
- [ ] Documentation update
|
|
9
|
+
|
|
10
|
+
## Checklist
|
|
11
|
+
- [ ] Tests added/updated
|
|
12
|
+
- [ ] Tests passing (`npm test`)
|
|
13
|
+
- [ ] Build successful (`npm run build`)
|
|
14
|
+
- [ ] Documentation updated
|
|
15
|
+
- [ ] Security considerations reviewed
|
|
16
|
+
|
|
17
|
+
## Related Issues
|
|
18
|
+
Fixes #(issue number)
|
|
19
|
+
|
|
20
|
+
## Screenshots (if applicable)
|
|
21
|
+
|
|
22
|
+
## Additional Notes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [20.x, 22.x]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v3
|
|
19
|
+
|
|
20
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
+
uses: actions/setup-node@v3
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: npm ci
|
|
27
|
+
|
|
28
|
+
- name: Run tests
|
|
29
|
+
run: npm test -- --run
|
|
30
|
+
|
|
31
|
+
- name: Run build
|
|
32
|
+
run: npm run build
|
|
33
|
+
|
|
34
|
+
- name: Run security audit
|
|
35
|
+
run: npm audit --production
|
|
36
|
+
|
|
37
|
+
lint:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v3
|
|
42
|
+
|
|
43
|
+
- name: Use Node.js
|
|
44
|
+
uses: actions/setup-node@v3
|
|
45
|
+
with:
|
|
46
|
+
node-version: 20.x
|
|
47
|
+
|
|
48
|
+
- name: Install dependencies
|
|
49
|
+
run: npm ci
|
|
50
|
+
|
|
51
|
+
- name: Run linter
|
|
52
|
+
run: npm run lint
|
package/BLUEPRINT.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Fivo Sense — Project Blueprint (A to Z)
|
|
2
|
+
|
|
3
|
+
<aside>
|
|
4
|
+
🛡️
|
|
5
|
+
|
|
6
|
+
**Fivo Sense** — open-source (MIT) AI security plugin jo *har* editor/AI-CLI mein chale. Iska dimaag = **FivoCore**, ek **neuro-symbolic taint-graph engine**: pakka code se poora data-flow map banata hai, phir host AI sirf har "input → dangerous sink" path judge karta hai. Natija: har vuln ka **taint-trace proof** ("input yahan se sink tak ja raha = isliye risky") + self-verified fix, aur destructive AI actions ka real-time block. Research-grade accuracy, ek patle free tool mein.
|
|
7
|
+
|
|
8
|
+
</aside>
|
|
9
|
+
|
|
10
|
+
## 1. Vision (one line)
|
|
11
|
+
|
|
12
|
+
> AI jo bhi code likhe woh secure ho jaaye — ek free, har-editor plugin jo guess nahi, **proof** deta hai.
|
|
13
|
+
>
|
|
14
|
+
|
|
15
|
+
## 2. The Problem
|
|
16
|
+
|
|
17
|
+
- AI-generated code mein **40–62% tak security flaws**. ([Contrast Security](https://www.contrastsecurity.com/glossary/vibe-coding))
|
|
18
|
+
- AI devs **3–4x tezi se commit, 10x rate se security issues**. ([Cloud Security Alliance](https://labs.cloudsecurityalliance.org/research/csa-research-note-ai-generated-code-vulnerability-surge-2026/))
|
|
19
|
+
- **Replit AI ne production database delete kar diya** (1,200+ records), mana karne ke baad bhi. ([SoftwareSeni](https://www.softwareseni.com/ai-generated-code-security-risks-why-vulnerabilities-increase-2-74x-and-how-to-prevent-them/))
|
|
20
|
+
- **Aaj ke AI scanners poora codebase "dump karke dekhte" hain** → context window choke ho jaata, whole-repo reasoning fail, isse vulns miss + false positives. ([SEI CMU](https://www.sei.cmu.edu/blog/evaluating-static-analysis-alerts-with-llms/), [Augment 2026](https://www.augmentcode.com/guides/ai-vulnerability-detection))
|
|
21
|
+
|
|
22
|
+
## 3. 🔬 Research Verdict — sirf ek architecture jeetta hai
|
|
23
|
+
|
|
24
|
+
Maine 30+ papers/benchmarks padhe. Nateeja ekdum saaf hai: na sirf rules, na sirf AI — **dono ka fusion (neuro-symbolic)** sabse upar hai.
|
|
25
|
+
|
|
26
|
+
| Approach | Accuracy (F1) | Dikkat |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| Sirf SAST (regex/rules) | 0.10 – 0.55 | rigid, context-blind |
|
|
29
|
+
| Sirf LLM (codebase dump) ← *aaj ke tools* | 0.61 – 0.68 | miss + noise, mehenga |
|
|
30
|
+
| **Neuro-Symbolic (static + LLM)** | **0.91 – 0.95** ✅ | best of both |
|
|
31
|
+
|
|
32
|
+
Sources: [systematic benchmark](https://www.researchgate.net/publication/397820307_Large_Language_Models_Versus_Static_Code_Analysis_Tools_A_Systematic_Benchmark_for_Vulnerability_Detection) (OWASP + CWE-Bench-Java, 2740+ cases), [IRIS — ICLR 2025](https://arxiv.org/html/2405.17238v3), [MoCQ](https://arxiv.org/html/2504.16057v2), [AdaTaint](https://arxiv.org/html/2511.04023v1) (FP −43.7%, recall +11.2%).
|
|
33
|
+
|
|
34
|
+
<aside>
|
|
35
|
+
💡
|
|
36
|
+
|
|
37
|
+
Teri intuition research mein word-by-word proven hai: "AI poora code dump karke dekhta hai" = pure-LLM scanners ki exact documented kamzori. Fix = **neuro-symbolic**.
|
|
38
|
+
|
|
39
|
+
</aside>
|
|
40
|
+
|
|
41
|
+
## 4. ⚠️ Honest Reality Check (build se PEHLE padho)
|
|
42
|
+
|
|
43
|
+
Is idea ke kayi tukde already bane hue hain — kuch free/MIT (Anthropic/Snyk/Cisco/Meta). Sirf "audit + block + undo" banaya to log bolenge *"ye to pehle se hai."*
|
|
44
|
+
|
|
45
|
+
| Feature | Already kaun | Free/MIT? |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| AI audit + fix | Anthropic security-guidance plugin (built-in) | Free |
|
|
48
|
+
| Pattern + diff + verifier (3 stages) | Wahi plugin | Free |
|
|
49
|
+
| Audit-as-plugin (7 analyzers) | Variant Systems OSS | MIT |
|
|
50
|
+
| Real-time block / guardrail | roboticforce/agent-guardrails, Meta LlamaFirewall, Codacy Guardrails | MIT/free |
|
|
51
|
+
| Undo | Claude Code Checkpointing (built-in), ccundo | Free |
|
|
52
|
+
| Agent supply-chain (skills/MCP) audit | Snyk agent-scan, AgentAuditKit (MIT), Cisco MCP Scanner | MIT/free |
|
|
53
|
+
|
|
54
|
+
<aside>
|
|
55
|
+
🚨
|
|
56
|
+
|
|
57
|
+
**Lekin yahan white-space hai:** neuro-symbolic taint-graph approach sirf **research papers** mein hai ([IRIS](https://arxiv.org/html/2405.17238v3), [MoCQ](https://arxiv.org/html/2504.16057v2)) — kisi ne ise **free + MIT + cross-editor + proof-generating plugin** ke roop mein package NAHI kiya. **Yahi FivoCore ka moat hai.** (Aur "app chala ke prove" karna impractical hai → iski jagah taint-trace proof.)
|
|
58
|
+
|
|
59
|
+
</aside>
|
|
60
|
+
|
|
61
|
+
## 5. 🧠 Core Architecture — FivoCore (Taint-Graph Neuro-Symbolic)
|
|
62
|
+
|
|
63
|
+
AI ko poora codebase **kabhi nahi** dete. 4 systematic steps:
|
|
64
|
+
|
|
65
|
+
**Step 1 — Deterministic Skeleton (pakka code, tree-sitter/AST):** poore code se **har untrusted input (source)** aur **har dangerous sink** (`eval`, SQL `query`, `exec`, `fs`, `innerHTML`…) nikaal ke ek **data-flow graph** banao. AI nahi — deterministic code. Fast, complete, har path covered. **Reachability-first:** sirf woh code aage bhejo jo bahar (API/input/route) se reachable hai → analysis surface karib 97% tak kam ([OpenAnt](https://arxiv.org/html/2606.19149)), AI ko aur focused.
|
|
66
|
+
|
|
67
|
+
**Step 2 — Host AI sirf SMART kaam (skill):** AI ko poora repo nahi — sirf **ek-ek source → sink PATH** do. AI judge kare: "yeh path sanitize hua ya nahi, exploitable hai ya nahi?" → [IRIS/AdaTaint](https://arxiv.org/html/2511.04023v1) method. Isse path miss nahi hota, AI focused (sasta+fast), aur false positives prune hote hain. **⚔️ Adversarial check:** phir AI ko "attacker" banao — "is path ko exploit kaise karoge?" Exploit na bane to FP samajh ke hatao; bane to "proven exploitable" ([OpenAnt](https://arxiv.org/html/2606.19149) / [Cloudflare VVS](https://blog.cloudflare.com/build-your-own-vulnerability-harness/)).
|
|
68
|
+
|
|
69
|
+
**Step 3 — 🧬 Taint-Trace Proof:** har finding ke saath exact `source → … → sink` path = concrete evidence "kyun risky". Aaj ke 99% tools sirf "suspicious lagta hai" bolte hain, **reachable/exploitable prove nahi karte** ([ZeroPath](https://zeropath.com/articles/code-security-platforms-reducing-false-positives)).
|
|
70
|
+
|
|
71
|
+
**Step 4 — Verify + Fix:** surgical patch suggest karo, phir **graph pe dobara verify** karo (regression na aaye) → [SecureFixAgent](https://arxiv.org/html/2509.16275v1) method (~3 iterations mein converge).
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
CODE
|
|
75
|
+
│
|
|
76
|
+
▼
|
|
77
|
+
[1] tree-sitter/AST → DATA-FLOW GRAPH (sources + sinks) ← pakka code
|
|
78
|
+
│
|
|
79
|
+
▼
|
|
80
|
+
[2] har source→sink PATH → HOST AI judge (sanitized? exploitable?) ← skill
|
|
81
|
+
│ └─► false positive? → prune
|
|
82
|
+
▼
|
|
83
|
+
[3] TAINT-TRACE PROOF: input → … → sink (exact evidence)
|
|
84
|
+
│
|
|
85
|
+
▼
|
|
86
|
+
[4] FIX suggest → graph pe re-verify → apply
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 6. Do Modes
|
|
90
|
+
|
|
91
|
+
- **Audit Mode (reactive):** purana/diff code scan → FivoCore se proof + verified fix.
|
|
92
|
+
- **Generation-Guard Mode (proactive):** jab AI code likh raha ho, `PreToolUse` hook real-time check kare → insecure code **likhne se pehle hi block/fix** = *secure-by-construction* ([Constitutional Spec-Driven research](https://arxiv.org/html/2602.02584v1)). Koi free + cross-editor + neuro-symbolic + MIT yeh nahi de raha.
|
|
93
|
+
|
|
94
|
+
## 7. Features (A to Z)
|
|
95
|
+
|
|
96
|
+
### Core
|
|
97
|
+
|
|
98
|
+
- **Neuro-symbolic audit** — injection/XSS/auth/unsafe-data, taint-graph + host AI.
|
|
99
|
+
- **Secret detection** — hardcoded keys/tokens (deterministic rules + AI confirm).
|
|
100
|
+
- **Self-verified auto-fix** — surgical patch, graph pe re-checked.
|
|
101
|
+
- **Dead-code + "code working" check** — usi graph se unused/unreachable + logic traps; **delete nahi**, project ke **`.fivosense/archive/`** mein move (pehle `.fivosense/` parent folder, uske andar `archive/`); `.fivosense/` default **gitignored** (commit clutter na ho, local restore easy) + optional `archiveCommit` flag se track bhi ho sake; `.gitignore` samjhe taaki already-ignored files dobara archive na ho aur zaroorat pe wapas laaya ja sake.
|
|
102
|
+
|
|
103
|
+
### Agent Safety
|
|
104
|
+
|
|
105
|
+
- **Agent guardrail** — `rm -rf`/`DROP TABLE`/mass-delete real-time block (hook, deterministic).
|
|
106
|
+
- **Undo** — snapshot restore jahan built-in checkpoint nahi.
|
|
107
|
+
|
|
108
|
+
### Signature
|
|
109
|
+
|
|
110
|
+
- **🧬 Taint-Trace Proof** — har finding ka exact data-flow path.
|
|
111
|
+
- **🧪 Optional PoC test** — ek failing security test; user apne already-working env mein chalaye.
|
|
112
|
+
|
|
113
|
+
### Distribution
|
|
114
|
+
|
|
115
|
+
- **🔥 Roast My Code** + **🛡️ Security Badge / Report Card** — viral wedge.
|
|
116
|
+
|
|
117
|
+
## 8. 🎯 Differentiation / USPs
|
|
118
|
+
|
|
119
|
+
1. **Neuro-symbolic taint-graph core (FivoCore)** — research-grade accuracy, ek free MIT cross-editor plugin mein. *(koi nahi deta)*
|
|
120
|
+
2. **Taint-trace exploitability proof** — har bug ka "kyun" with exact path.
|
|
121
|
+
3. **Generation-time block + audit** — dono modes.
|
|
122
|
+
4. **Cross-editor/CLI universal** — Claude Code, Cursor, Copilot, Windsurf, CLI, git hook.
|
|
123
|
+
5. **BYOK + host-AI** — no cloud, no data leak, free.
|
|
124
|
+
6. **Self-verifying fixes** (regression check).
|
|
125
|
+
7. **AI-powered FP pruning** → kam noise ([94–98% FP elimination research](https://arxiv.org/html/2601.18844v1)).
|
|
126
|
+
8. **Roast + shareable badge** — organic viral reach.
|
|
127
|
+
9. **MIT, fully open, no paywall.**
|
|
128
|
+
10. **Dead-code + working-check** bonus, usi graph se.
|
|
129
|
+
11. **⚔️ Adversarial verification** — AI attacker ban ke exploitability prove kare → "proven-exploitable" label + FP aur kam.
|
|
130
|
+
12. **Reachability-first scan** — sirf reachable code dekhe, surface karib 97% kam (tez + sasta).
|
|
131
|
+
|
|
132
|
+
## 9. Codebase Structure
|
|
133
|
+
|
|
134
|
+
```jsx
|
|
135
|
+
fivosense/
|
|
136
|
+
├── skill/ # SKILL.md + AGENTS.md (host AI path-judge instructions)
|
|
137
|
+
│ └── prompts/ # path-judge / roast / fix templates
|
|
138
|
+
├── engine/ # ★ FivoCore — asli IP
|
|
139
|
+
│ ├── graph.ts # tree-sitter → data-flow graph
|
|
140
|
+
│ ├── sources.ts # untrusted input catalog
|
|
141
|
+
│ ├── sinks.ts # dangerous sink catalog
|
|
142
|
+
│ ├── taint.ts # source→sink path tracer (proof)
|
|
143
|
+
│ ├── reach.ts # reachability filter (entry-point reachable)
|
|
144
|
+
│ ├── verify.ts # fix ke baad graph re-check
|
|
145
|
+
│ ├── adversary.ts # adversarial verify (AI attacker)
|
|
146
|
+
│ └── poc.ts # optional failing security test
|
|
147
|
+
├── hooks/
|
|
148
|
+
│ ├── agent.ts # PreToolUse intercept → block (exit 2)
|
|
149
|
+
│ └── git.ts # pre/post-push audit
|
|
150
|
+
├── rules/ # deterministic: destructive.ts, secrets.ts
|
|
151
|
+
├── core/ # scope (git diff) + orchestrator
|
|
152
|
+
├── features/ # roast.ts, badge.ts, fix.ts
|
|
153
|
+
├── ai/ # host-AI bridge + optional BYOK client
|
|
154
|
+
├── editors/ # thin adapters (vscode pehle)
|
|
155
|
+
└── cli/ # npx fivo-sense init
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## 10. Codebase Size
|
|
159
|
+
|
|
160
|
+
- **Engine (FivoCore):** ~3,000–5,000 lines TS — **apni koi AI model nahi**, tree-sitter ready-made (MIT).
|
|
161
|
+
- **Skill + hooks + rules + features:** ~1,500–2,000 lines + markdown.
|
|
162
|
+
- **Total realistic:** ~5k–7k lines — heavy enterprise SAST se bahut chhota, par "sirf prompt" se bahut zyada (yahi star/install laata hai).
|
|
163
|
+
|
|
164
|
+
## 11. Tech Stack (brief)
|
|
165
|
+
|
|
166
|
+
- **Language:** TypeScript (Node 20+).
|
|
167
|
+
- **Parsing:** tree-sitter (multi-language, MIT) — engine ka base.
|
|
168
|
+
- **AI:** host AI (CLI agents) + optional BYOK (Claude/OpenAI/Gemini/Ollama) for plain editors.
|
|
169
|
+
- **Packaging:** npm + VS Code Marketplace, GitHub MIT.
|
|
170
|
+
- **Tests:** Vitest + fixture buggy repos + golden findings set.
|
|
171
|
+
|
|
172
|
+
## 12. ❌ What NOT to Build
|
|
173
|
+
|
|
174
|
+
- Apni AI model / fine-tune — ❌ (host AI + skill kaafi)
|
|
175
|
+
- From-scratch parser/SAST — ❌ (tree-sitter use karo)
|
|
176
|
+
- 10MB knowledge packs — ❌ (host AI ko OWASP pata hai)
|
|
177
|
+
- Poora app auto-run sandbox — ❌ (impractical; taint-proof + optional PoC se kaam)
|
|
178
|
+
- Cloud backend / accounts / billing — ❌
|
|
179
|
+
|
|
180
|
+
## 13. Roadmap
|
|
181
|
+
|
|
182
|
+
**Phase 0 — Setup (~2-3 din):** repo, MIT, TS+Vitest, CLI skeleton.
|
|
183
|
+
|
|
184
|
+
**Phase 1 — FivoCore MVP (~2-3 hafte):** tree-sitter graph builder (JS/TS) + source/sink catalog + deterministic rules + `PreToolUse` block hook → core working.
|
|
185
|
+
|
|
186
|
+
**Phase 2 — Neuro-symbolic + Proof (~2-3 hafte):** host-AI path-judge + FP pruning + taint-trace proof output + self-verified fix + optional PoC. **Publish.**
|
|
187
|
+
|
|
188
|
+
**Phase 3 — Expand (~3-4 hafte):** generation-guard mode, dead-code, more languages/editors (Cursor/JetBrains/Neovim), roast/badge.
|
|
189
|
+
|
|
190
|
+
**Phase 4 — Launch:** npm + Marketplace + docs + demo gif + Product Hunt/Reddit/X.
|
|
191
|
+
|
|
192
|
+
## 14. Risks
|
|
193
|
+
|
|
194
|
+
- **False positives** → neuro-symbolic + AI pruning + severity tiers + allowlist.
|
|
195
|
+
- **Privacy** → BYOK + local-first; code server pe mat bhejo.
|
|
196
|
+
- **Prompt injection** → destructive actions hamesha rule-based block, AI pe nirbhar nahi.
|
|
197
|
+
- **Language coverage** → ek language se start (JS/TS), tree-sitter grammars se expand.
|
|
198
|
+
|
|
199
|
+
## 15. Positioning / Naam
|
|
200
|
+
|
|
201
|
+
- **Naam:** Fivo Sense (`/sense`)
|
|
202
|
+
- **Tagline:** *"Code ka sixth sense — proof-backed security, har editor mein, free."*
|
|
203
|
+
- **Target:** vibe coders, indie hackers, chhoti teams jo Snyk/Checkmarx afford nahi karte.
|
|
204
|
+
|
|
205
|
+
## 16. 📚 Research References
|
|
206
|
+
|
|
207
|
+
- [IRIS: LLM-Assisted Static Analysis (ICLR 2025)](https://arxiv.org/html/2405.17238v3) — neuro-symbolic, whole-repo, LLM taint specs.
|
|
208
|
+
- [MoCQ: Holistic Neuro-symbolic](https://arxiv.org/html/2504.16057v2) — LLM patterns → static queries.
|
|
209
|
+
- [AdaTaint](https://arxiv.org/html/2511.04023v1) — LLM source-sink + symbolic validation (FP −43.7%).
|
|
210
|
+
- [SecureFixAgent](https://arxiv.org/html/2509.16275v1) — verified iterative fix.
|
|
211
|
+
- [Reducing FPs with LLMs (industry study)](https://arxiv.org/html/2601.18844v1) — 94–98% FP elimination.
|
|
212
|
+
- [Systematic benchmark: LLM vs SAST vs hybrid](https://www.researchgate.net/publication/397820307_Large_Language_Models_Versus_Static_Code_Analysis_Tools_A_Systematic_Benchmark_for_Vulnerability_Detection).
|
|
213
|
+
- [Constitutional Spec-Driven Development](https://arxiv.org/html/2602.02584v1) — secure-by-construction.
|
|
214
|
+
|
|
215
|
+
[Fivo Sense — Build Process & Engineering Plan](https://app.notion.com/p/Fivo-Sense-Build-Process-Engineering-Plan-95edae10b52941dd853e99f4ff235b07?pvs=21)
|
package/BUILD_PLAN.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Fivo Sense — Build Process & Engineering Plan
|
|
2
|
+
|
|
3
|
+
<aside>
|
|
4
|
+
🛠️
|
|
5
|
+
|
|
6
|
+
**Build Process & Engineering Plan** — **FivoCore neuro-symbolic** approach. Asli IP = ek taint-graph engine (real code, copy-proof), AI sirf smart path-judge. Research-grade accuracy (F1 0.91–0.95), phir bhi lean. Ye main Blueprint ka companion hai.
|
|
7
|
+
|
|
8
|
+
</aside>
|
|
9
|
+
|
|
10
|
+
## 1. Build Philosophy
|
|
11
|
+
|
|
12
|
+
- **Engine = moat.** Asli value FivoCore (taint-graph) hai — yeh real code hai, copy/paste nahi ho sakta, install karna padta hai. *(Isiliye log star/fork/install karenge.)*
|
|
13
|
+
- **Neuro-symbolic split:** pakka code → data-flow graph (recall + completeness); host AI → har path judge (FP pruning + reasoning). [Research](https://arxiv.org/html/2405.17238v3) yahi jeetata hai.
|
|
14
|
+
- **AI ko poora codebase mat do** — sirf focused source→sink paths. Fast, sasta, accurate.
|
|
15
|
+
- **Reliability-critical (block/secret) deterministic**, AI sirf judgement.
|
|
16
|
+
- **Commodity dobara mat banao** — jo Anthropic/Snyk free de rahe unse mat lado; differentiator = proof + neuro-symbolic + cross-editor.
|
|
17
|
+
|
|
18
|
+
## 2. Tech Stack
|
|
19
|
+
|
|
20
|
+
| Cheez | Tech | Kyun |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| Engine base | tree-sitter (MIT, multi-lang) | AST → data-flow graph |
|
|
23
|
+
| Engine code | TypeScript (Node 20+) | graph, taint, verify |
|
|
24
|
+
| Path-judge | Host AI (skill) + optional BYOK | sanitized? exploitable? |
|
|
25
|
+
| Hooks | TypeScript | PreToolUse + git hooks |
|
|
26
|
+
| Packaging | npm + VS Code Marketplace | distribution |
|
|
27
|
+
| Tests | Vitest + fixture repos + golden set | accuracy regression |
|
|
28
|
+
|
|
29
|
+
## 3. Codebase Structure
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
fivosense/
|
|
33
|
+
├── package.json / README.md (MIT, badge, demo gif) / LICENSE
|
|
34
|
+
├── skill/
|
|
35
|
+
│ ├── SKILL.md # path-judge instructions (host AI)
|
|
36
|
+
│ ├── AGENTS.md # cross-CLI hookup
|
|
37
|
+
│ └── prompts/ # judge / roast / fix templates
|
|
38
|
+
├── engine/ # ★ FivoCore — asli IP
|
|
39
|
+
│ ├── graph.ts # tree-sitter → data-flow graph
|
|
40
|
+
│ ├── sources.ts # untrusted input catalog
|
|
41
|
+
│ ├── sinks.ts # dangerous sink catalog
|
|
42
|
+
│ ├── taint.ts # source→sink path tracer (proof)
|
|
43
|
+
│ ├── reach.ts # reachability filter (entry-point reachable)
|
|
44
|
+
│ ├── verify.ts # fix ke baad graph re-check
|
|
45
|
+
│ ├── adversary.ts # adversarial verify (AI attacker)
|
|
46
|
+
│ └── poc.ts # optional failing security test
|
|
47
|
+
├── hooks/
|
|
48
|
+
│ ├── agent.ts # PreToolUse intercept → block (exit 2)
|
|
49
|
+
│ └── git.ts # pre/post-push audit
|
|
50
|
+
├── rules/
|
|
51
|
+
│ ├── destructive.ts # rm -rf, DROP TABLE, mass delete
|
|
52
|
+
│ └── secrets.ts # API key / token regex
|
|
53
|
+
├── core/
|
|
54
|
+
│ ├── scope.ts # git diff → changed code
|
|
55
|
+
│ └── orchestrator.ts # flow control
|
|
56
|
+
├── features/ # roast.ts, badge.ts, fix.ts
|
|
57
|
+
├── ai/ # host-AI bridge + optional BYOK
|
|
58
|
+
├── editors/ # vscode.ts (pehla adapter)
|
|
59
|
+
├── cli/ # npx fivo-sense init
|
|
60
|
+
└── test/fixtures/ # jaan-boojh ke buggy repos
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 4. Codebase Size
|
|
64
|
+
|
|
65
|
+
| Stage | Size | Note |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| Engine (FivoCore) | ~3,000–5,000 lines TS | apni AI model nahi; tree-sitter ready-made |
|
|
68
|
+
| Skill + hooks + rules + features | ~1,500–2,000 lines + markdown | host AI chalaye |
|
|
69
|
+
| **Total realistic** | **~5k–7k lines** | heavy SAST se chhota, "sirf prompt" se bada |
|
|
70
|
+
|
|
71
|
+
<aside>
|
|
72
|
+
💡
|
|
73
|
+
|
|
74
|
+
Bulk reasoning host AI karta hai → koi 10MB knowledge pack nahi. Par engine (graph/taint) real compiled code hai — yahi serious product banata hai.
|
|
75
|
+
|
|
76
|
+
</aside>
|
|
77
|
+
|
|
78
|
+
## 5. Phase-by-Phase Build Plan
|
|
79
|
+
|
|
80
|
+
### Phase 0 — Setup · 3 kaam (~2-3 din)
|
|
81
|
+
|
|
82
|
+
- [ ] Repo + MIT + README skeleton
|
|
83
|
+
- [ ] TypeScript + Vitest + lint
|
|
84
|
+
- [ ] `npx fivo-sense init` skeleton
|
|
85
|
+
|
|
86
|
+
### Phase 1 — FivoCore MVP · 7 kaam (~2-3 hafte)
|
|
87
|
+
|
|
88
|
+
- [ ] `engine/graph.ts` — tree-sitter se JS/TS ka data-flow graph
|
|
89
|
+
- [ ] `engine/sources.ts` + `engine/sinks.ts` — input/sink catalog
|
|
90
|
+
- [ ] `engine/taint.ts` — source→sink path tracer
|
|
91
|
+
- [ ] `rules/destructive.ts` + `rules/secrets.ts`
|
|
92
|
+
- [ ] `hooks/agent.ts` — PreToolUse block (exit 2)
|
|
93
|
+
- [ ] `core/scope.ts` — git diff scope
|
|
94
|
+
- [ ] `engine/reach.ts` — reachability filter (sirf external entry-point se reachable code)
|
|
95
|
+
|
|
96
|
+
**Done when:** ek buggy fixture repo pe engine sahi source→sink paths nikaal de + destructive action block ho.
|
|
97
|
+
|
|
98
|
+
### Phase 2 — Neuro-Symbolic + Proof · 8 kaam (~2-3 hafte)
|
|
99
|
+
|
|
100
|
+
- [ ] `skill/SKILL.md` + path-judge prompt — host AI har path judge kare (sanitized? exploitable?)
|
|
101
|
+
- [ ] FP pruning (AI confirm)
|
|
102
|
+
- [ ] Taint-trace proof output (exact path findings mein)
|
|
103
|
+
- [ ] `features/fix.ts` + `engine/verify.ts` — self-verified fix
|
|
104
|
+
- [ ] `engine/poc.ts` — optional failing security test
|
|
105
|
+
- [ ] `engine/adversary.ts` — adversarial verify (AI attacker exploitability check)
|
|
106
|
+
- [ ] `features/roast.ts` + `features/badge.ts`
|
|
107
|
+
- [ ] `editors/vscode.ts` + `/sense` trigger → **Publish (npm + GitHub MIT)**
|
|
108
|
+
|
|
109
|
+
**Done when:** har finding ke saath data-flow proof + verified fix mile, FP under 10%.
|
|
110
|
+
|
|
111
|
+
### Phase 3 — Expand · 4 kaam (~3-4 hafte)
|
|
112
|
+
|
|
113
|
+
- [ ] Generation-guard mode (PreToolUse real-time secure-by-construction)
|
|
114
|
+
- [ ] Dead-code + "code working" mode (usi graph se) — dead-code **delete nahi**, project root ke **`.fivosense/archive/`** mein move (pehle `.fivosense/` ghar banta, uske andar `archive/`); `.fivosense/` default **gitignored** (commit clutter na ho, local restore easy) + optional `archiveCommit` flag se track bhi ho sake; `.gitignore` samajh ke already-ignored files dobara archive na kare — zaroorat pe wapas laaya ja sake
|
|
115
|
+
- [ ] More languages (tree-sitter grammars) + editors (Cursor/JetBrains/Neovim)
|
|
116
|
+
- [ ] Optional BYOK (`ai/client.ts`) for plain editors
|
|
117
|
+
|
|
118
|
+
### Phase 4 — Launch · 2 kaam (~1-2 hafte)
|
|
119
|
+
|
|
120
|
+
- [ ] VS Code Marketplace + npm + docs site
|
|
121
|
+
- [ ] Demo gif + launch post (Product Hunt / Reddit / X)
|
|
122
|
+
|
|
123
|
+
**Done when:** public, polished, MIT par live.
|
|
124
|
+
|
|
125
|
+
## 5.1 🔄 Git Push Audit — exact behaviour
|
|
126
|
+
|
|
127
|
+
- **Auto-trigger:** har `git push` se pehle apne aap chale (`pre-push` hook).
|
|
128
|
+
- **Pehli baar:** poora codebase audit → baseline result cache.
|
|
129
|
+
- **Incremental (aage har baar):** sirf `git diff` ka **badla hua code** scan → fast + sasta; saara repo dobara nahi.
|
|
130
|
+
- **Mode = `block` (default):** critical/high bug mile to push **ROK** + reason + fix dikhae.
|
|
131
|
+
- **Mode = `warn-only`:** sirf warning, push jaane do (rokega nahi).
|
|
132
|
+
- **Severity threshold:** config se set — kis level pe roke (sirf critical / ya high+).
|
|
133
|
+
- **Escape hatch:** emergency mein `git push --no-verify` ya `fivosense skip`.
|
|
134
|
+
- **Cache:** pichhle findings cache; sirf naya diff re-judge hota hai (tez).
|
|
135
|
+
- **Config file:** `.fivosense.json` — mode, threshold, ignore paths.
|
|
136
|
+
|
|
137
|
+
## 6. Bade pieces kaise banenge (mini how-to)
|
|
138
|
+
|
|
139
|
+
- **Graph builder (`graph.ts`):** tree-sitter grammar load → parse → AST traverse → variables + function calls ka data-flow graph; har node tag (source / sink / pass-through).
|
|
140
|
+
- **Taint tracer (`taint.ts`):** har sink se peeche (backward) trace → agar koi untrusted source tak bina sanitizer ke pahunche → "tainted path" mark, exact hops record (= proof).
|
|
141
|
+
- **Path-judge (skill):** sirf woh ek path AI ko do → AI bole exploitable hai ya FP → noise kam.
|
|
142
|
+
- **PreToolUse hook:** agent ka proposed action read → rules + (Phase 3) live graph check → dangerous to exit code 2 + reason.
|
|
143
|
+
- **Verify (`verify.ts`):** fix apply ke baad graph dobara banao → tainted path gaya? regression aaya? confirm.
|
|
144
|
+
- **PoC (`poc.ts`):** tainted path ke liye chhota failing test; user apne env mein chalaye.
|
|
145
|
+
- **Badge:** findings → grade A–F → README markdown badge string.
|
|
146
|
+
- **Reachability filter (`reach.ts`):** graph se sirf woh nodes rakho jo external entry-point (API/route/input) se pahunche → surface karib 97% kam ([OpenAnt](https://arxiv.org/html/2606.19149)), AI ko kam kaam.
|
|
147
|
+
- **Adversarial verify (`adversary.ts`):** path-judge ke baad AI ko attacker banao — "is path ko exploit kaise karoge?" exploit na bane to FP; bane to "proven exploitable" label.
|
|
148
|
+
|
|
149
|
+
## 7. Testing & Quality (per-component accuracy targets)
|
|
150
|
+
|
|
151
|
+
| Component | Tarika | Target |
|
|
152
|
+
| --- | --- | --- |
|
|
153
|
+
| Graph/taint recall | fixture vulns | pakad ~85–95% |
|
|
154
|
+
| AI path-judge (FP pruning) | golden set | FP **under 10%** |
|
|
155
|
+
| Auto-fix | re-verify | regression ~0 |
|
|
156
|
+
| Overall (neuro-symbolic) | OWASP-style fixtures | F1 ~0.90+ ([research benchmark](https://www.researchgate.net/publication/397820307_Large_Language_Models_Versus_Static_Code_Analysis_Tools_A_Systematic_Benchmark_for_Vulnerability_Detection)) |
|
|
157
|
+
- **Fixture repos:** jaan-boojh ke buggy code → har release pe run → regression pakdo.
|
|
158
|
+
- **Golden findings set:** known vulns kitne pakde + kitne FP measure karo.
|
|
159
|
+
|
|
160
|
+
## 8. Build Timeline (summary)
|
|
161
|
+
|
|
162
|
+
| Phase | Kya milta hai | Time |
|
|
163
|
+
| --- | --- | --- |
|
|
164
|
+
| 0 | Setup | ~2-3 din |
|
|
165
|
+
| 1 | FivoCore engine (graph + taint + rules + block) | ~2-3 hafte |
|
|
166
|
+
| 2 | Neuro-symbolic path-judge + proof + verified fix — SHIP | ~2-3 hafte |
|
|
167
|
+
| 3 | Generation-guard + dead-code + more langs/editors | ~3-4 hafte |
|
|
168
|
+
| 4 | Launch | ~1-2 hafte |
|
|
169
|
+
|
|
170
|
+
<aside>
|
|
171
|
+
🚀
|
|
172
|
+
|
|
173
|
+
**Sabse zaroori:** engine (graph + taint) hi asli moat hai — Phase 1-2 mein isi pe focus. Yeh "sirf skill" nahi, real research-grade product hai → isliye log star/install karenge.
|
|
174
|
+
|
|
175
|
+
</aside>
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Contributing to FivoSense
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to FivoSense! 🎉
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. Fork the repository
|
|
8
|
+
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/sense.git`
|
|
9
|
+
3. Install dependencies: `npm install`
|
|
10
|
+
4. Run tests: `npm test`
|
|
11
|
+
|
|
12
|
+
## Development
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Watch mode for development
|
|
16
|
+
npm run dev
|
|
17
|
+
|
|
18
|
+
# Run tests
|
|
19
|
+
npm test
|
|
20
|
+
|
|
21
|
+
# Build
|
|
22
|
+
npm run build
|
|
23
|
+
|
|
24
|
+
# Lint
|
|
25
|
+
npm run lint
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Project Structure
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
src/
|
|
32
|
+
├── engine/ # Core analysis engine
|
|
33
|
+
├── features/ # User-facing features
|
|
34
|
+
├── rules/ # Detection rules
|
|
35
|
+
├── ai/ # AI integration
|
|
36
|
+
├── hooks/ # Agent hooks
|
|
37
|
+
├── editors/ # Editor adapters
|
|
38
|
+
└── cli/ # Command-line interface
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Adding a New Detection Pattern
|
|
42
|
+
|
|
43
|
+
1. Add source pattern to `src/engine/sources.ts`
|
|
44
|
+
2. Add sink pattern to `src/engine/sinks.ts`
|
|
45
|
+
3. Add tests to `test/engine.test.ts`
|
|
46
|
+
4. Update documentation
|
|
47
|
+
|
|
48
|
+
## Code Style
|
|
49
|
+
|
|
50
|
+
- TypeScript strict mode
|
|
51
|
+
- Descriptive variable names
|
|
52
|
+
- Comments for complex logic
|
|
53
|
+
- Tests for all new features
|
|
54
|
+
|
|
55
|
+
## Submitting Changes
|
|
56
|
+
|
|
57
|
+
1. Create a feature branch: `git checkout -b feature/your-feature`
|
|
58
|
+
2. Make your changes
|
|
59
|
+
3. Add tests
|
|
60
|
+
4. Run tests: `npm test`
|
|
61
|
+
5. Commit: `git commit -m "feat: your feature"`
|
|
62
|
+
6. Push: `git push origin feature/your-feature`
|
|
63
|
+
7. Open a Pull Request
|
|
64
|
+
|
|
65
|
+
## Commit Convention
|
|
66
|
+
|
|
67
|
+
- `feat:` New feature
|
|
68
|
+
- `fix:` Bug fix
|
|
69
|
+
- `docs:` Documentation
|
|
70
|
+
- `test:` Tests
|
|
71
|
+
- `refactor:` Code refactoring
|
|
72
|
+
- `chore:` Maintenance
|
|
73
|
+
|
|
74
|
+
## Questions?
|
|
75
|
+
|
|
76
|
+
Open an issue or discussion on GitHub!
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|