Potential fix for code scanning alert no. 2: Clear-text logging of sensitive information#2
Closed
BENZOOgataga wants to merge 2 commits into
Closed
Potential fix for code scanning alert no. 2: Clear-text logging of sensitive information#2BENZOOgataga wants to merge 2 commits into
BENZOOgataga wants to merge 2 commits into
Conversation
…nsitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
|
No reviewable files after applying ignore patterns. |
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merged
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/Altitude-Interactive/CorpSim/security/code-scanning/2
To fix the problem, we should stop logging the raw
enabledByvalue (which may come from environment variables) in clear text. Instead, we can either omit it from logs or replace it with a non-sensitive, generic description or a redacted representation, while leaving the actualenabledByvalue intact in the state/payload for internal use.The least intrusive change is to modify
printState(state, source)so that it does not output the exactstate.enabledBy. For example, we can log that an actor is present without showing who it is, or we can explicitly mark it as redacted. This avoids changing howenabledByis computed (resolveActor), stored (buildPayload,sanitizeState), or written to the file/API; only the logging behavior changes.Concretely, in
scripts/maintenance.mjs:printState(state, source)(around lines 376–386).console.log(\Enabled by: ${state.enabledBy}`);line with a safer message that does not interpolate the value, such asconsole.log("Enabled by: [redacted]");orconsole.log("Enabled by: (hidden)");`.if (state.enabledBy)conditional so we only log this line when the field is present.No additional imports or helper methods are required.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.