#7412·hive

[Bug]: excel_sql blocks normal SELECT queries when a column name contains a keyword

Author: triple4tCreated Sep 5, 2026Updated Sep 9, 2026

Describe the Bug

Hit this while running a read-only query on an Excel file. excel_sql blocks the query if a blocked SQL keyword shows up anywhere as a substring, even when it's just part of a column name.

The check at tools/src/aden_tools/tools/excel_tool/excel_tool.py:489 does:

python
for keyword in disallowed:
    if keyword in query_upper:
        return {"error": f"'{keyword}' is not allowed in queries"}

So a column like created_at contains CREATE, and the whole query gets rejected.

To Reproduce

Run:

SELECT created_at, updated_at FROM data

You get back:

{"error": "'CREATE' is not allowed in queries"}

Same problem with:

  • updated_at (matches UPDATE)
  • WHERE status = 'DELETED' (matches DELETE)
  • an alias like SELECT total AS total_created

These are all normal SELECTs but they never run.

Expected Behavior

The query should run. Only real write/DDL statements should be blocked, not a SELECT that happens to have a keyword inside a column name.

The csv_sql tool in the same repo already gets this right. At tools/src/aden_tools/tools/csv_tool/csv_tool.py:283 it uses word-boundary matching:

python
re.compile(r"\b(INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|TRUNCATE|EXEC|EXECUTE)\b", ...)

excel_sql should do the same so the two tools behave consistently.

Environment

  • OS: macOS
  • Python: 3.11

It's a pure logic bug so the OS/Python version don't really matter.

Additional Context

I'd like to work on this. Fix looks small - just switch excel_sql over to the same word-boundary check csv_sql already uses, and add a test. Please assign it to me.