Skip to content

fix(persistence): hide SQL parameters in failure logs - #1336

Merged
PsiACE merged 1 commit into
oceanbase:masterfrom
Kairo-J:fix/issue-1318-hide-sql-parameters
Aug 24, 2026
Merged

fix(persistence): hide SQL parameters in failure logs#1336
PsiACE merged 1 commit into
oceanbase:masterfrom
Kairo-J:fix/issue-1318-hide-sql-parameters

Conversation

@Kairo-J

@Kairo-J Kairo-J commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Closes #1318

Rationale for this change

Unexpected database failures could include SQLAlchemy bound parameters in exception tracebacks. Because the Server logs the original exception with exc_info, complete Memory content could be written to Server logs.

This violates the data-safety contract in RFC 0046. SQL parameters must be hidden while preserving safe diagnostic information such as the error category and traceback.

What changes are included in this PR?

  • Enable hide_parameters=True for the SQLite, OceanBase, and SeekDB SQLAlchemy engines.
  • Add an end-to-end regression test that forces a SQLite Memory INSERT failure and verifies that:
    • the request returns HTTP 500;
    • the failure traceback and safe database error remain available;
    • the Memory body is absent from every formatted log record.
  • Add engine configuration coverage for OceanBase and SeekDB.
  • No public API, configuration, database schema, dependency, or migration changes are included.

Are there any user-facing changes?

There are no end-user API or behavior changes.

For operators, database failure logs now hide SQL bound parameter values while retaining the SQL template, error category, traceback, operation metadata, and request context.

How was this change tested?

Targeted regression tests:

uv run python -m pytest \
  tests/e2e/test_observability.py::test_database_failure_log_does_not_include_memory_content \
  tests/builtin/persistence/test_oceanbase_profile.py::test_oceanbase_profile_hides_sql_parameters \
  tests/builtin/persistence/test_seekdb_profile.py::test_engine_uses_the_local_socket

Result: 3 passed

Full validation:

make check
make test
git diff --check

Result: 695 passed, 9 skipped

AI usage statement

OpenAI Codex (GPT-5.6 Sol) was used to analyze the issue, inspect the affected persistence and logging paths, implement the fix and regression tests, run validation, and review the resulting diff.

Enable SQLAlchemy parameter hiding for SQLite, OceanBase, and SeekDB engines to prevent Memory content from appearing in failure tracebacks.

Add regression coverage for formatted Server logs and engine configuration.

Refs oceanbase#1318

@PsiACE PsiACE left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@PsiACE
PsiACE merged commit bcc77a5 into oceanbase:master Aug 24, 2026
12 checks passed
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.

bug: database failures can log complete Memory content

2 participants