Skip to content

Add guard for dataset poisoning - #336

Merged
mielvds merged 4 commits into
masterfrom
fix-rdfc10-test074c
Sep 9, 2026
Merged

mielvds merged 4 commits into
masterfrom
fix-rdfc10-test074c

Conversation

@mielvds

@mielvds mielvds commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes #179 and RDFC1.0 test case test074c

  • Adds a maxPermutations for normalization, defaulting to 100000. When exceeded, normalization raises JsonLdError with code maximum canonicalization work exceeded. None disables the limit for callers that explicitly want unbounded exact canonicalization.
  • Replaces copy.deepcopy(issuer) in canon.py with IdentifierIssuer.copy() in identifier_issuer.py to have same issuer state, but less generic copy overhead in the hot permutation loop.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report
FileStmtsMissCoverMissing
lib/pyld
   canon.py2901296%36, 47, 51, 55, 85–86, 530, 552, 616, 626, 680–681
   context_resolver.py103892%78, 137, 151, 197, 203–205, 229
   iri_resolver.py141398%311–312, 322
   jsonld.py250116493%252–256, 305, 342, 347, 357, 374–389, 425–426, 468, 476, 496, 504–505, 613–618, 701–702, 717–718, 781–786, 811–812, 827–828, 838–839, 865, 913, 927–928, 951–952, 994, 1001, 1008, 1076, 1101, 1123–1125, 1135–1138, 1153, 1176, 1188–1191, 1287, 1296–1299, 1319, 1348, 1381, 1385, 1419, 1436–1438, 1448–1450, 1493, 1512–1515, 1528, 1577, 1680–1687, 1714–1716, 1742–1745, 1921, 1959, 2265, 2396, 2405–2412, 2506, 2533, 2557, 2565, 3159, 3209, 3228, 3293, 3346, 3349, 3412, 3497, 3531, 3539, 3817, 3822, 3824, 4019–4021, 4170, 4233, 4472, 4760, 4892, 4926, 4955–4958, 4980–4981, 5164, 5228, 5255, 5329, 5331, 5349, 5447, 5496, 5728, 5730, 5769, 5771, 5780, 5922, 6050, 6137, 6257–6271, 6403, 6630, 6636–6640, 6679, 6682, 6772–6773, 6782
   util.py72396%43, 116, 136
lib/pyld/cli
   app.py44295%77, 80
   entry.py12375%9–11, 24
   input.py52198%57
lib/pyld/documentloader
   aiohttp.py712269%29–39, 68, 74, 86, 98–106, 118–121, 138, 153–156
   file.py36197%49
   requests.py52590%57, 71, 83–91
   requests_sqlite_cache.py25196%19
   scheme_directed.py15193%38
   type_directed.py15193%41
TOTAL378522794% 

Tests Skipped Failures Errors Time
1931 28 💤 0 ❌ 0 🔥 3m 4s ⏱️

Added a breaking change for the `maxPermutations` option in `jsonld.normalize()` and updated the changelog accordingly.
@mielvds
mielvds merged commit 48b8fa8 into master Sep 9, 2026
18 checks passed
@mielvds
mielvds deleted the fix-rdfc10-test074c branch September 9, 2026 06:54
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.

Performance issues with jsonld.normalize

2 participants