Skip to content

Prevent shell injection in ConfigMap-derived environment settings - #1790

Merged
suyadav1 merged 5 commits into
ci_prodfrom
suyadav/fix-configmap-shell-quoting
Sep 30, 2026
Merged

suyadav1 merged 5 commits into
ci_prodfrom
suyadav/fix-configmap-shell-quoting

Conversation

@suyadav1

Copy link
Copy Markdown
Contributor

Summary

  • Validate container-log schema/route versions and shell-quote all generated Linux environment values.
  • Preserve escaping when appending settings to .bashrc; add injection and compatibility regressions.

Validation

  • 69 Ruby tests, 5,046 assertions passed (--disable-error_highlight required for a pre-existing baseline test issue).
  • 28 Linux/Windows configuration comparisons matched ci_prod; the original injection paths fail the new regressions.
  • Live-agent and native Windows execution remain untested.

@suyadav1
suyadav1 requested a review from a team as a code owner September 23, 2026 17:51
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

suyadav1 and others added 2 commits September 24, 2026 21:46
Remove the outdated Windows Telegraf update comment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Telegraf 1.40.1 bump and Windows note removal belong to PR #1764, not this ConfigMap shell-quoting PR. Reverts commit 44237c6.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@suyadav1

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.

@suyadav1

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.

@suyadav1
suyadav1 merged commit faf68d7 into ci_prod Sep 30, 2026
20 checks passed
Mike Thompson (mthompson83) pushed a commit that referenced this pull request Oct 1, 2026
)

* fix: quote ConfigMap-derived environment assignments

* Upgrade Linux Telegraf to 1.40.1

Remove the outdated Windows Telegraf update comment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Revert misplaced Telegraf update

The Telegraf 1.40.1 bump and Windows note removal belong to PR #1764, not this ConfigMap shell-quoting PR. Reverts commit 44237c6.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Grace Wehner (gracewehner) pushed a commit that referenced this pull request Oct 6, 2026
Follows #1790, which quoted the values written by tomlparser.rb. The same
unquoted interpolation remains in two other parsers and in setGlobalEnvVar, so
a value is subject to shell processing when the generated file is sourced
rather than arriving as configured: quotes truncate it, a bare $ is substituted
away, and surrounding whitespace is dropped.

Reuses the get_command_linux helper introduced by #1790, defined locally in
each parser to match how get_command_windows is already handled across the
tree:

- tomlparser-common-agent-config.rb and tomlparser-metric-collection-config.rb
- setGlobalEnvVar, which re-emitted values into /opt/env_vars using double
  quotes, leaving them open to the same processing when that file is sourced

Behaviour is unchanged for well-formed configuration. Across every affected
setting and value shape, the variable bash ends up with after sourcing is
identical to before, for both the shipped defaults and a fully populated
config. The Windows KEY=VALUE writes are untouched, since those are split on
'=' and must not carry quotes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants