cli icon indicating copy to clipboard operation
cli copied to clipboard

`{{` in App Environment Variable values break the `cf env` command

Open cweibel opened this issue 1 year ago • 2 comments

Please fill out the issue checklist below and provide ALL the requested information.

  • [X] I reviewed open and closed github issues that may be related to my problem.
  • [X] I tried updating to the latest version of the CF CLI to see if it fixed my problem.
  • [X] I attempted to run the command with CF_TRACE=1 to help debug the issue.
  • [X] I am reporting a bug that others will be able to reproduce.

Describe the bug and the command you saw an issue with I am attempting to run cf env to pull back the environment variables for an app with environment variables.

What happened A clear and concise description of what happen. The CLI returns back:

...
User-Provided:
TEST2: blah[]

		Something unexpected happened. This is a bug in cf.

		Please re-run the command that caused this exception with the environment
		variable CF_TRACE set to true.

		Also, please update to the latest cli and try the command again:
		https://code.cloudfoundry.org/cli/releases

		Please create an issue at: https://code.cloudfoundry.org/cli/issues

		Include the below information when creating the issue:

		Command
		cf env icu2

		CLI Version
		7.7.9+984062b.2024-03-07

		Error
		template: Display Text:1: function "blah5" not defined

Expected behavior What should have been returned was:

User-Provided:
TEST2: blah[]
TEST3: blah{{blah5
TEST4: blah

Exact Steps To Reproduce Steps to reproduce the behavior; include the exact CLI commands and verbose output:

Create an app manifest for any app that contains these three environment variables:

applications:
- name: icu2
  memory: 256M
  stack: cflinuxfs4
  buildpacks:
  - https://github.com/cloudfoundry/apt-buildpack/
  - https://github.com/cloudfoundry/ruby-buildpack/
  env:
    TEST2: blah[]
    TEST3: blah{{blah5
    TEST4: blah

cf push icu2 cf env icu2

Provide more context

  • MacOS, iTerm2 3.4.19
  • CF CLI 7.7.9+984062b.2024-03-07
  • CF API 3.160.0

cweibel avatar Mar 20 '24 18:03 cweibel

This was found because a credhub password was generated with two { in it, I swear I wasn't trying to break this on purpose 😄

cweibel avatar Mar 20 '24 18:03 cweibel

Thank you for reporting this :). I have created an entry in our tracker to look into this.

gururajsh avatar Jun 20 '24 19:06 gururajsh