Files
http2pic/docker/start.sh
Chris cc30d2288e fix: sanitize API_KEY and BLOCK_PRIVATE_IPS in config generation
- Fix Issue 1: Normalize BLOCK_PRIVATE_IPS to safe boolean (true/false) using shell case statement to prevent PHP injection from non-boolean values like 'yes'
- Fix Issue 2: Strip single quotes from API_KEY to prevent PHP string injection if the value contains quotes
- Update docker-compose-dev.yml to document these configuration options

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 21:50:59 +02:00

34 lines
791 B
Bash
Executable File

echo ' [+] Starting php'
php-fpm84
cd /srv/src
composer install --no-dev --optimize-autoloader
echo ' [+] Starting Chrome'
chromedriver --port=4444 &
chmod 777 /srv/cache
chmod 777 /srv/logs
echo ' [+] Building config'
_buildConfig() {
local block_private api_key
case "${BLOCK_PRIVATE_IPS:-false}" in
true|1|yes) block_private=true ;;
*) block_private=false ;;
esac
api_key="${API_KEY:-}"
api_key="${api_key//\'/}"
echo "<?php"
echo "date_default_timezone_set('Europe/Vienna');"
echo "define('URL','${URL:-http://localhost:8080}');"
echo "define('API_KEY','${api_key}');"
echo "define('BLOCK_PRIVATE_IPS',${block_private});"
echo ""
}
_buildConfig > /srv/src/config.inc.php
caddy run --config /etc/caddy/Caddyfile