8000 bug: REPL parse errors are completely silent after over-broad security fix · Issue #78 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

bug: REPL parse errors are completely silent after over-broad security fix #78

Closed

Description

@adityamukho

Summary

PR #22 fixed a CodeQL alert (cleartext logging of user-supplied values) by changing:

// src/repl.rs:104 (approx)
eprintln!("Parse error: {}", e);

to:

eprintln!("Parse error");

This discards the entire error message. The REPL now gives no feedback about why a query failed to parse — no line number, no indication of what was unexpected, nothing. This makes the REPL nearly unusable for debugging malformed queries.

Expected behaviour

The REPL prints a useful structural error message (e.g. Parse error: expected closing ')' at position 42) that helps the user fix their query, without exposing raw user-supplied string values (which were the actual CodeQL concern).

Fix

The parser error type (in src/query/datalog/parser.rs and/or anyhow::Error) likely contains both a structural description (safe to log) and the offending token/value (potentially sensitive). The fix should:

  1. Identify what information the error type carries.
  2. Log only the structural part (error kind, position, expected token type) — not the raw user-supplied string contents.
  3. If the error type doesn't separate these, create a ParseErrorKind enum or similar that carries only safe-to-log structural information.

This must not re-introduce the CodeQL rust/cleartext-logging pattern.

Files

  • src/repl.rs — the silenced eprintln! call
  • src/query/datalog/parser.rs — the error type produced by the parser

Test

Add a test (or extend an existing one in the REPL / parser tests) that verifies the error output for a malformed query contains a non-empty structural description. Do NOT assert on the raw user-supplied value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0