# Job "Environment" tab entries are not shell-escaped

**URL:** <https://forum.buildkite.community/t/job-environment-tab-entries-are-not-shell-escaped/2500>\
**Category:** Features Requests\
**Created:** [January 9, 2023, 11:25pm UTC](https://forum.buildkite.community/t/job-environment-tab-entries-are-not-shell-escaped/2500 "2023-01-09T23:25:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter.tecton](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@peter.tecton](https://forum.buildkite.community/u/peter.tecton)\
**Post date:** [January 9, 2023, 11:25pm UTC](https://forum.buildkite.community/t/job-environment-tab-entries-are-not-shell-escaped/2500/1 "2023-01-09T23:25:47Z")

</div>

The environment variable contents displayed in a Job’s “Environment” tab don’t appear to get fully escaped. If these get copied and pasted into a shell, the contents may get unintentionally executed rather than interpreted as string data.

For instance, a pipeline triggered against a commit with a message that happens to include some shell might produce a job environments with an entry

```bash
BUILDKITE_MESSAGE="Another message. This time with difficult text.

    $(... | perl -nle 'BEGIN {$\\=\",\"} print for split' | ...)"

```

in which the `$(` command-substitution is not escaped. Without escaping, the enclosed pipeline will be executed when pasted into common shells such as Bash or Zsh.

Pipelines exhibiting this issue still run fine and steps within them see the proper contents, so I suspect this is likely just a display issue. The content remains unescaped after toggling the “Show export Prefix” and the contents captured by “Copy to Clipboard” are also not escaped. These UI features are very convenient when debugging jobs, it would be nice if I didn’t have to watch out for this hazard.

---

<div class="post-metadata">

**Author:** ![lizette](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/lizette/32/1161_2.png) [@lizette](https://forum.buildkite.community/u/lizette)\
**Post date:** [January 10, 2023, 3:37am UTC](https://forum.buildkite.community/t/job-environment-tab-entries-are-not-shell-escaped/2500/2 "2023-01-10T03:37:49Z")

</div>

Hi @peter.tecton,

Welcome to the Buildkite Community! 👋

Thank you for raising this issue. I will raise this to our engineering team. We’ll keep you posted.

Cheers,  
Lizette

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [January 10, 2023, 6:27am UTC](https://forum.buildkite.community/t/job-environment-tab-entries-are-not-shell-escaped/2500/3 "2023-01-10T06:27:39Z")

</div>

Hi @peter.tecton

You have a good point about the Environment tab 👍

However, the intention with the contents of that tab is to put them into a file that you can use locally, just like the `buildkite-agent` does. The Environment tab contents are exactly the same as the `$BUILDKITE_ENV_FILE` used by the agent when running builds. So we don’t recommend pasting them directly into an interactive shell for that reason.

Hope that helps!
