[GH-ISSUE #1609] Script Manager does not expand custom fields in Environmental Variables section #2951

Closed
opened 2026-03-14 06:04:08 +03:00 by kerem · 2 comments
Owner

Originally created by @NiceGuyIT on GitHub (Aug 22, 2023).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1609

Server Info (please complete the following information):

  • OS: Ubuntu 20.04.4 LTS (Focal Fossa)
  • Browser: Firefox 116.0.2 (64-bit)
  • RMM Version (as shown in top left of web UI): v0.16.3

Installation Method:

  • Standard
  • Docker

Agent Info (please complete the following information):

  • Agent version (as shown in the 'Summary' tab of the agent from web UI): Agent v2.4.11
  • Agent OS: Opensuse-Leap 15.4

Describe the bug
The scripting system does not expand global keys or custom fields for environmental variables. They are expanded for script arguments.

To Reproduce
Steps to reproduce the behavior:

  1. Add a Global Key and Custom Field.
  2. Create a new script in Script Manager.
  3. Add the global keys and custom fields in the environmental variable section. Modify the script to show the values of the environmental variables.
  4. The script arguments are expanded while the environmental variables are not.

Expected behavior
I expected the environmental variables to be expanded like the script arguments.

Screenshots
As you can see, the arguments are expanded while the environmental variables are not.
image

Additional context
This script was used for the screenshot.

#!/usr/bin/env bash

echo "Testing global keys"
echo "TEST_ENV: $TEST_ENV"
echo "Arg 1: $1"
echo

echo "Testing client cutom keys"
echo "TEST_CLIENT_ENV: $TEST_CLIENT_ENV"
echo "Arg 2: $2"
Originally created by @NiceGuyIT on GitHub (Aug 22, 2023). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1609 **Server Info (please complete the following information):** - OS: Ubuntu 20.04.4 LTS (Focal Fossa) - Browser: Firefox 116.0.2 (64-bit) - RMM Version (as shown in top left of web UI): v0.16.3 **Installation Method:** - [x] Standard - [ ] Docker **Agent Info (please complete the following information):** - Agent version (as shown in the 'Summary' tab of the agent from web UI): Agent v2.4.11 - Agent OS: Opensuse-Leap 15.4 **Describe the bug** The scripting system does not expand global keys or custom fields for environmental variables. They are expanded for script arguments. **To Reproduce** Steps to reproduce the behavior: 1. Add a Global Key and Custom Field. 2. Create a new script in Script Manager. 3. Add the global keys and custom fields in the environmental variable section. Modify the script to show the values of the environmental variables. 4. The script arguments are expanded while the environmental variables are not. **Expected behavior** I expected the environmental variables to be expanded like the script arguments. **Screenshots** As you can see, the arguments are expanded while the environmental variables are not. ![image](https://github.com/amidaware/tacticalrmm/assets/7763429/500b4ee6-a664-4b07-8aaa-6a06dd960b3f) **Additional context** This script was used for the screenshot. ```bash #!/usr/bin/env bash echo "Testing global keys" echo "TEST_ENV: $TEST_ENV" echo "Arg 1: $1" echo echo "Testing client cutom keys" echo "TEST_CLIENT_ENV: $TEST_CLIENT_ENV" echo "Arg 2: $2" ```
kerem 2026-03-14 06:04:08 +03:00
Author
Owner

@NiceGuyIT commented on GitHub (Sep 18, 2023):

After updating a script to replace global keys in the script itself, I discovered {{global.KEY_NAME}} in the script is strictly for script snippets, not custom fields or global keys. {{agent.Key_Name}} in a script will be replaced with the script snippet called agent.Key_Name.

This issue is a blocker to securely pass information from global keys and custom fields to scripts.

<!-- gh-comment-id:1722656668 --> @NiceGuyIT commented on GitHub (Sep 18, 2023): After updating a script to replace global keys in the script itself, I discovered `{{global.KEY_NAME}}` in the script is strictly for script snippets, not custom fields or global keys. `{{agent.Key_Name}}` in a script will be replaced with the script snippet called `agent.Key_Name`. This issue is a blocker to securely pass information from global keys and custom fields to scripts.
Author
Owner

@wh1te909 commented on GitHub (Sep 30, 2023):

done will be in next release

<!-- gh-comment-id:1741869511 --> @wh1te909 commented on GitHub (Sep 30, 2023): done will be in next release
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#2951
No description provided.