How uditrajput03/docker-security-poc works
Project Type and Purpose
• The project is a security tool specifically designed to scan Docker Hub images for potential sensitive credential leaks. It operates as a proof-of-concept using a microservices pipeline and Redis queues to manage workflow tasks.
• Its core function is to scan, inspect, and alert when sensitive information (like environmental variables or configuration files) is detected inside pulled Docker images.
Analyzing the File Structure
• The top-level files (.env.exampl, package.json, tsconfig.json) and the source code files in the “src” folder indicate a Node.js/TypeScript application.
• The source directory hosts multiple scripts like getImages.ts, getIndexData.ts, getTags.ts, getRedis.ts, logger.ts, index.ts, queueHandler.ts, and worker.ts which reflect distinct responsibilities within the system.
• The presence of scripts (e.g., node.sh) suggests command line utilities or process orchestration.
• This structure is aligned with a microservices-based architecture where each script potentially forms a step in the scanning pipeline.
Extracting Insights from the README
• The README clearly outlines the scanning pipeline’s steps: Keyword Scanner, Username Scanner, Image Scanner, Tag Scanner, and Alert System.
• It highlights that Redis is used as the central queue system where jobs are passed from one stage to the next.
• The README details environmental configuration (for Redis and Telegram) and outlines how each component (implemented in various source files) contributes to the end-to-end scanning process.
a. Main Components to Include:
• Keyword Scanner: Initiates searching by populating a Redis queue with keywords.
• Username Scanner: Consumes keywords to retrieve usernames from Docker Hub.
• Image Scanner: Uses the retrieved usernames to discover associated Docker images.
• Tag Scanner: Extracts image tags and pulls their corresponding Docker tar files.
• Alert System: Checks for sensitive files and sends notifications (via Telegram, etc.).
• Redis Queues: The central mediator facilitating communication and task flow between scanners.
b. Relationships and Interactions:
• Redis Queues at the center, connecting each scanner component to indicate their reliance on Redis for synchronous/asynchronous messaging.
c. Architectural Patterns and Design Principles:
• Microservices: Indicate that each scanning component is a loosely coupled service.
• Pipeline/Queue-based processing: Emphasize the role of Redis in decoupling the stages.
• Stateless Service Design: Each microservice operates independently without shared state aside from what is passed via Redis.
• Separation of Concerns: Highlight that each script (as per the “src” directory) has a dedicated responsibility (e.g., getImages.ts solely handles image retrieval).
d. Technology Stack Details:
• Node.js with TypeScript as the primary runtime/language.
• Redis as the message queue.
• Docker Hub as the external service being scanned.
• Telegram (via the provided webhook and credentials in the .env configuration) for alert notifications.