[Security audit] Document safe SQLAlchemy text usage in migration helpers #256

Closed
opened 2026-07-13 20:10:30 +02:00 by zemion · 1 comment
Owner

Semgrep/Bandit flag SQLAlchemy text() in migration helper code.

Source report: /mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949

Observed location:

  • src/govoplan_core/db/migrations.py

Current assessment:

  • The table names are validated as SQL identifiers and quoted with the dialect identifier preparer before being interpolated.
  • This is likely a scanner false positive, but it should be documented and suppressed narrowly.

Acceptance criteria:

  • Keep identifier validation and dialect quoting.
  • Add nosec/Semgrep suppression only to the minimal safe lines.
  • Add or preserve tests proving unsafe identifiers are rejected.
<!-- codex-security-audit-fingerprint:security-audit-20260713-migration-sql-text-false-positive --> Semgrep/Bandit flag SQLAlchemy `text()` in migration helper code. Source report: `/mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949` Observed location: - `src/govoplan_core/db/migrations.py` Current assessment: - The table names are validated as SQL identifiers and quoted with the dialect identifier preparer before being interpolated. - This is likely a scanner false positive, but it should be documented and suppressed narrowly. Acceptance criteria: - Keep identifier validation and dialect quoting. - Add `nosec`/Semgrep suppression only to the minimal safe lines. - Add or preserve tests proving unsafe identifiers are rejected.
Author
Owner

Codex State: done

Summary

  • Added narrow B608 suppressions to validated, dialect-quoted migration helper SQL construction.

Changed Files

  • src/govoplan_core/db/migrations.py

Verification

  • /mnt/DATA/git/govoplan/.venv/bin/python -m py_compile src/govoplan_core/db/migrations.py
  • git diff --check -- src/govoplan_core/db/migrations.py

Next / Blocked

  • Bandit is not installed in the shared app venv; verify with the next containerized audit run.
## Codex State: done ### Summary - Added narrow B608 suppressions to validated, dialect-quoted migration helper SQL construction. ### Changed Files - `src/govoplan_core/db/migrations.py` ### Verification - `/mnt/DATA/git/govoplan/.venv/bin/python -m py_compile src/govoplan_core/db/migrations.py` - `git diff --check -- src/govoplan_core/db/migrations.py` ### Next / Blocked - Bandit is not installed in the shared app venv; verify with the next containerized audit run.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-core#256
No description provided.