Skip to content

cli: Redact CLI flags and env vars when writing debug bundle. - #28063

Merged
jrasell merged 2 commits into
mainfrom
b-SECVULN-43985
May 28, 2026
Merged

jrasell merged 2 commits into
mainfrom
b-SECVULN-43985

Conversation

@jrasell

@jrasell jrasell commented May 28, 2026 •

Copy link
Copy Markdown
Member

The operator debug bundle writes out details of the CLI flags used to run the command, in order to provide additional context for support purposes. This process, however, did not perform any redaction of the values, so could include the raw data of ACL tokens used.

This change performs redaction of CLI values before writing out the file in the debug bundle and includes ACL tokens as paths to TLS certificate keys for completeness.

Links

https://hashicorp.atlassian.net/browse/SECVULN-43985

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad product documentation, which is stored in the
    web-unified-docs repo. Refer to the web-unified-docs contributor guide for docs guidelines.
    Please also consider whether the change requires notes within the upgrade
    guide
    . If you would like help with the docs, tag the nomad-docs team in this PR.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.

The operator debug bundle writes out details of the CLI flags used
to run the command, in order to provide additional context for
support purposes. This process, however, did not perform any
redaction of the values, so could include the raw data of ACL
tokens used.

This change performs redaction of CLI values before writing out
the file in the debug bundle and includes ACL tokens as paths to
TLS certificate keys for completeness.
@jrasell jrasell self-assigned this May 28, 2026
@jrasell jrasell added backport/ent/1.10.x+ent backport to 1.10.x+ent release line backport/ent/1.11.x+ent backport to 1.11.x+ent release line backport/2.0.x backport to 2.0.x release line labels May 28, 2026
@jrasell
jrasell requested review from Juanadelacuesta and tgross May 28, 2026 09:12
@jrasell
jrasell marked this pull request as ready for review May 28, 2026 09:13
@jrasell
jrasell requested review from a team as code owners May 28, 2026 09:13

@tgross tgross left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment thread command/operator_debug.go
Comment on lines +1629 to +1631
// Square brackets are used deliberately: Go's encoding/json HTML-escapes angle
// brackets (< >) to Unicode escape sequences, which would make the placeholder
// unreadable in the resulting JSON file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The square brackets LGTM so whatever, but isn't this only the case if you call HTMLEscape? Are we doing that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The json.Marshal function sets HTMLEscape as true by default which I why I opted for this route. Without this, the file will contain the following example of data:

    "consul-auth": {
      "Name": "consul-auth",
      "Value": "\u003credacted\u003e",
      "DefValue": "\u003credacted\u003e",
      "Usage": ""
    },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL!

@jrasell
jrasell merged commit 5b02773 into main May 28, 2026
37 checks passed
@jrasell
jrasell deleted the b-SECVULN-43985 branch May 28, 2026 13:53
tehut pushed a commit that referenced this pull request Jun 12, 2026
The operator debug bundle writes out details of the CLI flags used
to run the command, in order to provide additional context for
support purposes. This process, however, did not perform any
redaction of the values, so could include the raw data of ACL
tokens used.

This change performs redaction of CLI values before writing out
the file in the debug bundle and includes ACL tokens as paths to
TLS certificate keys for completeness.
schmichael pushed a commit to vercel/nomad that referenced this pull request Sep 25, 2026
…orp#28063)

The operator debug bundle writes out details of the CLI flags used
to run the command, in order to provide additional context for
support purposes. This process, however, did not perform any
redaction of the values, so could include the raw data of ACL
tokens used.

This change performs redaction of CLI values before writing out
the file in the debug bundle and includes ACL tokens as paths to
TLS certificate keys for completeness.
@github-actions

Copy link
Copy Markdown

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 26, 2026

This branch was successfully deployed

1 active deployment
Preview — 93443740 Deployed May 28, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/ent/1.10.x+ent backport to 1.10.x+ent release line backport/ent/1.11.x+ent backport to 1.11.x+ent release line backport/2.0.x backport to 2.0.x release line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants