8000 Potential fix for code scanning alert no. 72: Cleartext logging of sensitive information by adityamukho · Pull Request #21 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

Potential fix for code scanning alert no. 72: Cleartext logging of sensitive information - #21

Merged
adityamukho merged 1 commit into
mainfrom
alert-autofix-72
Mar 24, 2026
Merged

adityamukho merged 1 commit into
mainfrom
alert-autofix-72

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

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:

  1. In src/query/datalog/parser.rs, change the specific Err(format!("Invalid UUID: {}", uuid_str)) to a generic message that does not include uuid_str, e.g., Err("Invalid UUID".to_string()). This removes the only place where a UUID string is directly embedded in the error.
  2. Optionally, we can also generalize other error messages that include user-controlled tokens like command names; however, the CodeQL trace is specifically pointing via EdnValue::Uuid(uuid) and the UUID parsing error, so the key fix is that UUID error message.
  3. In 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 leave eprintln!("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.

…nsitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@adityamukho
adityamukho marked this pull request as ready for review March 24, 2026 11:04
@adityamukho
adityamukho merged commit 7dff236 into main Mar 24, 2026
13 checks passed
@adityamukho
adityamukho deleted the alert-autofix-72 branch March 24, 2026 11:08
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.

1 participant

0