[Security audit] Centralize safe HTTP(S) fetch and URL validation in core #253

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

Semgrep/Bandit still flag several core urllib.request.urlopen call sites even though many already validate HTTP(S) locally.

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

Observed locations:

  • src/govoplan_core/core/configuration_packages.py
  • src/govoplan_core/core/module_installer.py
  • src/govoplan_core/core/module_license.py
  • src/govoplan_core/core/module_package_catalog.py

Acceptance criteria:

  • Introduce a small shared safe HTTP fetch helper in core.
  • Enforce absolute http:// or https:// URL, host presence, and no embedded credentials.
  • Provide timeout and clear error mapping.
  • Replace scattered local validation where practical.
  • Add narrow scanner suppressions only on the helper, not at every call site.
<!-- codex-security-audit-fingerprint:security-audit-20260713-core-http-fetch-helper --> Semgrep/Bandit still flag several core `urllib.request.urlopen` call sites even though many already validate HTTP(S) locally. Source report: `/mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949` Observed locations: - `src/govoplan_core/core/configuration_packages.py` - `src/govoplan_core/core/module_installer.py` - `src/govoplan_core/core/module_license.py` - `src/govoplan_core/core/module_package_catalog.py` Acceptance criteria: - Introduce a small shared safe HTTP fetch helper in core. - Enforce absolute `http://` or `https://` URL, host presence, and no embedded credentials. - Provide timeout and clear error mapping. - Replace scattered local validation where practical. - Add narrow scanner suppressions only on the helper, not at every call site.
Author
Owner

Codex State: done

Summary

  • Added shared validated HTTP(S) fetch helper under govoplan_core.security.http_fetch.
  • Moved module package catalog, module license, configuration package catalog, and installer health checks onto the helper so urlopen is centralized and suppressions are local.

Changed Files

  • src/govoplan_core/security/http_fetch.py
  • tests/test_http_fetch.py
  • src/govoplan_core/core/module_package_catalog.py
  • src/govoplan_core/core/module_license.py
  • src/govoplan_core/core/configuration_packages.py
  • src/govoplan_core/core/module_installer.py

Verification

  • /mnt/DATA/git/govoplan/.venv/bin/python -m py_compile src/govoplan_core/security/http_fetch.py src/govoplan_core/core/module_package_catalog.py src/govoplan_core/core/module_license.py src/govoplan_core/core/configuration_packages.py src/govoplan_core/core/module_installer.py
  • git diff --check -- src/govoplan_core/security/http_fetch.py tests/test_http_fetch.py src/govoplan_core/core/module_package_catalog.py src/govoplan_core/core/module_license.py src/govoplan_core/core/configuration_packages.py src/govoplan_core/core/module_installer.py
  • /mnt/DATA/git/govoplan/.venv/bin/python -m unittest tests.test_http_fetch tests.test_install_config selected module installer/catalog tests
## Codex State: done ### Summary - Added shared validated HTTP(S) fetch helper under govoplan_core.security.http_fetch. - Moved module package catalog, module license, configuration package catalog, and installer health checks onto the helper so urlopen is centralized and suppressions are local. ### Changed Files - `src/govoplan_core/security/http_fetch.py` - `tests/test_http_fetch.py` - `src/govoplan_core/core/module_package_catalog.py` - `src/govoplan_core/core/module_license.py` - `src/govoplan_core/core/configuration_packages.py` - `src/govoplan_core/core/module_installer.py` ### Verification - `/mnt/DATA/git/govoplan/.venv/bin/python -m py_compile src/govoplan_core/security/http_fetch.py src/govoplan_core/core/module_package_catalog.py src/govoplan_core/core/module_license.py src/govoplan_core/core/configuration_packages.py src/govoplan_core/core/module_installer.py` - `git diff --check -- src/govoplan_core/security/http_fetch.py tests/test_http_fetch.py src/govoplan_core/core/module_package_catalog.py src/govoplan_core/core/module_license.py src/govoplan_core/core/configuration_packages.py src/govoplan_core/core/module_installer.py` - `/mnt/DATA/git/govoplan/.venv/bin/python -m unittest tests.test_http_fetch tests.test_install_config selected module installer/catalog tests`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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