@@ -235,26 +235,6 @@ JSON schema for wheel metadata has been produced.
235235This schema will be updated with each revision to the wheel metadata
236236specification. The schema is available in :ref: `0819-wheel-json-schema `.
237237
238- Handling of Integer and Float Values in JSON Package Metadata
239- -------------------------------------------------------------
240-
241- While no core metadata or wheel metadata values are currently encoded as
242- integers or floats, when decoding a JSON file, integer and float values should
243- be decoded as strings for both core metadata and wheel metadata. This is to
244- avoid compatibility issues due to differences in precision and representation
245- of integers and floats between languages and parsers. This also mitigates a
246- security risk with integer parsing denial of service attacks based on
247- `CVE-2020-10735 <https://github.com/advisories/GHSA-6jr7-xr67-mgxw >`__.
248-
249- If a future field of core metadata or wheel metadata needs to be encoded as an
250- integer or float, the field MUST be decoded lazily after loading the JSON
251- document. This minimizes the risks of denial of service attacks by minimizing
252- the integer parsing allowed during the deserialization process.
253-
254- If using the Python :mod: `!json ` module, parsing integers and floats as strings
255- can be accomplished by setting the ``parse_int `` and ``parse_float ``
256- keyword arguments to :func: `json.load ` or :func: `json.loads ` to :class: `str `.
257-
258238Handling of Duplicate Keys in JSON Package Metadata
259239---------------------------------------------------
260240
@@ -306,13 +286,20 @@ or ``WHEEL`` files.
306286Security Implications
307287=====================
308288
309- JSON encoded core metadata and wheel metadata have the potential for a denial
310- of service attack due to the quadratic parsing time complexity of parsing of
311- integers. This PEP mitigates this risk by requiring that integers and floats be
312- parsed as strings, and only lazily parsed into integers or floats after the
313- initial deserialization of the JSON document. With these mitigations in place,
314- concerns about denial of service attacks with JSON encoded package metadata are
315- considered minimal.
289+ Maliciously crafted JSON encoded metadata files have the potential to cause a
290+ denial of service attack due to the quadratic parsing time complexity of
291+ reading integer strings as reported in
292+ `CVE-2020-10735 <https://github.com/advisories/GHSA-6jr7-xr67-mgxw >`__. No
293+ package metadata fields are currently encoded as integers, so this risk can be
294+ mitigated by decoding integer values as strings when parsing JSON package
295+ metadata.
296+
297+ If using the Python :mod: `!json ` module, parsing integers as strings
298+ can be accomplished by setting the ``parse_int `` keyword argument to
299+ :func: `json.load ` or :func: `json.loads ` to :class: `str `.
300+
301+ With this mitigation in place, concerns about denial of service attacks with
302+ JSON encoded package metadata are considered minimal.
316303
317304
318305Reference Implementation
0 commit comments