-
Notifications
You must be signed in to change notification settings - Fork 41
Bound decoder resource use to prevent denial of service (STF-1488) #439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ec48a5d
d35f28e
faeba4e
24e2682
1aea5d0
d52f54a
5621b6c
1e7806d
bcd5228
ca1987a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,22 @@ | |
| History | ||
| ------- | ||
|
|
||
| 3.2.0 | ||
| +++++ | ||
|
|
||
| * Added limits to pure Python record and metadata decoding to prevent denial | ||
| of service from crafted databases: 65,536 values, 512 nesting levels, and | ||
| 2 MiB of string and bytes payload. Exceeding a limit raises | ||
| ``InvalidDatabaseError``. CPython may reach its recursion limit earlier, | ||
| which raises the same error. | ||
| * Rejected unsigned integers longer than 16 bytes and signed integers longer | ||
| than 4 bytes before reading their payload. | ||
| * Updated the vendored libmaxminddb to 1.14.0, which adds the same resource | ||
| limits to the C extension. | ||
| * Truncated reads that previously raised ``IndexError`` or ``struct.error`` | ||
| now raise ``InvalidDatabaseError``. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This bullet is broader than the code. Truncated payload reads — uint, string, bytes, and int32 with What actually changed is narrower: a truncated ctrl byte, a truncated size code, and a short pointer now raise 🤖 Comment by Claude (Claude Code) on behalf of Will. |
||
| * Improved pure Python lookup performance. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth one more bullet: Confirmed against 🤖 Comment by Claude (Claude Code) on behalf of Will. |
||
|
|
||
| 3.1.1 (2026-03-05) | ||
| ++++++++++++++++++ | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,6 +94,11 @@ The module will return an ``InvalidDatabaseError`` if the database is corrupt | |
| or otherwise invalid. A ``ValueError`` will be thrown if you look up an | ||
| invalid IP address or an IPv6 address in an IPv4 database. | ||
|
|
||
| The reader also raises ``InvalidDatabaseError`` when one record, or the | ||
| database metadata, exceeds its resource limits: 65,536 decoded values, 512 | ||
| levels of nesting, or 2 MiB of string and bytes data. Real databases stay far | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "512 levels of nesting" is stated flatly here but isn't reachable in the default configuration — a stock CPython caller gets
🤖 Comment by Claude (Claude Code) on behalf of Will. |
||
| below these limits. | ||
|
|
||
| Thread Safety | ||
| ------------- | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.