Repository navigation
Potential fix for code scanning alert no. 72: Cleartext logging of sensitive information - #21
Merged
Merged
Conversation
…nsitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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/adityamukho/minigraf/security/code-scanning/72
In general, the problem is that parser error strings include raw user input (e.g., the invalid UUID string), and the REPL logs those errors with
eprintln!. To fix this without changing existing functionality, we should stop including untrusted, potentially sensitive values directly in errors that are logged. Instead, we should emit generic or redacted error messages that convey what went wrong without echoing specific user-supplied values.The most effective minimal fix along the identified path is:
src/query/datalog/parser.rs, change the specificErr(format!("Invalid UUID: {}", uuid_str))to a generic message that does not includeuuid_str, e.g.,Err("Invalid UUID".to_string()). This removes the only place where a UUID string is directly embedded in the error.EdnValue::Uuid(uuid)and the UUID parsing error, so the key fix is that UUID error message.src/repl.rs, we keep logging parse errors but only print whatever sanitized message the parser now returns. Since we’re not asked to change the overall behavior of the REPL, we will leaveeprintln!("Parse error: {}", e);intact; its content is now less likely to contain sensitive identifiers.No new methods or imports are needed; we only adjust the error string literal in the parser at the UUID handling site.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.