fix: add Docker configuration file support (fixes #105)
This commit adds comprehensive support for JSON configuration files in Docker containers, addressing the issue where the Docker image fails to start in server mode and ignores configuration files. ## Changes ### Docker Configuration Support - Added parse-config.js to safely parse JSON configs and export as shell variables - Implemented secure shell quoting to prevent command injection - Added dangerous environment variable blocking for security - Support for all JSON data types with proper edge case handling ### Docker Server Mode Fix - Added support for "n8n-mcp serve" command in entrypoint - Properly transforms serve command to HTTP mode - Fixed missing n8n-mcp binary issue in Docker image ### Security Enhancements - POSIX-compliant shell quoting without eval - Blocked dangerous variables (PATH, LD_PRELOAD, etc.) - Sanitized configuration keys to prevent invalid shell variables - Protection against shell metacharacters in values ### Testing - Added 53 comprehensive tests for Docker configuration - Unit tests for parsing, security, and edge cases - Integration tests for Docker entrypoint behavior - Security-focused tests for injection prevention ### Documentation - Updated Docker README with config file mounting examples - Enhanced troubleshooting guide with config file issues - Added version bump to 2.8.2 ### Additional Files - Included deployment-engineer and technical-researcher agent files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
45
scripts/test-docker-config.sh
Executable file
45
scripts/test-docker-config.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to run Docker config tests
|
||||
# Usage: ./scripts/test-docker-config.sh [unit|integration|all]
|
||||
|
||||
set -e
|
||||
|
||||
MODE=${1:-all}
|
||||
|
||||
echo "Running Docker config tests in mode: $MODE"
|
||||
|
||||
case $MODE in
|
||||
unit)
|
||||
echo "Running unit tests..."
|
||||
npm test -- tests/unit/docker/
|
||||
;;
|
||||
integration)
|
||||
echo "Running integration tests (requires Docker)..."
|
||||
RUN_DOCKER_TESTS=true npm run test:integration -- tests/integration/docker/
|
||||
;;
|
||||
all)
|
||||
echo "Running all Docker config tests..."
|
||||
npm test -- tests/unit/docker/
|
||||
if command -v docker &> /dev/null; then
|
||||
echo "Docker found, running integration tests..."
|
||||
RUN_DOCKER_TESTS=true npm run test:integration -- tests/integration/docker/
|
||||
else
|
||||
echo "Docker not found, skipping integration tests"
|
||||
fi
|
||||
;;
|
||||
coverage)
|
||||
echo "Running Docker config tests with coverage..."
|
||||
npm run test:coverage -- tests/unit/docker/
|
||||
;;
|
||||
security)
|
||||
echo "Running security-focused tests..."
|
||||
npm test -- tests/unit/docker/config-security.test.ts tests/unit/docker/parse-config.test.ts
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [unit|integration|all|coverage|security]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Docker config tests completed!"
|
||||
Reference in New Issue
Block a user