You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: address review findings - SQL safety, scoping, test coverage
Inline findings (must-fix):
* .github/workflows/cve-data-sync.yml - drop uv, pip, and the
outer install. Add a job-level `permissions: contents: read` so
the drift check never holds write scope. Set
`persist-credentials: false` on actions/checkout so the default
token does not leak into later steps (the generator never makes
authenticated requests).
* data/cves.json - drop CVE-2025-12818. CVSS 5.9 is below the
documented >= 7.0 inclusion rule. Regenerator output stays in sync
on its own.
* pgFirstAid.sql / view_pgFirstAid.sql / view_pgFirstAid_managed.sql
- delete the two orphan comment fragments left behind by the
ponytail-marker removal in 8a73c19 (one after each cve/bug
preamble).
* tools/generate_cve_sql.py - replace Python's `!r` escaping
(which produces backslash-escaped strings that PG's standard
string literals don't recognize) with a `_sql_quote` helper
that doubles apostrophes. Drop the right-padding format specs
`{cvss:>4}` and `{summary!r:>3}` that produced inconsistent
alignment across columns. `render_bug_rows` now validates the
major prefix on the issue_id before calling `_version_num`,
so a malformed `PG<notanumber>-...` fails loudly instead of
silently emitting a row with the wrong server_version_num range.
* tools/README.md - trim the directory listing to only items that
exist on this branch (generator + tests + drift-check workflow;
no scraper entries on this branch). Drop the dangling "the
scrapers below" reference.
* view_pgFirstAid.sql - wrap the `pgfirstaid_pg_stat_statements_checks`
function body in `begin ... exception when
object_not_in_prerequisite_state then return; end;`, matching
the existing pattern in pgFirstAid.sql and
view_pgFirstAid_managed.sql. Catches the
installed-but-not-loadable case the extension-existence check
doesn't cover.
Nitpicks:
* .github/workflows/cve-data-sync.yml - same as F1; uv removed
entirely (generator is stdlib-only).
* testing/pgTAP/06_info_tests.sql - replace the tautological
`count(*) >= 0` checks with shape checks:
"no row violates the expected (severity, object_name prefix)
for the check_name". Vacuously true on a fully-patched version;
actually meaningful on a vulnerable one. Plan count preserved
at 24.
* tools/generate_cve_sql.py - same as F4; major validation done.
* tools/README.md - same as F5; command examples now use plain
`python tools/generate_cve_sql.py` matching the workflow.
* tools/tests/test_generate_cve_sql.py - relax the regex in
`test_major_order_is_numeric` to tolerate optional whitespace,
so the test no longer depends on the exact
alignment/no-alignment of `_render_cve_row`. Replace the empty
`FileRegenerationTests` stub with a real `RegenerateOneTests`
class that writes a SQL file to a tmpdir, invokes
`regenerate_one`, and asserts the on-disk content.
Verified: 14/14 generator unit tests, 24/24 pgTAP assertions
(06_info_tests on PG 17.11, no rows case), 21/21 integration tests
unchanged. Generator idempotent (`--check` exits 0 on regenerated
files).
('CVE-2024-7348', 8.8, 'pg_dump --restore uses an invalid type OID, allowing arbitrary SQL execution from a crafted dump',150000, 150008, 'https://www.postgresql.org/support/security/CVE-2024-7348/'),
1905
-
('CVE-2024-7348', 8.8, 'pg_dump --restore uses an invalid type OID, allowing arbitrary SQL execution from a crafted dump',160000, 160004, 'https://www.postgresql.org/support/security/CVE-2024-7348/'),
('CVE-2026-6471', 7.2, 'Logical decoding can dlopen arbitrary file via choice of decoder plugin (REPLICATION privilege required)',150000, 150019, 'https://www.postgresql.org/support/security/CVE-2026-6471/'),
1914
-
('CVE-2026-6471', 7.2, 'Logical decoding can dlopen arbitrary file via choice of decoder plugin (REPLICATION privilege required)',160000, 160015, 'https://www.postgresql.org/support/security/CVE-2026-6471/'),
1915
-
('CVE-2026-6471', 7.2, 'Logical decoding can dlopen arbitrary file via choice of decoder plugin (REPLICATION privilege required)',170000, 170011, 'https://www.postgresql.org/support/security/CVE-2026-6471/'),
1916
-
('CVE-2026-6471', 7.2, 'Logical decoding can dlopen arbitrary file via choice of decoder plugin (REPLICATION privilege required)',180000, 180005, 'https://www.postgresql.org/support/security/CVE-2026-6471/'),
1917
-
('CVE-2026-16239', 8.8, 'Type confusion in cursor CLOSE + DECLARE executes arbitrary code via portal/cursor re-creation with different types',150000, 150019, 'https://www.postgresql.org/support/security/CVE-2026-16239/'),
1918
-
('CVE-2026-16239', 8.8, 'Type confusion in cursor CLOSE + DECLARE executes arbitrary code via portal/cursor re-creation with different types',160000, 160015, 'https://www.postgresql.org/support/security/CVE-2026-16239/'),
1919
-
('CVE-2026-16239', 8.8, 'Type confusion in cursor CLOSE + DECLARE executes arbitrary code via portal/cursor re-creation with different types',170000, 170011, 'https://www.postgresql.org/support/security/CVE-2026-16239/'),
1920
-
('CVE-2026-16239', 8.8, 'Type confusion in cursor CLOSE + DECLARE executes arbitrary code via portal/cursor re-creation with different types',180000, 180005, 'https://www.postgresql.org/support/security/CVE-2026-16239/'),
('CVE-2024-7348', 8.8, 'pg_dump --restore uses an invalid type OID, allowing arbitrary SQL execution from a crafted dump', 150000, 150008, 'https://www.postgresql.org/support/security/CVE-2024-7348/'),
1904
+
('CVE-2024-7348', 8.8, 'pg_dump --restore uses an invalid type OID, allowing arbitrary SQL execution from a crafted dump', 160000, 160004, 'https://www.postgresql.org/support/security/CVE-2024-7348/'),
('CVE-2026-6471', 7.2, 'Logical decoding can dlopen arbitrary file via choice of decoder plugin (REPLICATION privilege required)', 150000, 150019, 'https://www.postgresql.org/support/security/CVE-2026-6471/'),
1909
+
('CVE-2026-6471', 7.2, 'Logical decoding can dlopen arbitrary file via choice of decoder plugin (REPLICATION privilege required)', 160000, 160015, 'https://www.postgresql.org/support/security/CVE-2026-6471/'),
1910
+
('CVE-2026-6471', 7.2, 'Logical decoding can dlopen arbitrary file via choice of decoder plugin (REPLICATION privilege required)', 170000, 170011, 'https://www.postgresql.org/support/security/CVE-2026-6471/'),
1911
+
('CVE-2026-6471', 7.2, 'Logical decoding can dlopen arbitrary file via choice of decoder plugin (REPLICATION privilege required)', 180000, 180005, 'https://www.postgresql.org/support/security/CVE-2026-6471/'),
1912
+
('CVE-2026-16239', 8.8, 'Type confusion in cursor CLOSE + DECLARE executes arbitrary code via portal/cursor re-creation with different types', 150000, 150019, 'https://www.postgresql.org/support/security/CVE-2026-16239/'),
1913
+
('CVE-2026-16239', 8.8, 'Type confusion in cursor CLOSE + DECLARE executes arbitrary code via portal/cursor re-creation with different types', 160000, 160015, 'https://www.postgresql.org/support/security/CVE-2026-16239/'),
1914
+
('CVE-2026-16239', 8.8, 'Type confusion in cursor CLOSE + DECLARE executes arbitrary code via portal/cursor re-creation with different types', 170000, 170011, 'https://www.postgresql.org/support/security/CVE-2026-16239/'),
1915
+
('CVE-2026-16239', 8.8, 'Type confusion in cursor CLOSE + DECLARE executes arbitrary code via portal/cursor re-creation with different types', 180000, 180005, 'https://www.postgresql.org/support/security/CVE-2026-16239/'),
@@ -1947,20 +1942,19 @@ where r.version_num >= c.affected_min
1947
1942
-- MEDIUM: Notable known bugs affecting the running PostgreSQL version. Curated
1948
1943
-- from https://www.postgresql.org/docs/release/: non-CVE fixes users hit in
1949
1944
-- production. affected_min/fixed_in are server_version_num integers.
1950
-
-- operator-reported bug proves it deserves a permanent seat.
1951
1945
insert into health_results
1952
1946
with issue_data(issue_id, summary, affected_min, fixed_in, doc_link) as (
1953
1947
values
1954
1948
-- GENERATED bugs BEGIN (do not edit; regenerate via tools/generate_cve_sql.py)
1955
-
('PG15-INSERT-CONFLICT-VISIBLE-01', 'INSERT ... ON CONFLICT can fail to enforce unique-constraint visibility checks in some MVCC edge cases',150000, 150001, 'https://www.postgresql.org/docs/release/15.1/'),
1956
-
('PG15-BTREE-PAGE-LEAK-02', 'B-tree page deletion can leak pages on workloads with heavy concurrent UPDATEs',150000, 150002, 'https://www.postgresql.org/docs/release/15.2/'),
1957
-
('PG15-LOGREP-SUBSCRIBER-CRASH-03', 'Logical replication subscriber can crash mid-transaction on large in-progress changes',150000, 150005, 'https://www.postgresql.org/docs/release/15.5/'),
1958
-
('PG16-BTREE-CORRUPT-04', 'B-tree index page splits could corrupt the tree on high-concurrency inserts',160000, 160002, 'https://www.postgresql.org/docs/release/16.2/'),
1959
-
('PG16-LOGICAL-DECODING-SUBXACT-05', 'Logical decoding can miss subtransaction changes for aborted DDL',160000, 160003, 'https://www.postgresql.org/docs/release/16.3/'),
1960
-
('PG16-VACUUM-MEMORY-LEAK-06', 'Vacuum memory accounting leaks over many iterations of aggressive autovacuum',160000, 160005, 'https://www.postgresql.org/docs/release/16.5/'),
1961
-
('PG17-COPY-PARTITION-ROUTING-07', 'COPY FROM routing into partitioned tables can drop rows under concurrent partition attach',170000, 170001, 'https://www.postgresql.org/docs/release/17.1/'),
1962
-
('PG17-PG-CREATESUBSCRIBER-08', 'pg_createsubscriber can leave slots uninitialized, breaking logical failover on first switchover',170000, 170004, 'https://www.postgresql.org/docs/release/17.4/'),
1963
-
('PG18-MERGE-UPSERT-VIEW-09', 'MERGE ... WHEN NOT MATCHED against an inheritance child can produce duplicate rows under concurrent INSERT',180000, 180001, 'https://www.postgresql.org/docs/release/18.1/')
1949
+
('PG15-INSERT-CONFLICT-VISIBLE-01', 'INSERT ... ON CONFLICT can fail to enforce unique-constraint visibility checks in some MVCC edge cases',150000, 150001, 'https://www.postgresql.org/docs/release/15.1/'),
1950
+
('PG15-BTREE-PAGE-LEAK-02', 'B-tree page deletion can leak pages on workloads with heavy concurrent UPDATEs',150000, 150002, 'https://www.postgresql.org/docs/release/15.2/'),
1951
+
('PG15-LOGREP-SUBSCRIBER-CRASH-03', 'Logical replication subscriber can crash mid-transaction on large in-progress changes',150000, 150005, 'https://www.postgresql.org/docs/release/15.5/'),
1952
+
('PG16-BTREE-CORRUPT-04', 'B-tree index page splits could corrupt the tree on high-concurrency inserts',160000, 160002, 'https://www.postgresql.org/docs/release/16.2/'),
1953
+
('PG16-LOGICAL-DECODING-SUBXACT-05', 'Logical decoding can miss subtransaction changes for aborted DDL',160000, 160003, 'https://www.postgresql.org/docs/release/16.3/'),
1954
+
('PG16-VACUUM-MEMORY-LEAK-06', 'Vacuum memory accounting leaks over many iterations of aggressive autovacuum',160000, 160005, 'https://www.postgresql.org/docs/release/16.5/'),
1955
+
('PG17-COPY-PARTITION-ROUTING-07', 'COPY FROM routing into partitioned tables can drop rows under concurrent partition attach',170000, 170001, 'https://www.postgresql.org/docs/release/17.1/'),
1956
+
('PG17-PG-CREATESUBSCRIBER-08', 'pg_createsubscriber can leave slots uninitialized, breaking logical failover on first switchover',170000, 170004, 'https://www.postgresql.org/docs/release/17.4/'),
1957
+
('PG18-MERGE-UPSERT-VIEW-09', 'MERGE ... WHEN NOT MATCHED against an inheritance child can produce duplicate rows under concurrent INSERT',180000, 180001, 'https://www.postgresql.org/docs/release/18.1/')
0 commit comments