From b128801ee211ea870ec988aa5a206b134b5bdccc Mon Sep 17 00:00:00 2001 From: Bendik Aagaard Lynghaug Date: Tue, 10 Nov 2026 11:57:26 +0100 Subject: [PATCH] deploy: a "$" in a secret reaches the container whole Compose reads an env_file the way it reads compose.yml: "$name" in a value is a variable to fill in, and one that is not set comes out empty. Rauthy's API keys are "$", so RAUTHY_API_KEY reached portal as "portal" alone: Rauthy answered 401 to every call, and every invite failed with "the account could not be made just now". The env files' values are the secrets themselves, so every "$" left in them is literal and becomes compose's "$$". Checked with compose 5.7.0 (kasse's): the container gets "portal$Abc123secret" from "portal$$Abc123secret". Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/deploy.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index dff0502..95d5dbf 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -156,6 +156,14 @@ jobs: printf 'BOOTSTRAP_API_KEY=%s\nBOOTSTRAP_API_KEY_SECRET=%s\n' \ "$RAUTHY_BOOTSTRAP_API_KEY" "$RAUTHY_BOOTSTRAP_API_KEY_SECRET" >> "$STAGE/rauthy.env" fi + # Compose reads an env_file the way it reads compose.yml: "$name" in + # a value is a variable to fill in, and one that is not set comes + # out empty. Every value above is the secret itself, so a "$" left + # in one is literal (Rauthy's API keys are "$"), and + # "$$" is compose's literal "$". Without this, RAUTHY_API_KEY reached + # portal as "portal" alone, Rauthy answered 401, and every invite + # failed. .env is left alone: it is what compose.yml interpolates. + sed -i 's/\$/$$/g' "$STAGE/portal.env" "$STAGE/nats.env" "$STAGE/chat.env" "$STAGE/rauthy.env" - name: Pull and bring the stack up run: sudo /usr/local/bin/deploy-tomtervel