Skip to content

πŸ›‘οΈ MoltBlock - The Moltbook Protector | Security Gateway for AI Agents | Protect your AI from accidentally leaking sensitive data

License

Notifications You must be signed in to change notification settings

elazarprojects/moltblock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MoltBlock - The Moltbook Protector

πŸ›‘οΈ Security Gateway for AI Agents πŸ›‘οΈ

Protect your AI agents from accidentally leaking sensitive information when posting to social networks.

Python License Platform


πŸš€ Quick Start

Installation

# Clone repository
git clone https://github.com/elazarprojects/moltblock.git
cd moltblock

# Install package (this automatically installs all dependencies)
pip install -e .

# Run setup wizard
moltblock

That's it! The pip install -e . command will automatically install all required dependencies from pyproject.toml, and then the interactive wizard will guide you through the rest.

Note: If you encounter any issues with dependencies, you can manually install them with:

pip install -r requirements.txt

For detailed installation instructions, troubleshooting, and alternative methods, see docs/INSTALLATION.md.


πŸ“– What is MoltBlock?

MoltBlock is a security gateway that sits between your AI agents and the internet, scanning all outbound messages for sensitive information before they're posted to AI-focused social networks like:

  • 🌐 Moltbook.com - Social network for AI agents
  • 🀝 TheColony.cc - AI agent community
  • πŸ“ Clawstr.com - AI content platform

The Problem

AI Agents can accidentally leak sensitive data:

  • πŸ”‘ API keys (OpenAI, AWS, GitHub)
  • πŸ” Passwords and tokens
  • πŸ“§ Personal information (email, phone)
  • πŸ’³ Financial data (credit cards, SSN)
  • πŸͺ™ Crypto wallet addresses
  • πŸ—οΈ SSH keys and certificates

The Solution

MoltBlock intercepts every POST request to monitored platforms, scans the content, and requires your approval before sending anything suspicious.

Key Features:

  • βœ… Two Protection Modes: Port Mode (easy) or Network Monitor (bulletproof)
  • βœ… Two Scanning Modes: Regex-based (fast) or AI-powered (smart)
  • βœ… Multiple Alert Channels: Desktop notifications + Telegram bot
  • βœ… Fail-Closed Design: If in doubt, block it
  • βœ… Persistent Alerts: Approve/block even after CLI restart

🎯 Use Cases

For Developers

  • Prevent accidental API key leaks during development
  • Test AI agents safely before production
  • Learn what your agents are trying to post

For Organizations

  • Protect sensitive internal information
  • Comply with data protection regulations
  • Audit AI agent communications

For Researchers

  • Study AI agent behavior safely
  • Prevent unintended data exposure
  • Control what your agents share publicly

πŸ—οΈ How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  AI Agent    β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚ POST request
       v
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MoltBlock Proxy             β”‚
β”‚  β€’ Intercepts request        β”‚
β”‚  β€’ Scans content             β”‚
β”‚  β€’ Detects sensitive data    β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β”œβ”€ Safe ────────────────> βœ… Forward to internet
       β”‚
       └─ Dangerous ──> 🚨 Alert user ──┬─> Approved ──> βœ… Forward
                                         └─> Blocked ───> 🚫 Block (403)

πŸ› οΈ Features

Protection Modes

Port Mode

  • AI agent configured to use proxy via environment variables
  • No admin rights required
  • Easy setup for development
  • ⚠️ Agent can bypass if compromised
set HTTP_PROXY=http://127.0.0.1:8080
set HTTPS_PROXY=http://127.0.0.1:8080
python your_agent.py

Network Monitor Mode

  • System-wide traffic interception
  • Requires administrator privileges
  • Agent cannot bypass even if compromised
  • Recommended for production

Scanning Modes

Dumb Mode (Regex-based)

  • ⚑ Ultra-fast (< 10ms per request)
  • πŸ”Œ Works offline
  • πŸ’° Free, no API costs
  • 🎯 3 sensitivity levels

Level 1 - Paranoid: Blocks everything suspicious (many false positives)
Level 2 - Moderate: Balanced security vs usability βœ… Recommended
Level 3 - Strict: Only high-value secrets (API keys, credit cards)

Smart Mode (AI-powered)

  • 🧠 Context-aware scanning
  • βœ… Fewer false positives
  • 🌐 Requires LLM API (Anthropic, OpenAI, Google, etc.)
  • πŸ’Έ Small cost per request ($0.0001-0.001)

Level 1 - Ultra-Strict: Blocks PII, system info, everything identifiable
Level 2 - Moderate: Blocks credentials and identifying info βœ… Recommended
Level 3 - Basic: Only explicit secrets

Alert Channels

Desktop Notifications

  • Windows toast notifications
  • Always enabled (read-only)
  • Quick visibility

Telegram Bot

  • Interactive approve/block buttons
  • Real-time decision making
  • Works even when CLI is closed

CLI Interface

  • Live alert log
  • Approve/block by ID
  • Persistent alert history

πŸ“Έ Screenshots

Setup Wizard

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     πŸ›‘οΈ  MoltBlock Setup Wizard        β”‚
β”‚           Version 1.0.0                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

[1/6] Choose Protection Mode

  [1] Port Mode (Recommended for Development)
  [2] Network Monitor Mode (Recommended for Production)

Enter choice [1-2]: _

Active Protection

πŸ›‘οΈ  MoltBlock Protection Active

  Status: Running
  Mode: Network Monitor (cannot be bypassed)
  Scanning: Smart Mode - Level 2 (Moderate)
  
  Monitored Platforms: 3
  Requests Scanned: 47
  Alerts Generated: 5

[LOG]
[19:25:30] ⚠️ ALERT #42: Potential API key detected!
[19:25:30] ⏳ Waiting for user decision... (60s timeout)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ALERT #42 - CRITICAL                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Domain:     thecolony.cc                    β”‚
β”‚ Detected:   OpenAI API Key                  β”‚
β”‚ Pattern:    sk-proj-[...]                   β”‚
β”‚                                             β”‚
β”‚ [A] Approve     [B] Block     [V] View      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

βš™οΈ Configuration

Configuration is stored in C:\ProgramData\MoltBlock\config.yaml:

# Protection Mode
protection:
  mode: "network_monitor"  # port | network_monitor
  monitored_domains:
    - "moltbook.com"
    - "thecolony.cc"
    - "clawstr.com"

# Scanning
scanning:
  mode: "smart"  # dumb | smart
  
  dumb_mode:
    level: 2  # 1=Paranoid, 2=Moderate, 3=Strict
  
  smart_mode:
    level: 2  # 1=Ultra-Strict, 2=Moderate, 3=Basic
    provider: "anthropic"
    model: "claude-haiku-4-5"
    api_key: "${ANTHROPIC_API_KEY}"

# Alerts
alerts:
  desktop:
    enabled: true
  
  telegram:
    enabled: true
    bot_token: "${TELEGRAM_BOT_TOKEN}"
    chat_id: "${TELEGRAM_CHAT_ID}"
  
  timeout: 60  # Auto-block after 60 seconds

πŸ§ͺ Testing Your Setup

# Start MoltBlock
moltblock

# In another terminal, test with Python
python -c "import requests; r = requests.post('https://moltbook.com/api/posts', json={'content': 'My API key is sk-proj-test123'}, verify=False); print(r.text)"

You should see an alert! 🚨


πŸ“‹ CLI Commands

# Start MoltBlock (auto-detects first run vs normal run)
moltblock

# Run setup wizard again (reconfigure)
moltblock setup  # (from main menu)

# View pending alerts
moltblock  # β†’ Choose option [2]

# View alert history
moltblock  # β†’ Choose option [3]

πŸ” Security Considerations

What MoltBlock Protects Against

βœ… Accidental data leaks by AI agents
βœ… Prompt injection attacks that extract secrets
βœ… Agent bugs that expose sensitive info
βœ… Copy-paste errors in agent code

What MoltBlock Does NOT Protect Against

❌ Intentional exfiltration by malicious users
❌ Attacks outside monitored platforms
❌ Data already posted before MoltBlock was installed
❌ Non-HTTP communication channels

Privacy

  • πŸ”’ All data stays on your machine
  • πŸ”’ Certificates are local-only
  • πŸ”’ Alert history stored locally
  • πŸ”’ LLM API calls only for Smart Mode (you choose provider)

🀝 Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

Development Setup

# Clone repository
git clone https://github.com/elazarprojects/moltblock.git
cd moltblock

# Create virtual environment (recommended)
python -m venv venv
venv\Scripts\activate  # Windows

# Install in development mode with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Code formatting
black moltblock/
ruff check moltblock/

πŸ“š Documentation

User Guides

  • πŸš€ Installation Guide - Detailed installation instructions & troubleshooting
  • πŸ“– Quick Start - Get started in 5 minutes
  • πŸ“± Telegram Setup - Configure Telegram notifications
  • ❓ FAQ - Frequently asked questions

πŸ—ΊοΈ Roadmap

v1.0 (Current) - Windows CLI

  • βœ… Port Mode & Network Monitor Mode
  • βœ… Dumb Mode & Smart Mode scanning
  • βœ… Desktop & Telegram alerts
  • βœ… Windows support only

v1.1 (Planned)

  • macOS support
  • Linux support
  • GUI version (Tauri/Electron)
  • Custom regex patterns

v2.0 (Future)

  • Browser extension
  • Cloud sync
  • Team dashboard
  • More AI platforms

πŸ“„ License

This project is licensed under the MIT License - see LICENSE file for details.


πŸ™ Acknowledgments

  • mitmproxy - Powerful HTTPS proxy framework
  • LiteLLM - Unified LLM API interface
  • Rich - Beautiful terminal output
  • Click - CLI framework

πŸ“ž Support


⚠️ Disclaimer

MoltBlock is a security tool designed to help prevent data leaks. It is not a guarantee of absolute security. Always review your AI agent's code and monitor its behavior.

Use at your own risk.


Built with ❀️ by Elazar to protect AI agents from data leaks. i ❀️ you πŸ€–

Star ⭐ this repo if you find it useful!

About

πŸ›‘οΈ MoltBlock - The Moltbook Protector | Security Gateway for AI Agents | Protect your AI from accidentally leaking sensitive data

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages