Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(docker): forward plugin redirect policy
Yudhi Armyndharis1b60ad393980
diff --git a/docker-compose.dev.yml b/docker-compose.dev.ymlindex 582282ea2..cbbe159b5 100644--- a/docker-compose.dev.yml+++ b/docker-compose.dev.yml@@ -82,6 +82,8 @@ services:# Install plugins into the writable, persistent data volume (the root FS is read-only). Matches# docker-compose.yml; without this it falls back to ./plugins on the read-only root and install fails.- PLUGINS_DIR=${PLUGINS_DIR:-/app/data/plugins}+ # Plugin install-from-URL redirect policy (ssrf-guard): off unless the exact string 'true'.+ - PLUGIN_DOWNLOAD_ALLOW_INSECURE_REDIRECTS=${PLUGIN_DOWNLOAD_ALLOW_INSECURE_REDIRECTS:-false}- WEBHOOK_TIMEOUT=${WEBHOOK_TIMEOUT:-10000}- WEBHOOK_RETRY_DELAY=${WEBHOOK_RETRY_DELAY:-5000}- WEBHOOK_DISPATCH_CONCURRENCY=${WEBHOOK_DISPATCH_CONCURRENCY:-16}diff --git a/docker-compose.yml b/docker-compose.ymlindex 323e83044..2e544bb0d 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -191,6 +191,8 @@ services:- BODY_SIZE_LIMIT=${BODY_SIZE_LIMIT:-}# Plugins- PLUGINS_DIR=${PLUGINS_DIR:-/app/data/plugins}+ # Plugin install-from-URL redirect policy (ssrf-guard): off unless the exact string 'true'.+ - PLUGIN_DOWNLOAD_ALLOW_INSECURE_REDIRECTS=${PLUGIN_DOWNLOAD_ALLOW_INSECURE_REDIRECTS:-false}# Security- API_MASTER_KEY=${API_MASTER_KEY:-}- TRUSTED_PROXIES=${TRUSTED_PROXIES:-}diff --git a/src/config/feature-flags.spec.ts b/src/config/feature-flags.spec.tsindex 925384483..5155dbaf8 100644--- a/src/config/feature-flags.spec.ts+++ b/src/config/feature-flags.spec.ts@@ -82,4 +82,31 @@ describe('feature-flags', () => {expect(compose).toMatch(/^\s*- AUTO_START_SESSIONS=\$\{AUTO_START_SESSIONS:-\}$/m);});});++ // PLUGIN_DOWNLOAD_ALLOW_INSECURE_REDIRECTS gates a security-sensitive hop in ssrf-guard (off unless+ // the exact string 'true'). Both bundled manifests must forward it with a secure default so an+ // operator's .env takes effect; whole-file contains() is not enough — the line must land on the API+ // service, never on a datastore/proxy service.+ describe('bundled compose forwards the plugin redirect policy', () => {+ // Extract the body of one top-level service block. Compose indents a service's keys two spaces+ // under the `name:` key, so the block runs from ` serviceName:` to the next top-level key.+ function extractTopLevelService(compose: string, serviceName: string): string {+ const start = compose.indexOf(`\n ${serviceName}:\n`);+ if (start === -1) throw new Error(`service ${serviceName} not found`);+ const rest = compose.slice(start + 1);+ const next = rest.search(/\n[a-z]/);+ return next === -1 ? rest : rest.slice(0, next);+ }++ it.each([+ ['docker-compose.yml', 'openwa-api'],+ ['docker-compose.dev.yml', 'openwa'],+ ])('%s forwards the redirect flag on service %s', (file, serviceName) => {+ const compose = fs.readFileSync(path.join(__dirname, '../../', file), 'utf8');+ const service = extractTopLevelService(compose, serviceName);+ expect(service).toContain(+ 'PLUGIN_DOWNLOAD_ALLOW_INSECURE_REDIRECTS=${PLUGIN_DOWNLOAD_ALLOW_INSECURE_REDIRECTS:-false}',+ );+ });+ });});