How mynamegabe/sad works
Main Components
• Frontend Client: Located in the “frontend” directory, it is built using a modern JavaScript/TypeScript framework (likely React with Vite due to the presence of “vite.config.ts” and “App.tsx”). It handles the user interface and interacts with the backend through API calls.
• Backend API Service: Located in the “backend” directory, this Python-based service includes multiple components:
– The entry point (main.py) that initializes the API service.
– Routers (in “routers” folder for auth, users, and webhooks) that expose REST or webhook endpoints.
– Modules (e.g., gemini.py and github.py) that handle integration logic with external systems.
– Utility functions and database connectivity (in “utils” and “schemas.py”) that aid the overall application logic.
• Containerized Sandbox Environment: Under “backend/sandbox/benchmarker” and related subdirectories, there is a set of containerized tools (using Dockerfiles) for tasks like benchmarking, entropy scanning, and Yara scanning. These containers are likely responsible for scanning files or code for potential supply chain attacks.
• External Integrations and Services:
– GitHub Integration: Configured with a dedicated router (e.g., “webhooks/github”) and module (backend/modules/github.py), indicating that there is support for GitHub webhooks and possibly other GitHub API operations.
– Yara Scanner: A clearly segregated component that uses Yara rules (organized in “yara-rules-src” and “yara-rules”) to detect suspicious patterns, supplemented by additional components (like “yara_updater.py” and “yara_compiler.py”) for scanning and maintaining up-to-date rules.
• Database: Though not directly visible in the file tree, the README and the sample “config.py” inform us that the backend connects to a database (with details such as DB_HOST, DB_USERNAME, etc.). This is most likely a containerized database service set up via docker-compose.
Relationships and Data Flow
• The Frontend makes API calls to the Backend to display and update data related to supply chain security events.
• The Backend receives requests via various routers (authentication, user management, webhook processing). In particular, GitHub webhooks allow external notifications into the system.
• The Backend then interacts with the Database to store and retrieve information (using helper modules in “utils/db.py” and related files).
• For threat detection, the backend triggers scanning jobs in the sandbox environment (the containerized benchmarker and Yara scanner). Data flows from file uploads or code submissions into these scanning modules.
• Results from the sandbox scanners are processed and likely relayed back to the user via the Backend API and then the Frontend.
• External API keys and secrets (configured in “config.py”) manage integration with external services like MakerSuite or GitHub for extended functionalities.
Architectural Patterns and Technologies
• Separation of Concerns: Clear separation between frontend, backend API, scanning sandbox environment, and database.
• Containerization: The use of Docker for the sandbox scanning components (Dockerfiles in benchmarker/yara-scanner) and docker-compose for orchestrating the database (and possibly backend services).
• Modular Design: Backend modules and routers separate responsibilities (e.g., authentication, GitHub/webhook integrations).
• Integration with Third-Party Services: The design considers integration with external platforms (e.g., GitHub and possibly a MakerSuite API) with proper configurations.
Components
• Frontend Component:
• Backend API Service:
– Sub-components: “Routers (auth, users, webhooks)”, “Modules (gemini, GitHub)”, “Utilities (db, common)”.
• Containerized Sandbox:
– Label distinctly, e.g., “Sandbox Scanning Service” with a sub-section for “Yara Scanner” and “Entropy Scan”.
• Database:
• External Services:
– Include a representation for “GitHub Integration” and any additional API services shown in config.