coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: Container Labels with a $ are truncated

Open w3cj opened this issue 10 months ago • 0 comments

Description

When attempting to add basicauth auth directives to my Caddy configs via labels like this:

# user is cj, password is supersecret
caddy_0.basicauth.0_cj=$2y$05$Bnl6dl3DeV.cuPfB1VbNrOZv1zeVojzT.GfDAgq8bHAwd.k9NWHOa

The resulting value that gets passed through to the Caddy config gets truncated to this:

$2y$05.cuPfB1VbNrOZv1zeVojzT.GfDAgq8bHAwd.k9NWHOa

I tried escaping the $ and wrapping in double quotes, but same issue.

Here are a few others that get truncated as well:

$2y$14$XR94BDPkrzizU/3MWwDJWOihpsgHwl93F.9C5ZxBlg81BXGl6WkLa -> $2y$14/3MWwDJWOihpsgHwl93F.9C5ZxBlg81BXGl6WkLa
$2a$14$F.TZicXQAbwB7sTOezh5T.OPQlvR7zYUZLDDAr19A1P21kO05gusO -> $2a$14.TZicXQAbwB7sTOezh5T.OPQlvR7zYUZLDDAr19A1P21kO05gusO
$2a$14$PzTdfeXxyg0dG.FoU9NXzuMOCy0vbPrueR6mefUY7rxHuIf1CNajC -> $2a$14.FoU9NXzuMOCy0vbPrueR6mefUY7rxHuIf1CNajC

This hash works and does not get truncated:

# password changeme123
$2a$14$5RWjr.I5E53DXkS31TGabOc7Hi.11YyLjMWy0VjvD9Rs92Tp1aVQm

Looks like if there is a number after the $ it does not get removed.

Minimal Reproduction (if possible, example repository)

  1. Change proxy to Caddy
  2. Create a resource
  3. Add this to the resource's container labels:
# user is cj, password is supersecret
caddy_0.basicauth.0_cj=$2y$05$Bnl6dl3DeV.cuPfB1VbNrOZv1zeVojzT.GfDAgq8bHAwd.k9NWHOa
  1. View the Caddy proxy logs to view the actual value passed in to the Caddy config, OR use docker inspect <container_id> to see the labels that were passed to the container

Exception or Error

No response

Version

v4.0.0-beta.261

w3cj avatar Apr 17 '24 13:04 w3cj