Skip to content

Fix for code scanning alert no. 75: Clear-text logging of sensitive information#5612

Merged
eriknordmark merged 1 commit intomasterfrom
alert-autofix-75
Feb 19, 2026
Merged

Fix for code scanning alert no. 75: Clear-text logging of sensitive information#5612
eriknordmark merged 1 commit intomasterfrom
alert-autofix-75

Conversation

@eriknordmark
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/lf-edge/eve/security/code-scanning/75

In general, sensitive values such as API keys should never be logged in clear text. If logging is needed for diagnostics, log only non-sensitive metadata (e.g., that a key exists, its length, or a partially redacted version), or omit the field entirely.

For this specific case, the minimal fix without changing behavior elsewhere is to adjust the fmt.Printf call on line 587 so that it no longer prints data.ApiKey directly. The rest of the line (datastore type, FQDN, path, and cipher flag) can remain. A safe, low-impact approach is to replace the printed key with either a fixed placeholder (e.g., <redacted>) or a derived, non-sensitive summary (e.g., length). Since we must not assume any new helper functions or wider context, the simplest fix is to change the format string and arguments so the key is not passed into Printf at all and instead a constant placeholder is shown.

Concretely, in pkg/edgeview/src/system.go, in the getCipher function around lines 583–588, modify the fmt.Printf used to print datastore details so that it no longer includes data.ApiKey. For example, change:

fmt.Printf("  type: %s, FQDN: %s, ApiKey: %s, path: %s, Is Cipher: %v\n",
    data.DsType, data.Fqdn, data.ApiKey, data.Dpath, data.IsCipher)

to:

fmt.Printf("  type: %s, FQDN: %s, ApiKey: <redacted>, path: %s, Is Cipher: %v\n",
    data.DsType, data.Fqdn, data.Dpath, data.IsCipher)

No new imports or helper methods are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Copy link
Copy Markdown
Contributor Author

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

LGTM but @naiming-zededa can you take a look?

@eriknordmark eriknordmark marked this pull request as ready for review February 18, 2026 05:19
Copy link
Copy Markdown
Contributor

@naiming-zededa naiming-zededa left a comment

Choose a reason for hiding this comment

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

LGTM

@eriknordmark eriknordmark requested a review from shjala February 18, 2026 07:01
@rene
Copy link
Copy Markdown
Contributor

rene commented Feb 18, 2026

@eriknordmark , you need to Sign-off the commit so DCO can pass....

@eriknordmark eriknordmark changed the title Potential fix for code scanning alert no. 75: Clear-text logging of sensitive information Fix for code scanning alert no. 75: Clear-text logging of sensitive information Feb 18, 2026
…nformation

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

Signed-off-by: eriknordmark <erik@zededa.com>
@eriknordmark
Copy link
Copy Markdown
Contributor Author

@eriknordmark , you need to Sign-off the commit so DCO can pass....

@rene Done.

@eriknordmark eriknordmark requested a review from rene February 18, 2026 23:02
@eriknordmark eriknordmark merged commit c77400e into master Feb 19, 2026
48 of 49 checks passed
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.

4 participants