Building 70 Projects ranging from beginner to advanced so anyone can β learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company π
Go aicertificationcloud-engineeringcybercybersecuritycybersecurity-analystcybersecurity-certificationcybersecurity-certificationscybersecurity-educationcybersecurity-jobscybersecurity-portfoliocybersecurity-projectscybersecurity-toolsgrchackinglearningpentestingproject-repositoryprojetcspython
in progress debugging checkpoint
CarterPerez-dev7b061955e0d5
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlindex eff214e1..3831982f 100755--- a/.github/workflows/lint.yml+++ b/.github/workflows/lint.yml@@ -19,7 +19,7 @@ jobs:defaults:run:- working-directory: PROJECTS/api-security-scanner/backend+ working-directory: PROJECTS/backendsteps:- name: Checkout code@@ -34,7 +34,7 @@ jobs:uses: actions/cache@v4with:path: ~/.cache/pip- key: ${{ runner.os }}-pip-${{ hashFiles('PROJECTS/api-security-scanner/backend/pyproject.toml') }}+ key: ${{ runner.os }}-pip-${{ hashFiles('PROJECTS/backend/pyproject.toml') }}restore-keys: |${{ runner.os }}-pip-@@ -49,10 +49,10 @@ jobs:echo "Running pylint..."if pylint . > pylint-output.txt 2>&1; thenecho "PYLINT_PASSED=true" >> $GITHUB_ENV- echo "β No pylint errors found!"+ echo "No pylint errors found!"elseecho "PYLINT_PASSED=false" >> $GITHUB_ENV- echo "β οΈ Pylint found issues!"+ echo "Pylint found issues!"ficat pylint-output.txtcontinue-on-error: true@@ -63,10 +63,10 @@ jobs:echo "Running ruff check..."if ruff check . > ruff-output.txt 2>&1; thenecho "RUFF_PASSED=true" >> $GITHUB_ENV- echo "β No ruff errors found!"+ echo "No ruff errors found!"elseecho "RUFF_PASSED=false" >> $GITHUB_ENV- echo "β οΈ Ruff found issues"+ echo "Ruff found issues"ficat ruff-output.txtcontinue-on-error: true@@ -77,10 +77,10 @@ jobs:echo "Running mypy..."if mypy . > mypy-output.txt 2>&1; thenecho "MYPY_PASSED=true" >> $GITHUB_ENV- echo "β No mypy errors found"+ echo "No mypy errors found"elseecho "MYPY_PASSED=false" >> $GITHUB_ENV- echo "β οΈ Mypy found issues"+ echo "Mypy found issues"ficat mypy-output.txtcontinue-on-error: true@@ -90,15 +90,15 @@ jobs:if: github.event_name == 'pull_request'run: |{- echo '## π Lint & Type Check Results'+ echo '##Lint & Type Check Results'echo ''# Pylint Statusif [[ "${{ env.PYLINT_PASSED }}" == "true" ]]; then- echo '### β Pylint: **Passed**'+ echo '###Pylint: **Passed**'echo 'No pylint issues found.'else- echo '### β οΈ Pylint: **Issues Found**'+ echo '###Pylint: **Issues Found**'echo '<details><summary>View pylint output</summary>'echo ''echo '```'@@ -110,7 +110,7 @@ jobs:# Ruff Statusif [[ "${{ env.RUFF_PASSED }}" == "true" ]]; then- echo '### β Ruff: **Passed**'+ echo '###Ruff: **Passed**'echo 'No ruff issues found.'elseecho '### β οΈ Ruff: **Issues Found**'@@ -125,10 +125,10 @@ jobs:# Mypy Statusif [[ "${{ env.MYPY_PASSED }}" == "true" ]]; then- echo '### β Mypy: **Passed**'+ echo '### Mypy: **Passed**'echo 'No mypy issues found.'else- echo '### β οΈ Mypy: **Issues Found**'+ echo '### Mypy: **Issues Found**'echo '<details><summary>View mypy output</summary>'echo ''echo '```'diff --git a/.gitignore b/.gitignorenew file mode 100644index 00000000..07c4b1c3--- /dev/null+++ b/.gitignore@@ -0,0 +1,2 @@+cyber-proj+*.cachediff --git a/PROJECTS/Aenebris/.angela/NEXT_websockets-prep.md b/PROJECTS/Aenebris/.angela/NEXT_websockets-prep.mdnew file mode 100644index 00000000..00375aec--- /dev/null+++ b/PROJECTS/Aenebris/.angela/NEXT_websockets-prep.md@@ -0,0 +1,227 @@+# WebSocket Implementation - Research & Prep (Milestone 1.5)++**Created:** 2025-11-16+**Status:** Planning Phase++---++## π― **The REAL Goal**++Not just "make WebSockets work" - that's easy.+**Make WebSockets BETTER than nginx** and **solve the streaming/WebSocket conflict** that nginx has.++### **The Problem We're Solving** (From Real Experience)++> "streaming doesn't even work for me, and I remember hearing a while ago I have no clue if true but the thing to allow websockets to work conflict with what makes streaming work in nginx so I can't have both working"++**THIS is our target:** Make WebSockets + Streaming work SIMULTANEOUSLY without conflicts.++Nginx config issues:+- `proxy_buffering off` needed for streaming (Ollama AI)+- `proxy_http_version 1.1` + `Upgrade` + `Connection "upgrade"` needed for WebSockets+- Timeouts configured differently (`proxy_read_timeout 86400` for WebSockets vs `300s` for streaming)+- They conflict in nginx - can't have both perfect++**Our advantage:** We're building from scratch in Haskell - we can do BOTH right by design!++---++## π§ **Key Questions to Research**++### 1. **Technical Questions**+- How does WAI/Warp handle WebSocket upgrades natively?+- Does Haskell's `websockets` library play nice with Warp?+- How do we detect WebSocket handshake vs regular HTTP?+- Can we proxy WebSocket frames without parsing them? (performance)+- How do we handle bidirectional streaming efficiently? (use STM channels? conduits?)++### 2. **The Conflict Question** β οΈ+- WHY do streaming and WebSockets conflict in nginx?+- Is it buffering? Connection reuse? Timeout handling?+- How do we architect to avoid this entirely?++### 3. **Performance Questions**+- What's the overhead of proxying WebSocket frames?+- Can we do zero-copy WebSocket proxying?+- How do we handle thousands of concurrent WebSocket connections?+- Memory usage per connection?++### 4. **Protocol Questions**+- WebSocket handshake: do we validate or just proxy it?+- Do we need to parse WebSocket frames or pass through opaque?+- How do we handle WebSocket extensions (compression, etc.)?+- ping/pong frame handling - proxy or handle ourselves?++---++## π **Research Needed**++### **Existing Research Docs**+We have:+- β `http2-http3.md` - might have streaming info+- β `performance-optimization.md` - zero-copy, memory efficiency+- β `tls-ssl.md` - secure WebSockets (wss://)++Need to READ for relevant info.++### **New Research Required**++#### **1. Modern WebSocket Best Practices (2024/2025)**+Sources to search:+- RFC 6455 (WebSocket protocol) - official spec+- Haskell `websockets` library docs - latest version+- Warp WebSocket examples - production patterns+- Stack Overflow - "nginx websocket streaming conflict" - find the root cause!+- Modern WebSocket proxying techniques - what's changed since 2020?++#### **2. Haskell-Specific Patterns**+- How does `websockets` library integrate with WAI?+- Conduit vs Pipes vs Streaming for bidirectional data?+- STM patterns for WebSocket message routing?+- Resource cleanup on connection drop?++#### **3. Performance Benchmarks**+- What's nginx WebSocket performance? (baseline)+- What's Warp native WebSocket performance?+- Overhead of proxying vs direct serving?+- Can we beat nginx?++#### **4. Real-World Problems**+Search for:+- "nginx websocket not working"+- "nginx streaming chunked transfer"+- "websocket proxy buffering issues"+- "socket.io nginx configuration problems"++Learn from what DOESN'T work!++---++## ποΈ **High-Level Implementation Plan** (Tentative)++### **Phase 1: Detection & Handshake**+**Goal:** Detect WebSocket upgrade request, proxy handshake++```+Request comes in β Check headers (Upgrade: websocket) β+ If YES: WebSocket path+ If NO: Normal HTTP path (existing code)+```++**Key:** Don't break existing HTTP proxying!++### **Phase 2: Connection Upgrade**+**Goal:** Establish proxy connection to backend WebSocket++```+Client ββ Proxy ββ Backend+ WebSocket WebSocket+```++**Challenge:** Maintain two WebSocket connections, proxy frames bidirectionally++### **Phase 3: Bidirectional Streaming**+**Goal:** Stream frames in BOTH directions simultaneously++```haskell+-- Conceptual:+forkIO $ forever $ do+ clientFrame <- receiveFromClient+ sendToBackend clientFrame++forkIO $ forever $ do+ backendFrame <- receiveFromBackend+ sendToClient backendFrame+```++**Challenge:** Handle connection drops, timeouts, proper cleanup++### **Phase 4: Integration with Streaming**+**Goal:** Ensure WebSockets + chunked transfer streaming coexist++**Test Case:**+- WebSocket on `/api/socket.io/`+- Chunked streaming on `/api/ollama/stream`+- BOTH working simultaneously without conflicts!++---++## β **Open Questions & Decisions**++### **1. Library Choice**+**Options:**+- A) Use `websockets` library (mature, battle-tested)+- B) Use Warp's native WebSocket support+- C) Roll our own (probably stupid)++**Need to research:** Which integrates better with our existing WAI app?++### **2. Frame Handling**+**Options:**+- A) Parse WebSocket frames (inspect, modify, validate)+- B) Proxy frames opaquely (zero-copy, faster, less control)++**Trade-off:** Performance vs observability/security++### **3. Connection State**+**How to track WebSocket connections?**+- Add to load balancer stats?+- Separate WebSocket connection pool?+- Integrate with health checking?++### **4. Timeout Strategy**+**Nginx problem:** Different timeouts for HTTP vs WebSocket vs Streaming++**Our approach:**+- Configurable per-route?+- Detect connection type and auto-adjust?+- Global defaults with overrides?++---++## π― **Success Criteria**++**Minimum (Just Working):**+- β Detects WebSocket handshake+- β Proxies upgrade to backend+- β Bidirectional frame proxying+- β Handles connection drops++**Good (Better than Basic):**+- β Zero-copy frame proxying (performance)+- β Works with TLS (wss://)+- β Integrates with load balancing+- β Health checks don't break WebSockets++**Excellent (Better than Nginx):**+- β **WebSockets + Streaming work SIMULTANEOUSLY without conflicts**+- β Auto-detection (no special config needed for WebSockets)+- β Better error messages than nginx+- β Observable (metrics on WebSocket connections)+- β Faster than nginx WebSocket proxying++---++## π **Next Steps**++1. **Read existing research docs** (http2-http3.md, performance-optimization.md)+2. **Deep dive into websockets library** - read source if needed+3. **Find nginx conflict root cause** - search Stack Overflow, GitHub issues+4. **Study WAI WebSocket examples** - how does Warp do it natively?+5. **Benchmark nginx WebSocket performance** - set a target to beat+6. **Design the architecture** - how it integrates with existing Proxy.hs+7. **Write research doc** - `websockets-implementation.md` with full details++**Then:** Start coding with confidence, knowing we have a solid plan!++---++## π‘ **Insights to Remember**++- WebSockets are just HTTP upgrades - leverage existing HTTP proxying code+- Bidirectional = two concurrent loops, not sequential+- Connection cleanup is critical - use `bracket` pattern+- Performance matters - socket.io can have 1000s of connections+- The nginx conflict is REAL - don't repeat their mistakes++**Philosophy:** Research first, code smart, build something genuinely better.diff --git a/PROJECTS/Aenebris/docs/research/config-design.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/config-design.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/config-design.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/config-design.mddiff --git a/PROJECTS/Aenebris/docs/research/ddos-mitigation.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/ddos-mitigation.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/ddos-mitigation.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/ddos-mitigation.mddiff --git a/PROJECTS/Aenebris/docs/research/deployment.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/deployment.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/deployment.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/deployment.mddiff --git a/PROJECTS/Aenebris/docs/research/haskell-networking.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/haskell-networking.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/haskell-networking.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/haskell-networking.mddiff --git a/PROJECTS/Aenebris/docs/research/http2-http3.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/http2-http3.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/http2-http3.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/http2-http3.mddiff --git a/PROJECTS/Aenebris/docs/research/load-balancing.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/load-balancing.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/load-balancing.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/load-balancing.mddiff --git a/PROJECTS/Aenebris/docs/research/ml-bot-detection.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/ml-bot-detection.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/ml-bot-detection.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/ml-bot-detection.mddiff --git a/PROJECTS/Aenebris/docs/research/performance-optimization.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/performance-optimization.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/performance-optimization.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/performance-optimization.mddiff --git a/PROJECTS/Aenebris/docs/research/rate-limiting.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/rate-limiting.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/rate-limiting.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/rate-limiting.mddiff --git a/PROJECTS/Aenebris/docs/research/tls-ssl.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/tls-ssl.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/tls-ssl.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/tls-ssl.mddiff --git a/PROJECTS/Aenebris/docs/research/waf-design.md b/PROJECTS/Aenebris/docs/proxy-haskell-research/waf-design.mdsimilarity index 100%rename from PROJECTS/Aenebris/docs/research/waf-design.mdrename to PROJECTS/Aenebris/docs/proxy-haskell-research/waf-design.mddiff --git a/PROJECTS/api-security-scanner/.env.example b/PROJECTS/api-security-scanner/.env.exampleindex e9596bf6..66a0a3b7 100644--- a/PROJECTS/api-security-scanner/.env.example+++ b/PROJECTS/api-security-scanner/.env.example@@ -9,8 +9,6 @@ VERSION="1.0.0"DEBUG=true# Security-# IMPORTANT: Generate a secure random key for production!-# Example: openssl rand -hex 32SECRET_KEY=your-secret-key-change-this-in-productionALGORITHM=HS256ACCESS_TOKEN_EXPIRE_MINUTES=1440@@ -24,14 +22,13 @@ POSTGRES_HOST=localhostPOSTGRES_PORT=5432# Database URL (overridden by docker-compose for container networking)-DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}+DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}# Backend APIBACKEND_HOST=0.0.0.0BACKEND_PORT=8000# CORS Origins (comma-separated for multiple origins)-# Include both direct Vite dev server (5173) and nginx proxy (80)CORS_ORIGINS=http://localhost:5173,http://localhost:3000,http://localhost,http://localhost:8000# Frontend API URLdiff --git a/PROJECTS/api-security-scanner/.pre-commit-config.yaml b/PROJECTS/api-security-scanner/.pre-commit-config.yamlnew file mode 100755index 00000000..68e6fa88--- /dev/null+++ b/PROJECTS/api-security-scanner/.pre-commit-config.yaml@@ -0,0 +1,34 @@+# .pre-commit-config.yaml++repos:+ - repo: https://github.com/astral-sh/ruff-pre-commit+ rev: v0.14.8+ hooks:+ - id: ruff+ args: ["backend/"]+ always_run: true++ - id: mypy-check+ name: MyPy Type Checking+ entry: bash -c 'cd backend && mypy .'+ language: system+ types: [python]+ pass_filenames: false+ always_run: true++ - id: pylint-check+ name: PyLint Code Quality+ entry: bash -c 'cd backend && pylint .'+ language: system+ types: [python]+ pass_filenames: false+ always_run: true++ - repo: https://github.com/pre-commit/pre-commit-hooks+ rev: v6.0.0+ hooks:+ - id: check-toml+ - id: debug-statements+ - id: end-of-file-fixer+ - id: check-yaml+ args: [--allow-multiple-documents]diff --git a/PROJECTS/api-security-scanner/backend/config.py b/PROJECTS/api-security-scanner/backend/config.pyindex e0c1d923..a6c028d4 100644--- a/PROJECTS/api-security-scanner/backend/config.py+++ b/PROJECTS/api-security-scanner/backend/config.py@@ -14,7 +14,6 @@ class Settings(BaseSettings):All magic numbers and configuration values are defined here to avoidhardcoding throughout the application"""-model_config = SettingsConfigDict(env_file="../.env", env_file_encoding="utf-8", case_sensitive=True)diff --git a/PROJECTS/encrypted-p2p-chat/backend/app/core/surreal_manager.py b/PROJECTS/encrypted-p2p-chat/backend/app/core/surreal_manager.pyindex 97d28203..c6dd3716 100644--- a/PROJECTS/encrypted-p2p-chat/backend/app/core/surreal_manager.py+++ b/PROJECTS/encrypted-p2p-chat/backend/app/core/surreal_manager.py@@ -7,6 +7,7 @@ import asyncioimport loggingfrom typing import Anyfrom collections.abc import Callable+from datetime import UTC, datetimefrom surrealdb import AsyncSurreal@@ -240,8 +241,7 @@ class SurrealDBManager:Add a participant to a room"""await self.ensure_connected()- from datetime import UTC, datetime-+query = """CREATE room_participants CONTENT {room_id: $room_id,