From 2ca0643439787708d31b5ae4fa7cd89ef6118c70 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 29 Aug 2026 20:31:10 -0700 Subject: [PATCH] Add FlowAgent entrypoint: non-interactive az login via Pattern C secrets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reads the three _FILE-convention secrets (mounted by Swarm from Docker secrets provisioned by Woodpecker — see secrets/flowagent.secrets.example), performs `az login --service-principal`, then execs into whatever command mcpo invokes (node /app/flowagent/mcp.mjs). No secret value is ever written to disk outside the ephemeral Docker secret mount, logged, or baked into the image. --- mcpo/flowagent/entrypoint.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 mcpo/flowagent/entrypoint.sh diff --git a/mcpo/flowagent/entrypoint.sh b/mcpo/flowagent/entrypoint.sh new file mode 100644 index 0000000..bea9d68 --- /dev/null +++ b/mcpo/flowagent/entrypoint.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# FlowAgent MCP entrypoint — non-interactive Azure service-principal login. +# +# Expects three env vars pointing at Docker secret files (Pattern C, +# _FILE convention, provisioned by Woodpecker — never hand-typed): +# FLOWAGENT_AZURE_CLIENT_ID_FILE +# FLOWAGENT_AZURE_TENANT_ID_FILE +# FLOWAGENT_AZURE_CLIENT_SECRET_FILE +# +# On success, execs into the real command (node /app/flowagent/mcp.mjs), +# replacing this shell so mcpo's stdio pipe talks directly to the MCP process. +set -eu + +: "${FLOWAGENT_AZURE_CLIENT_ID_FILE:?FLOWAGENT_AZURE_CLIENT_ID_FILE not set}" +: "${FLOWAGENT_AZURE_TENANT_ID_FILE:?FLOWAGENT_AZURE_TENANT_ID_FILE not set}" +: "${FLOWAGENT_AZURE_CLIENT_SECRET_FILE:?FLOWAGENT_AZURE_CLIENT_SECRET_FILE not set}" + +CLIENT_ID="$(cat "$FLOWAGENT_AZURE_CLIENT_ID_FILE")" +TENANT_ID="$(cat "$FLOWAGENT_AZURE_TENANT_ID_FILE")" +CLIENT_SECRET="$(cat "$FLOWAGENT_AZURE_CLIENT_SECRET_FILE")" + +az login --service-principal \ + -u "$CLIENT_ID" \ + -p "$CLIENT_SECRET" \ + --tenant "$TENANT_ID" \ + --output none + +unset CLIENT_SECRET + +exec "$@"