Skip to content

feat: Automatic Worker Loading, Docker Optimization & CI/CD Pipeline - #115

Open
miguerubsk wants to merge 17 commits into
sammwyy:mainfrom
miguerubsk:feature/automatic-workers-load
Open

feat: Automatic Worker Loading, Docker Optimization & CI/CD Pipeline#115
miguerubsk wants to merge 17 commits into
sammwyy:mainfrom
miguerubsk:feature/automatic-workers-load

Conversation

@miguerubsk

Copy link
Copy Markdown

This PR introduces a dynamic system for loading attack workers, eliminating the need to hardcode methods in the server and client. Additionally, it significantly improves the deployment workflow by optimizing the Dockerfile for security and performance, and adding a GitHub Actions pipeline.

Key Changes:

1. Dynamic Worker Loading:

  • Server: Refactored server/index.ts to dynamically scan and import worker files from the workers/ directory.
  • Metadata: Updated all worker files to export an info object containing the ID and display name (e.g., HTTP/Flood).
  • API: Added a new endpoint /methods that returns the available attack methods to the frontend.
  • Frontend: Updated src/App.tsx to fetch attack methods dynamically from the server instead of using a hardcoded list.

2. Docker & DevOps:

  • Multi-Stage Build: Rewrote the Dockerfile to use a multi-stage build process (builder vs. production), reducing the final image size.
  • Security: Implemented a non-root user (appuser) in the production stage to improve container security.
  • CI/CD: Added a GitHub Actions workflow to automate Docker builds using Buildx and caching.

3. Bug Fixes:

  • Fixed a syntax error in src/App.tsx (duplicate code block).
  • Fixed TypeScript type errors in server/index.ts regarding worker error handling.

How to Test:

  1. Add a new file to server/workers/ (e.g., testAttack.js) exporting the required info object.
  2. Start the application (npm run dev).
  3. Verify that the new attack method appears automatically in the dropdown menu in the UI.
  4. Run docker compose build to verify the container builds successfully.

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.

@miguerubsk
miguerubsk marked this pull request as ready for review December 12, 2025 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant