* upgrade to dapr postgresv2 statestore * actually make it v2 * dapr state table name, cleanup subscriptions/globals * proper exceptions * formatting/lint * Refactor workflow tracking and improve activity input handling - Extract workflow tracking logic into dedicated WorkflowTrackingService - Simplify activity signatures to accept specific parameters instead of generic dicts - Remove unused asyncio event loop references from enrichment modules - Update YaraRuleManager initialization and method names * re-added workflow tracking in the DB * update uvicorn prod options * enrichment work parallelism, convert queues from broadcast to task queues * Refactor pubsub and improve workflow parallelism - Split Dapr pubsub Dapr yaml components into topic-specific queues (alerting, dotnet, dpapi, files, noseyparker, workflow_monitor) - Update all Dapr volume mounts to reference new topic-specific pubsub components - Converted queues to task queues - Use YAML anchors to reduce duplication for file-enrichment replicas - Pass asyncpg pool to enrichment modules instead of creating connections - Add asyncpg_pool parameter throughout chromium and enrichment module analyzers - Update VSCode workspace (removed InspectAssembly, renamed dotnet_api to dotnet_service) - Added curl commands for Jaeger API to performance docs to help with perf troubleshooting - Created common.queues module to centralize pubsub/topic names (eases future refactoring) * worker mods * Workflow performance tuning, fix pubsub config, CLI arg changes - Fix pubsub deleteWhenUnused typo (deletedWhenUnused) - Add LOG_LEVEL environment variable support across services - CLI: Rename --repeat to --times, add --max-files option - Increase files pubsub prefetchCount from 25 to 50 - Add MAX_PARALLEL_WORKFLOWS configuration - Fix DotNetAssemblyAnalysis null handling with field validators - Update dashboard to show cumulative files/findings over time - Add RUST_LOG environment variable support to noseyparker - Update CHANGELOG for 2.1.4 release notes * Dapr 1.16.2 and use db transactions - Upgrade all Dapr containers from 1.16.1 to 1.16.2 - Reduce enrichment parallelism default from 25 to 5 workflows - Reduce healthcheck intervals from 10s to 5s for alerting and document conversion - Fixed DPAPI eventing to use new pubsubs - Refactor file_linking database operations to use atomic upserts and avoid deadlocks - Add WriteOnceViolationError handling in DPAPI masterkey analyzer - Wrap database operations in transactions for enrichment storage and plaintext indexing - Fix postgres notification handler closure variable capture * remove unused start_time * Scheduler persistence, workflow concurrency tuning, and config cleanup - Add volume for Dapr scheduler and init service - Add scheduler dependency to file enrichment service - Add async workflow client libraries - Format and cleanup compose.yaml (spacing, indentation, empty lines) * Migrate file_enrichment to async Dapr client and optimize Dockerfile - Use async DaprClient where possible in file_enrichment - Improve Dockerfile caching - Add asyncpg connection pool helper and fix typo in secret store name - Include VS Code debug configuration for document_conversion - Remove unused dapr_client from DpapiBlobAnalyzer - Clean up activity return types and better handle exceptions * Enrichment tracking for NoseyParker and logging cleanup - Add workflow_id to NoseyParkerInput and NoseyParkerOutput models - Remove workflow lookup query in noseyparker subscription handler - Adjust jaeger_perf_stats.sh output formatting and precision - Add type hints for async functions * noseyparker scanner perf, tracing for update_enrichment_results --------- Co-authored-by: Lee Chagolla-Christensen <lee@localhost>
Web API Service
A FastAPI-based microservice for the Nemesis platform that provides the primary HTTP API for file management, workflow orchestration, and system operations.
Purpose
This service serves as the main entry point for external interactions with the Nemesis platform, providing RESTful endpoints for file uploads, downloads, enrichment management, and workflow monitoring. It acts as a gateway that coordinates between the frontend interface, file storage, and various processing services.
Features
File Management
- File upload: Multi-part form uploads with metadata validation
- File download: Streaming downloads with size limits and custom filenames
- Storage integration: Direct integration with Minio object storage
- Metadata handling: JSON-based file metadata processing and validation
Workflow Operations
- Status monitoring: Real-time workflow status and metrics
- Failed workflow tracking: Access to failed enrichment workflows
- Queue management: Visibility into workflow queues and active processing
Enrichment Management
- Module listing: Discovery of available enrichment modules
- LLM integration: Access to enabled LLM-powered enrichment modules
- Manual execution: Trigger specific enrichment modules on files
- Service proxy: Forwards enrichment requests to the file-enrichment service
System Operations
- Health monitoring: Comprehensive health checks for service status
- YARA management: Reload YARA rules across the platform
- Cleanup operations: Data retention and cleanup functionality
- API documentation: Auto-generated OpenAPI/Swagger documentation
API Endpoints
Files (/files)
POST /files: Upload files with metadataGET /files/{object_id}: Download files by object ID
Workflows (/workflows)
GET /workflows/status: Get enrichment workflow status and metricsGET /workflows/failed: Retrieve failed workflow details
Enrichments (/enrichments)
GET /enrichments: List all available enrichment modulesGET /enrichments/llm: List enabled LLM enrichment modulesPOST /enrichments/{module_name}: Execute specific enrichment module
System (/system)
GET /healthz: Service health checkPOST /yara/reload: Reload YARA rulesPOST /cleanup: Trigger data cleanup operations
Configuration
DOWNLOAD_SIZE_LIMIT_MB: Maximum file download size (default: 500MB)DEFAULT_EXPIRATION_DAYS: Default file expiration period (default: 100 days)DAPR_HTTP_PORT: Dapr sidecar port for service communication (default: 3500)
Integration
- Dapr: Service-to-service communication and pub/sub messaging
- Minio: Object storage for file management
- File Enrichment Service: Forwards enrichment requests and monitoring
- Frontend: Serves API requests from the web interface
API Documentation
Interactive API documentation available at /api/docs (Swagger UI) and /api/redoc (ReDoc) when the service is running.
Development
Usage
To run locally:
poetry run uvicorn web_api.main:app --reload
Debugging
NOTE: These instructions need to be updated!
- Open the
web_apifolder in VS Code - Hit
F5to launch the application with the debugger attached - Start up Nemesis in dev mode, enabling debugging for the web_api:
cd Nemesis
docker compose up -f compose.yaml -f compose.override.yaml -f ./projects/web_api/docker-compose.debug.yml
This exposes Minio's port so the web_api can upload files outside the cluster. In addition, it isolates the web_api instance deployed by docker compose and informs its sidecar about the debugged web_api instance that's running in VS Code.
Docker Images
- If the base images haven't been built yet, do that first:
cd nemesis
docker compose -f docker-compose.base.yml build
- Build the dev or prod image:
# dev
# cd web_api
docker build -f Dockerfile -t nemesis-web-api --target dev ../..
# prod
# cd web_api
docker build -f Dockerfile -t nemesis-web-api --target prod ../..