Skip to content

Use bigint for PostgreSQL ASN fields#2713

Open
0xTaoZ wants to merge 1 commit into
certtools:developfrom
0xTaoZ:codex/psql-asn-bigint
Open

Use bigint for PostgreSQL ASN fields#2713
0xTaoZ wants to merge 1 commit into
certtools:developfrom
0xTaoZ:codex/psql-asn-bigint

Conversation

@0xTaoZ

@0xTaoZ 0xTaoZ commented Jul 3, 2026

Copy link
Copy Markdown

Summary

Fixes #2712 by generating PostgreSQL bigint columns for harmonization fields of type ASN.

IntelMQ's ASN harmonization type accepts valid 4-byte ASNs up to 4294967295, including private ASNs such as 4200393735. The PostgreSQL schema generator previously mapped ASN together with generic Integer to integer, which cannot store values above 2147483647 and can fail with psycopg2.errors.NumericValueOutOfRange when importing valid data.

Changes

  • Map ASN fields to PostgreSQL bigint in intelmq_psql_initdb.
  • Keep generic Integer fields mapped to PostgreSQL integer.
  • Update the cached generated schema fixture for source.asn and destination.asn.
  • Add a regression test covering the ASN-vs-Integer mapping.

Validation

  • python -m pytest intelmq/tests/bin/test_psql_initdb.py intelmq/tests/lib/test_harmonization.py

Result: 100 passed.

Risk

This only affects newly generated PostgreSQL schemas. bigint is a wider integer type, so it supports the current ASN range without narrowing existing accepted values.

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.

Postgres does not accept private ASN numbers

1 participant