openbadgeslib 4.6.2__tar.gz → 4.6.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/Changelog.txt +1022 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/PKG-INFO +3 -3
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/README.md +1 -1
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/_jsonmodel.py +19 -3
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/_jws/__init__.py +4 -1
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/_jws/utils.py +7 -3
- openbadgeslib-4.6.4/openbadgeslib/_safejson.py +138 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/baking.py +101 -31
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/issue.py +13 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/keys.py +5 -4
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob1/badge.py +5 -1
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob1/verifier.py +17 -3
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob2/verifier.py +58 -4
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/__init__.py +3 -2
- openbadgeslib-4.6.4/openbadgeslib/ob3/_canon_guard.py +1079 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/_context_validation.py +114 -13
- openbadgeslib-4.6.4/openbadgeslib/ob3/_structure_screen.py +367 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/clr.py +88 -4
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/contexts/__init__.py +9 -7
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/credential.py +8 -1
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/did.py +135 -34
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/eudi.py +65 -2
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/ldp.py +486 -71
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/publish.py +143 -24
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/status.py +55 -14
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/verifier.py +38 -9
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/codes.py +16 -2
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/handler.py +47 -2
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/memory_store.py +14 -2
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/offer.py +11 -2
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/sqlite_store.py +27 -11
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/store.py +37 -13
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/openbadges_publish.py +44 -14
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/openbadges_signer.py +116 -23
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/openbadges_verifier.py +6 -2
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/util.py +172 -17
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/verify.py +10 -3
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib.egg-info/PKG-INFO +3 -3
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib.egg-info/SOURCES.txt +9 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib.egg-info/requires.txt +1 -1
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/pyproject.toml +58 -13
- openbadgeslib-4.6.4/tests/test_baking.py +489 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_docs.py +60 -1
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_issue_credential.py +80 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_jsonmodel.py +43 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_keys.py +6 -4
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob2_verifier.py +151 -0
- openbadgeslib-4.6.4/tests/test_ob3_canon_guard_dataset.py +92 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_did.py +321 -5
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_eudi_sd_jwt.py +153 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_ldp.py +78 -0
- openbadgeslib-4.6.4/tests/test_ob3_ldp_canon_guard.py +1821 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_ldp_context_validation.py +385 -1
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_ldp_ecdsa_sd.py +20 -0
- openbadgeslib-4.6.4/tests/test_ob3_ldp_ecdsa_sd_dos.py +1269 -0
- openbadgeslib-4.6.4/tests/test_ob3_ldp_structure_screen.py +1484 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_publish_cli.py +398 -1
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_status.py +267 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_oid4vci_protocol.py +476 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_oid4vci_store.py +146 -3
- openbadgeslib-4.6.4/tests/test_safejson.py +120 -0
- openbadgeslib-4.6.4/tests/test_signer_batch.py +598 -0
- openbadgeslib-4.6.4/tests/test_untrusted_input.py +788 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_util.py +494 -0
- openbadgeslib-4.6.2/tests/test_baking.py +0 -192
- openbadgeslib-4.6.2/tests/test_signer_batch.py +0 -252
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/CONTRIBUTING.md +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/GOVERNANCE.md +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/LICENSE.txt +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/MANIFEST.in +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/SECURITY.md +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/docs/README.md +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/__init__.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/_jws/exceptions.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/_ob1_api.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/_python_support.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/badge_model.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/cli_common.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/config.ini.example +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/confparser.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/errors.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/logs.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/mail.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob1/__init__.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob1/signer.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob2/__init__.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob2/models.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob2/signer.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/contexts/clr_context_2.0.1.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/contexts/credentials-v2.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/contexts/ob-v3p0-context-3.0.1.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/contexts/ob-v3p0-context-3.0.2.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/contexts/ob-v3p0-context-3.0.3.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/contexts/ob-v3p0-extensions.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/contexts/security-data-integrity-v2.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/contexts/security-multikey-v1.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/signer.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/status_list.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/ob3/status_registry.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/__init__.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/errors.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/formats.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/metadata.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/nonce.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/oid4vci/reconcile.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/openbadges_cli.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/openbadges_init.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/openbadges_keygenerator.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/openbadges_status.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib/py.typed +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib.egg-info/dependency_links.txt +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib.egg-info/entry_points.txt +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/openbadgeslib.egg-info/top_level.txt +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/setup.cfg +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/config1.ini +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/conformance/Dockerfile.ob3 +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/conformance/README.md +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/conformance/conftest.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/conformance/docker-compose.yml +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/conformance/relax-danubetech-checksums.awk +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/conformance/test_official_validators.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/conftest.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/fixtures/ob_schemas/README.md +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/fixtures/ob_schemas/ob_v3p0_achievementcredential_schema.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/fixtures/ob_schemas/ob_v3p0_profile_schema.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/fixtures/ob_schemas/refresh.sh +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/fixtures/vc_di_eddsa/README.md +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/fixtures/vc_di_eddsa/credentials-examples-v2.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/fixtures/vc_di_eddsa/doc-hash.txt +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/fixtures/vc_di_eddsa/key-pair.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/fixtures/vc_di_eddsa/proof-config-hash.txt +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/fixtures/vc_di_eddsa/signed-credential.json +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/images/sample1.png +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/images/sample1.svg +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/images/userimage01.svg +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/ldp_helpers.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/logo Python Espan/314/203a.svg" +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/logo Python Espa/303/261a.svg" +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_b64url.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_cli_json.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_cli_smoke.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_confparser.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_eddsa.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_errors.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_examples.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_issue.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_jws.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_key_operation.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_mail.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob1_badge_io.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob1_deprecation.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob1_signer.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob1_verifier.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob2_cli.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob2_error_branches.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob2_models.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob2_signer.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_clr.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_conformance_schema.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_contexts.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_credential.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_did_doc.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_endorsement.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_eudi_oid4vci.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_eudi_type_metadata.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_eudi_x5c.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_ldp_cli.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_ldp_errors.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_ldp_sign.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_signer.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_signer_cli_ldp.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_status_list.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_status_registry.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_ob3_verifier.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_oid4vci_config.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_oid4vci_reservations.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_openbadges_cli.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_public_api.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_python_support.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_sign_ecc.pem +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_sign_rsa.pem +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_verifier_cli_coverage.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_verify.py +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_verify_ecc.pem +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/test_verify_rsa.pem +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/withoutxmlheader.svg +0 -0
- {openbadgeslib-4.6.2 → openbadgeslib-4.6.4}/tests/withxmlheader.svg +0 -0
|
@@ -4,6 +4,1028 @@ OpenBadgesLib - Changelog
|
|
|
4
4
|
Newest first. Dates are ISO 8601 (YYYY-MM-DD).
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
* v4.6.4 - 2026-11-18
|
|
8
|
+
|
|
9
|
+
- security(ldp): on CPython 3.11 and 3.12 the JSON-LD to RDF conversion may
|
|
10
|
+
make at most 150,000 duplicate checks (1,000,000 on every other
|
|
11
|
+
interpreter, as before; `MAX_NODE_MAP_PAIRS` is 150,000 on CPython 3.11
|
|
12
|
+
and 3.12), which bounds what the stack-depth cliff that 4.6.3 documented
|
|
13
|
+
as a known limit can cost to about 1.3 s. Those two interpreters allocate the call-stack data in 16 KiB
|
|
14
|
+
chunks, and a tight loop whose calls straddle a chunk boundary pays an
|
|
15
|
+
allocation for each call; pyld's duplicate check for the values of a node
|
|
16
|
+
property (`compare_values`) is such a loop, and where the boundary falls
|
|
17
|
+
depends on how deep the caller's stack is and how deep the document
|
|
18
|
+
nests. At the wrong placement a comparison costs 5.8 to 7.5 microseconds
|
|
19
|
+
instead of 0.3, whatever the shape (flat arrays, values merged across
|
|
20
|
+
arrays, nodes referenced by identifier) and the size (101,000 to 979,000
|
|
21
|
+
comparisons: the same 18 to 24 times), in about 2 % of the caller depths,
|
|
22
|
+
so what a hit costs is the number of comparisons the allowance admits
|
|
23
|
+
times 7 microseconds, and only the allowance can bound it. Under the
|
|
24
|
+
1,000,000 a 29 KB document of 34 nested objects around 1,300 distinct
|
|
25
|
+
ones cost `OB3LdpVerifier.verify` 6.2 s of CPU at the worst of 105
|
|
26
|
+
placements (4 or 5 of them over 1 s; 0.26 to 0.27 s at the others) on
|
|
27
|
+
CPython 3.11.15 and 3.12.13, and a property of 1,400 values 6.6 to 6.9 s.
|
|
28
|
+
Under 150,000 the same document is refused after 0.10 to 0.12 s ("the
|
|
29
|
+
document puts too many values on its node properties", before pyld
|
|
30
|
+
builds the node map), and the widest property that fits (540 distinct
|
|
31
|
+
values, nested 21 to 36 levels deep, 1,120 placements per interpreter)
|
|
32
|
+
costs at most 1.24 s on 3.11 and 1.28 s on 3.12, in 10 placements over 1
|
|
33
|
+
s. CPython 3.10 and 3.13 to 3.15, which have no such outliers, keep the
|
|
34
|
+
1,000,000, and so does every number the other entries of 4.6.3 quote for
|
|
35
|
+
them.
|
|
36
|
+
|
|
37
|
+
- Compatibility, CPython 3.11 and 3.12 only: a Data Integrity document with
|
|
38
|
+
more than 548 distinct values in one property (about 387 in each of two;
|
|
39
|
+
n distinct values cost n(n-1)/2 comparisons, summed over the properties
|
|
40
|
+
of the document and its proof options) that 4.6.3 verified or signed is
|
|
41
|
+
refused or not signed, with the message above, which names the property
|
|
42
|
+
and the node. A credential with 549 to 1,414 tags, alignments or evidence
|
|
43
|
+
entries on one node is the case; a real badge has a handful of values per
|
|
44
|
+
property, a CLR is held to a couple of hundred members by the structure
|
|
45
|
+
limits of 4.6.3, and the same credential verifies on the other
|
|
46
|
+
interpreters. The cap is two constants of `openbadgeslib/ob3/_canon_guard.py`,
|
|
47
|
+
`MAX_NODE_MAP_PAIRS_FULL` and `MAX_NODE_MAP_PAIRS_CHUNKED_STACK`;
|
|
48
|
+
`MAX_NODE_MAP_PAIRS` is the one in force.
|
|
49
|
+
|
|
50
|
+
- fix(ob3): the split advice of `sign_clr_credential` counts the duplicate
|
|
51
|
+
checks too. A CLR that lists 650 achievements and as many associations
|
|
52
|
+
fits the 256 KiB, and the advice ("sign it as several CLRs of at most about
|
|
53
|
+
N achievements") was given from the bytes and the structure alone; on
|
|
54
|
+
CPython 3.11 and 3.12 that many entries are over the node-map allowance
|
|
55
|
+
first (about 550 in one list, 390 in each of two), so the CLR the advice
|
|
56
|
+
described was refused again. It now takes the smaller of the two, and what
|
|
57
|
+
it advises signs.
|
|
58
|
+
|
|
59
|
+
- security(util): `download_file` no longer reads the body of a redirect.
|
|
60
|
+
urllib's redirect handler reads the body of a 301, 302, 303, 307 or 308
|
|
61
|
+
whole before it follows the Location (`fp.read()`, no size), and
|
|
62
|
+
`MAX_DOWNLOAD_SIZE` (5 MiB) was only checked on the response that
|
|
63
|
+
`download_file` returns. Any host a badge names (an OB2 `id`, `badge`,
|
|
64
|
+
issuer or `revocationList` URL, the OB1 `verify.url`, a did:web host, a
|
|
65
|
+
status list) could therefore answer with a redirect whose body the
|
|
66
|
+
verifier buffered in memory, on each of up to 10 hops, bounded by nothing
|
|
67
|
+
but the 60-second budget. A 302 with a 32 MiB body in front of a 12-byte
|
|
68
|
+
document cost 33,554,607 bytes read and a peak of 48 MiB (64 MiB when
|
|
69
|
+
chunked), and the download succeeded; a redirect that announced more body
|
|
70
|
+
than it sent was an `http.client.IncompleteRead`. The response of a
|
|
71
|
+
redirect is now closed before the Location is followed (urllib never
|
|
72
|
+
reuses that connection), so the same downloads read 0.2 to 131 KB, the
|
|
73
|
+
headers and what one buffered read brings with them, on CPython 3.10 to
|
|
74
|
+
3.15, and the one that announced more than it sent returns its document
|
|
75
|
+
(so does one whose body arrives a byte at a time, which used to spend the
|
|
76
|
+
whole time budget). A redirect whose target is refused (not HTTPS, not a
|
|
77
|
+
public host) closes its response too, where it left the socket to the
|
|
78
|
+
garbage collector. Unchanged: the HTTPS-only and public-host checks of
|
|
79
|
+
every redirect target, the pinned IP, the size cap on the response
|
|
80
|
+
returned, the time budget, and what a redirect loop or a redirect without
|
|
81
|
+
a Location raises (`HTTPError`; a 308 on CPython 3.10, where urllib does
|
|
82
|
+
not follow it, likewise).
|
|
83
|
+
|
|
84
|
+
- security(ob3): one credential can no longer make a status check download
|
|
85
|
+
without limit. With `check_status=True` (`--check-status`) every
|
|
86
|
+
`credentialStatus` entry cost one download of the list it names, each
|
|
87
|
+
with its own 60-second budget, the same list again for every entry that
|
|
88
|
+
named it, and the number of entries is chosen by whoever built the
|
|
89
|
+
credential (a did:key credential is the presenter's own): a JWT-VC of
|
|
90
|
+
about 500 KB with 2,000 entries made 2,000 downloads. A credential with
|
|
91
|
+
more than 8 `credentialStatus` entries is now refused before anything is
|
|
92
|
+
fetched (`MAX_STATUS_ENTRIES` in `openbadgeslib/ob3/status.py`; a W3C
|
|
93
|
+
credential carries one entry per status purpose and this library issues
|
|
94
|
+
at most two), and within one check each distinct `statusListCredential`
|
|
95
|
+
URL is downloaded once, while every entry is still checked in full
|
|
96
|
+
against the list it names (purpose, index, `statusSize`, validity window
|
|
97
|
+
and, when the list is verified, its issuer and proof). Both live in
|
|
98
|
+
`check_credential_status`, so they hold for JWT-VC and Data Integrity
|
|
99
|
+
credentials alike. `OB3Verifier.verify` also checks the recipient before
|
|
100
|
+
the status, so a recipient mismatch costs no download; a credential that
|
|
101
|
+
is both revoked and presented for the wrong recipient is now reported as
|
|
102
|
+
a recipient mismatch.
|
|
103
|
+
|
|
104
|
+
- security(publish): `openbadges-publish` publishes the public key a
|
|
105
|
+
badge's `public_key` file holds, after checking it, and no longer a copy
|
|
106
|
+
of the file. All three versions wrote the configured file verbatim as
|
|
107
|
+
`verify.pem` (`-V 2` also as `publicKeyPem` in `key.json`), so a config
|
|
108
|
+
with one crossed path (`public_key` naming the private key file) served
|
|
109
|
+
the signing key at the public URL, with exit 0; `-V 3` reported that the
|
|
110
|
+
file was not a public key, left the badge out of `did.json`, and
|
|
111
|
+
published the file all the same. The file is now read once and must be
|
|
112
|
+
an RSA, EC or Ed25519 public key (any PEM flavour, PKCS#1
|
|
113
|
+
`RSA PUBLIC KEY` included): a file with `PRIVATE KEY` anywhere in it is
|
|
114
|
+
refused before it is parsed, and when the badge's `private_key` is
|
|
115
|
+
readable the public key must be its public half, so the key of another
|
|
116
|
+
pair is refused too. What is written is that key re-serialised as a
|
|
117
|
+
SubjectPublicKeyInfo `PUBLIC KEY` PEM, never the file's bytes. On a
|
|
118
|
+
refusal `-V 1` and `-V 2` exit 1 before creating the output directory (a
|
|
119
|
+
missing key file is the same clean exit, where it was a traceback over a
|
|
120
|
+
half-written tree), and `-V 3` writes nothing for that badge: it is left
|
|
121
|
+
out of `did.json`, listed under `skipped`, and the run exits 2, or 1
|
|
122
|
+
with nothing written when no badge is left to publish. The status lists
|
|
123
|
+
of a refused badge are not regenerated either, so a `--revoke` on such a
|
|
124
|
+
config records the revocation in the registry and does not publish it
|
|
125
|
+
until the config is fixed; a badge whose key file is merely missing
|
|
126
|
+
behaves as before. The check is
|
|
127
|
+
`load_publishable_public_key` in `openbadgeslib/ob3/publish.py`, shared
|
|
128
|
+
by the three paths.
|
|
129
|
+
Compatibility: the `verify.pem` of a key file that was not already in
|
|
130
|
+
that form (PKCS#1, or without a trailing newline) differs in bytes from
|
|
131
|
+
the file; the key is the same. Whoever published with such a config
|
|
132
|
+
served the private key: delete the published `verify.pem` and `key.json`
|
|
133
|
+
(a refused `-V 3` run does not remove what an earlier run left in the
|
|
134
|
+
output directory) and replace the key pair.
|
|
135
|
+
|
|
136
|
+
- security(did): a did:web identifier is validated before it becomes a URL,
|
|
137
|
+
and the DID document it resolves to must be that DID's. The resolver
|
|
138
|
+
percent-decoded every component of the identifier, where the method
|
|
139
|
+
decodes only the `%3A` of a port, so an escaped `/`, `?`, `#` or `@`, a
|
|
140
|
+
`..` or an empty component chose any URL of the host, or another host:
|
|
141
|
+
`did:web:good.example:uploads:evil%23` was read from
|
|
142
|
+
`https://good.example/uploads/evil#/did.json` (the fragment drops the
|
|
143
|
+
mandatory `/did.json`), `did:web:good.example:api%3Fcb%3D` from
|
|
144
|
+
`https://good.example/api?cb=/did.json`, and
|
|
145
|
+
`did:web:good.example%40evil.example` from
|
|
146
|
+
`https://good.example@evil.example/.well-known/did.json`. Whoever could
|
|
147
|
+
place a JSON file at any path of a host (an upload, an endpoint that
|
|
148
|
+
echoes JSON) had an issuer DID of that host, which
|
|
149
|
+
`verify_badge(..., resolve_did=True)` and `openbadges-verifier
|
|
150
|
+
--resolve-did` reported as valid and trusted. Now the first component
|
|
151
|
+
must be a DNS name with an optional `%3A` port (up to 65535), and each
|
|
152
|
+
path component is non-empty, made of the DID syntax's characters
|
|
153
|
+
(letters, digits, `.`, `-`, `_`, `~` and well-formed `%XX` escapes) and
|
|
154
|
+
may not decode to `.`, `..`, or to anything holding `/`, `?`, `#`, `@`,
|
|
155
|
+
`:`, a backslash or a control character; anything else is an
|
|
156
|
+
`OB3VerificationError` ("invalid did:web identifier") and nothing is
|
|
157
|
+
fetched. A path component reaches the URL as the DID spells it, escapes
|
|
158
|
+
included. This covers `resolve_did`, `resolve_verification_method`,
|
|
159
|
+
`OB3Verifier.for_issuer_did`, `OB3LdpVerifier` and the CLI.
|
|
160
|
+
Behaviour change for issuers: a DID document whose `id` differs from the
|
|
161
|
+
DID it was fetched for, or that has none, is now refused (the host name
|
|
162
|
+
is compared without regard to case, the path exactly). The `did.json`
|
|
163
|
+
that `openbadges-publish -V 3` writes carries the right `id`; a
|
|
164
|
+
hand-written one, or one copied to a URL other than the one its DID
|
|
165
|
+
names, has to be corrected. A DID whose path holds an escape is read at
|
|
166
|
+
a different URL than before (`did:web:host:a%20b` at
|
|
167
|
+
`https://host/a%20b/did.json`, no longer at `https://host/a b/did.json`),
|
|
168
|
+
so a `publish_url` written already percent-encoded
|
|
169
|
+
(`https://host/a%20b/`), whose DID is `did:web:host:a%2520b`, no longer
|
|
170
|
+
resolves where it is served: write it unencoded.
|
|
171
|
+
|
|
172
|
+
- security(ob2): the HostedBadge `startsWith` scope is tested on the path a
|
|
173
|
+
server resolves, not on the one written in the assertion `id` (#339). The
|
|
174
|
+
origin and path-segment comparison of 4.4.3 ran on the path as written,
|
|
175
|
+
and the request goes out with that path untouched while the server that
|
|
176
|
+
answers normalises it: under `startsWith:
|
|
177
|
+
https://issuer.example/assertions/` the id
|
|
178
|
+
`https://issuer.example/assertions/../uploads/evil.json` (or `%2e%2e`, or
|
|
179
|
+
`./../`) was in scope and was served from `/uploads/`, so whoever could
|
|
180
|
+
write a JSON file anywhere on the issuer's origin minted hosted assertions
|
|
181
|
+
that `OB2Verifier.verify` and `verify_hosted` reported as that issuer's.
|
|
182
|
+
The path of the id and of each declared prefix is now decoded once and is
|
|
183
|
+
in no scope unless servers can read it one way only: no `.` or `..`
|
|
184
|
+
segment (bare or with path parameters, `..;x`), no empty segment (`//`),
|
|
185
|
+
no backslash or encoded slash (`%5c`, `%2f`), no escape left after the one
|
|
186
|
+
decoding (`%252e`), no control character and no escape that is not UTF-8
|
|
187
|
+
(the overlong `%c0%ae`). Such an id fails with "outside the issuer's
|
|
188
|
+
declared startsWith scope". The two sides are compared decoded, so `%41`
|
|
189
|
+
in a prefix now matches `A` in an id. Compatibility: under `startsWith`
|
|
190
|
+
an id with an encoded percent sign followed by two hex digits (`%2520`)
|
|
191
|
+
or with escapes in a legacy encoding (`caf%e9`) is refused, and
|
|
192
|
+
`/assertions;v=1` no longer counts as the prefix `/assertions` itself.
|
|
193
|
+
Issuers that declare no `startsWith` (the same-origin default,
|
|
194
|
+
`allowedOrigins`) are not affected.
|
|
195
|
+
|
|
196
|
+
- security(baking): the filter that strips active content from an SVG badge
|
|
197
|
+
image before the token is baked into it (#328) let four things through,
|
|
198
|
+
a plain `<script>` among them (#340). It walked the subtree of the first
|
|
199
|
+
element named `svg` rather than the document, so a script beside that
|
|
200
|
+
element survived (`<svg:svg ...><svg:script>` around a nested `<svg>`, or
|
|
201
|
+
an XHTML document that merely contains an `<svg>`); it kept an
|
|
202
|
+
`<?xml-stylesheet?>` processing instruction, whose XSLT sheet can emit
|
|
203
|
+
script; it trimmed the ends of a URL before testing its scheme, where a
|
|
204
|
+
browser also drops tab, LF and CR inside it (`java script:`); and it
|
|
205
|
+
kept a SMIL `<set attributeName="href" to="javascript:...">`, which gives
|
|
206
|
+
its target the URL the filter had removed. `baking.bake_svg` now filters
|
|
207
|
+
the whole document: elements are matched by local name whatever their
|
|
208
|
+
prefix, every element in the XHTML namespace goes, `set` / `animate*`
|
|
209
|
+
elements that target `href` / `src` / `action` or an `on*` attribute go
|
|
210
|
+
(animations of `opacity`, `fill`, `transform` and the like stay),
|
|
211
|
+
`xml-stylesheet` instructions and every processing instruction inside the
|
|
212
|
+
tree go, the DOCTYPE's internal subset goes (an `<!ATTLIST svg onload
|
|
213
|
+
CDATA "...">` default put the handler back when the baked file was
|
|
214
|
+
parsed), and C0 controls and spaces are removed from a URL before the
|
|
215
|
+
scheme test. Namespace declarations are now left alone: an `xmlns:`
|
|
216
|
+
prefix that began with `on`, or was called `href`, `src` or `action` with
|
|
217
|
+
a `javascript:` or `data:` namespace name, was removed as if it were a
|
|
218
|
+
handler or a link, which left the baked file with an unbound prefix that
|
|
219
|
+
no parser reads (`xmlns:ont="..."` in the metadata was enough) and would
|
|
220
|
+
have let an element fall back to an outer XHTML binding after it had been
|
|
221
|
+
judged. Compatibility: the root element must be `svg` in the
|
|
222
|
+
`http://www.w3.org/2000/svg` namespace, and the token is appended to it. A
|
|
223
|
+
root written with a prefix (`<s:svg xmlns:s="...">`), which used to end in
|
|
224
|
+
an `AttributeError`, now bakes; a document with any other root, or an
|
|
225
|
+
`<svg>` with no `xmlns` (which a browser does not render as an image), is
|
|
226
|
+
refused with `BadgeImgFormatUnsupported`, which the signers report as
|
|
227
|
+
`ErrorSigningFile` ("Unable to bake SVG ...: The image is not an SVG
|
|
228
|
+
document ..."). `has_svg` and `extract_svg` are unchanged, so badges baked
|
|
229
|
+
by earlier versions read as before, and an SVG that holds none of the
|
|
230
|
+
above bakes to the same bytes as before.
|
|
231
|
+
|
|
232
|
+
- security(oid4vci): the `tx_code` attempt cap holds against a burst of
|
|
233
|
+
guesses. The token endpoint tested the cap on the copy of the grant each
|
|
234
|
+
request had read, verified the guess (scrypt) and only then counted the
|
|
235
|
+
failure, so every request that read the grant before the third failure
|
|
236
|
+
was recorded had its guess verified: 32 wrong PINs sent at once to an
|
|
237
|
+
offer with 3 attempts got 32 verifications on `InMemoryOID4VCIStore` and
|
|
238
|
+
13 to 15 on `SqliteOID4VCIStore`, and the guessing budget of a PIN-gated
|
|
239
|
+
offer was the concurrency of the server. `handle_token_request` now
|
|
240
|
+
reserves the attempt before it verifies anything, through a new store
|
|
241
|
+
method, `reserve_tx_attempt(grant_id) -> bool`, that counts it only while
|
|
242
|
+
the grant is offered and has one left (one conditional UPDATE in SQLite,
|
|
243
|
+
one test-and-increment under the lock in memory). At most
|
|
244
|
+
`tx_code_max_attempts` verifications ever run against a grant: the same
|
|
245
|
+
burst gets 3, on both stores. A request that finds no attempt left is not
|
|
246
|
+
verified; it pays the scrypt any other rejection pays, closes the offer
|
|
247
|
+
and gets the same `invalid_grant`. One request at a time nothing changes:
|
|
248
|
+
two wrong PINs and then the right one redeem the code, the third wrong
|
|
249
|
+
one invalidates the offer. A right PIN now counts as an attempt as well.
|
|
250
|
+
`record_tx_failure` no longer counts (the reservation did) and no longer
|
|
251
|
+
touches a grant that is not offered: it used to mark the grant
|
|
252
|
+
invalidated at the cap whatever its state, so a wrong guess reported
|
|
253
|
+
after the code was redeemed could take the credential from whoever held
|
|
254
|
+
the PIN. API change, for a custom `OID4VCIStore` only: it needs
|
|
255
|
+
`reserve_tx_attempt`, and its `record_tx_failure` must stop incrementing
|
|
256
|
+
and must guard the state; without the new method a PIN-gated token
|
|
257
|
+
request fails with AttributeError, and with it but an old
|
|
258
|
+
`record_tx_failure` an offer closes after two wrong PINs instead of
|
|
259
|
+
three. The SQLite schema is unchanged.
|
|
260
|
+
|
|
261
|
+
- security(oid4vci): two more cases in which the token endpoint answered a
|
|
262
|
+
request according to the kind of grant its code names (4.4.4 closed the
|
|
263
|
+
missing-PIN one), and one unhandled exception at the credential endpoint.
|
|
264
|
+
A `tx_code` that is not a string (a JSON number from a naive decoder,
|
|
265
|
+
bytes nobody decoded) was `invalid_grant` for an unknown code,
|
|
266
|
+
`invalid_request` for a live offer without a PIN, and an AttributeError
|
|
267
|
+
out of scrypt for a live PIN-gated one: a 500, for a guess that was not
|
|
268
|
+
counted as an attempt. `handle_token_request` now refuses it before the
|
|
269
|
+
store is asked anything, as `invalid_request` ("the tx_code parameter
|
|
270
|
+
must be a string"), the same for every code, and nothing is spent. That
|
|
271
|
+
includes `0`, `False` and `b''`, which were taken for no `tx_code` at
|
|
272
|
+
all. A string `tx_code` sent to a live offer that does not use one was
|
|
273
|
+
answered at once, where an unknown code costs a scrypt; it now burns the
|
|
274
|
+
same `dummy_tx_verification()` first. Its error code has not changed: it
|
|
275
|
+
is still `invalid_request` where every other rejection is
|
|
276
|
+
`invalid_grant`, so that answer still says "live, and no PIN" to whoever
|
|
277
|
+
holds the code. And `handle_credential_request` answers an `access_token`
|
|
278
|
+
that is not a string with the 401 `invalid_token` of a missing one,
|
|
279
|
+
instead of an AttributeError.
|
|
280
|
+
|
|
281
|
+
- security(cli): `openbadges-signer` no longer writes a badge through a
|
|
282
|
+
symlink planted in the output directory (#342). The output names are
|
|
283
|
+
predictable (`badge_<n>_<recipient>.<ext>` and `.assertion.json`), the
|
|
284
|
+
already-signed check used `os.path.isfile`, which follows links and is
|
|
285
|
+
false for a dangling one, and the file was written with a plain `open()`:
|
|
286
|
+
a local user able to write to a shared `-o` directory could make the
|
|
287
|
+
operator create a file anywhere the operator can write or, with
|
|
288
|
+
`--force`, overwrite an existing one, with badge bytes. Anything at the
|
|
289
|
+
output name now counts as already signed (a symlink included, whatever it
|
|
290
|
+
points to), the file is created exclusively, and `--force` writes a new
|
|
291
|
+
file beside it and renames it over the name, so a symlink or a hard link
|
|
292
|
+
is replaced and what it pointed to is left untouched. On POSIX a link that
|
|
293
|
+
appears between the check and the write ends in the usual "Could not write
|
|
294
|
+
badge" exit. This covers `-V 1`, `-V 2` and `-V 3`, batch mode and the `-H`
|
|
295
|
+
assertion JSON. Compatibility: with `-H`, an existing `.assertion.json`
|
|
296
|
+
is now a reason to refuse (single badge) or skip (batch; the skipped
|
|
297
|
+
entry names it as `assertion_file`) unless `--force` is given, where it
|
|
298
|
+
used to be overwritten when the badge file itself was absent; and
|
|
299
|
+
`--force` replaces the file instead of truncating it in place, so the
|
|
300
|
+
result has the mode of a newly signed badge (from the umask) rather than
|
|
301
|
+
the mode of the file it replaced.
|
|
302
|
+
|
|
303
|
+
- security(eudi): `issue_badge_sd_jwt` binds a holder key only if it is a
|
|
304
|
+
public key (#343). `holder_jwk` was signed into `cnf.jwk` as given, with
|
|
305
|
+
no look at it, and `cnf` travels with the credential: a caller that
|
|
306
|
+
forwarded the whole key its wallet or client sent had the holder's private
|
|
307
|
+
key issued inside the badge (a private P-256 or Ed25519 JWK kept its `d`,
|
|
308
|
+
a symmetric `oct` key its `k`), and a str or a list became the `jwk`
|
|
309
|
+
itself. RFC 7800 section 3.2 wants a public key there. Now a value that is
|
|
310
|
+
not a JWK object, a JWK that carries any of the private members `d`, `k`,
|
|
311
|
+
`p`, `q`, `dp`, `dq`, `qi`, `oth` or `priv`, and a `kty` other than `EC`,
|
|
312
|
+
`OKP` or `RSA` raise `EudiError` before anything is signed. The key is
|
|
313
|
+
refused, never reduced to its public half: stripping would bind and
|
|
314
|
+
publish a key the caller did not mean to hand over. A public JWK is bound
|
|
315
|
+
as before, with its `kid`, `use`, `alg`, `key_ops` or `x5c` if it has
|
|
316
|
+
them. `issue_credential_from_conf(holder_jwk=...)` refuses the same
|
|
317
|
+
members before it derives the did:jwk; it already refused all of them but
|
|
318
|
+
`oth` (the RSA multi-prime member), which went into the signed `sub` of a
|
|
319
|
+
`jwt_vc_json` credential and into the `cnf` of a `vc+sd-jwt` one. The
|
|
320
|
+
OID4VCI credential endpoint never issued a key proof whose `jwk` header
|
|
321
|
+
carries `d`, `k`, `p`, `q`, `dp`, `dq`, `qi` or `priv` (openvc-core
|
|
322
|
+
answers `invalid_proof`), but it does not look for `oth` either: a P-256
|
|
323
|
+
proof key with a stray `oth` member was issued with it, in both formats,
|
|
324
|
+
and `handle_credential_request` now raises `IssuanceError` for it.
|
|
325
|
+
|
|
326
|
+
- security(ldp): the subject of an embedded endorsement credential may
|
|
327
|
+
carry only `id`, `type` and `endorsementComment`, the members of an
|
|
328
|
+
EndorsementSubject. An embedded endorsement names the node it endorses
|
|
329
|
+
(the achievement, the issuer) as its `credentialSubject`, and RDF lets a
|
|
330
|
+
node be described under any JSON object that references it, so the holder
|
|
331
|
+
of a Data Integrity badge could move the achievement's `description`,
|
|
332
|
+
`image` or `alignment` (the issuer's `name`, `url`, `image` or
|
|
333
|
+
`description`) into that subject: the same signed dataset, the same
|
|
334
|
+
signature, the document still its own compacted form, and
|
|
335
|
+
`OB3LdpVerifier.verify` returned a credential without them (an empty
|
|
336
|
+
description, no issuer name). Validity, status, recipient and issuer
|
|
337
|
+
verdicts were not affected. The rule goes by the position, not by the
|
|
338
|
+
subject's EndorsementSubject type, which a holder could move out the same
|
|
339
|
+
way. Compatibility: a badge whose embedded endorsement gives its subject
|
|
340
|
+
any other member, an extension included, no longer verifies. Not covered:
|
|
341
|
+
a node the issuer itself describes twice in the credential (the issuer
|
|
342
|
+
again as `achievement.creator`, a `criteria` with the achievement's id),
|
|
343
|
+
where a member can still be left only in the description the model does
|
|
344
|
+
not read (#345).
|
|
345
|
+
|
|
346
|
+
- security(ldp): a blank node label (`_:b7`) is refused as the `id` of a
|
|
347
|
+
Data Integrity credential, of its issuer, of a `credentialSubject` or of
|
|
348
|
+
a `credentialStatus` entry, in the credential and in each embedded
|
|
349
|
+
endorsement. A label is not part of the signed dataset (RDF
|
|
350
|
+
canonicalization relabels blank nodes), so `"id": "_:b7"` written on a
|
|
351
|
+
node that was signed without an id kept the signature valid and the
|
|
352
|
+
document its own compacted form, and `OB3LdpVerifier.verify` returned the
|
|
353
|
+
label as an identifier: as `recipient_id` for a subject signed with a
|
|
354
|
+
hashed `identifier` only (and `expected_recipient="_:b7"` matched it), as
|
|
355
|
+
the id of a status entry, and as the id of a credential or of an issuer
|
|
356
|
+
signed without one, which is refused as malformed when no label is
|
|
357
|
+
added. `OB3LdpSigner` no longer issues a credential with such an id
|
|
358
|
+
(`ErrorSigningFile`); the low-level functions, which check the proof
|
|
359
|
+
alone, are unchanged, and so is the JWT-VC path, where every byte is
|
|
360
|
+
signed. With ecdsa-sd-2023 only the credential's and the issuer's ids
|
|
361
|
+
are held to the rule: openvc-core's derive writes a label on every node
|
|
362
|
+
of a presentation that has no id, and OB 3.0 makes the id of a subject
|
|
363
|
+
and of a status entry optional, so a presentation of a credential whose
|
|
364
|
+
status entry has no id carries one there, keeps verifying, and still
|
|
365
|
+
shows it. The ids of other nodes (the achievement, an evidence, an
|
|
366
|
+
image) are not covered either: a rule for every node would refuse every
|
|
367
|
+
such presentation of a badge this library issues, whose `criteria` has
|
|
368
|
+
no id and so carries a label (#346).
|
|
369
|
+
|
|
370
|
+
- security(ldp): `OB3LdpVerifier.verify` checks the recipient before the
|
|
371
|
+
status, as `OB3Verifier.verify` does. With `check_status=True` and an
|
|
372
|
+
`expected_recipient` that the credential is not for, the status list was
|
|
373
|
+
downloaded (and its signature verified) before the mismatch was
|
|
374
|
+
reported; the recipient binding is local and free, so a credential
|
|
375
|
+
presented for someone else now costs no status list download. The proof,
|
|
376
|
+
the validity window and the ecdsa-sd-2023 lifecycle checks still come
|
|
377
|
+
first, so a did:web `verificationMethod` is still resolved before the
|
|
378
|
+
recipient is looked at. Compatibility: a credential that is presented
|
|
379
|
+
for the wrong recipient and whose status check would also fail (revoked,
|
|
380
|
+
suspended, a list that cannot be fetched or verified) is reported as a
|
|
381
|
+
recipient mismatch, not as the status failure; for the right recipient,
|
|
382
|
+
and without `expected_recipient`, nothing changes (#336).
|
|
383
|
+
|
|
384
|
+
* v4.6.3 - 2026-10-21
|
|
385
|
+
|
|
386
|
+
- fix(jws): the native JWS engine (OB1 and OB2 signed badges) answers a
|
|
387
|
+
hostile token with its own error, and so does everything that parses JSON
|
|
388
|
+
an attacker controls through it. A protected header nested past the
|
|
389
|
+
parser's recursion limit (a 3.6 KB token on Python 3.10 and 3.11) raised a
|
|
390
|
+
bare RecursionError out of `OB2Verifier.verify`, `verify_badge(..., '2')`
|
|
391
|
+
and the OB1 signature check, before any signature was looked at. The
|
|
392
|
+
shared JSON loader (`_jws.utils.from_json`) is now bounded by the new
|
|
393
|
+
`openbadgeslib/_safejson.py`: more than 128 levels of nesting, a lone
|
|
394
|
+
surrogate (the `\ud800` escape of an ASCII document, which cannot be
|
|
395
|
+
encoded to UTF-8) and a number that is not finite (`1e999`, `NaN`) are
|
|
396
|
+
refused as a ValueError, which the callers already map to a signature
|
|
397
|
+
failure or a failed verdict, and `verify_block` types a str token that
|
|
398
|
+
holds a lone surrogate. Nothing legitimate nests that deep or carries
|
|
399
|
+
those values.
|
|
400
|
+
|
|
401
|
+
- fix(ob1): a hostile OpenBadges 1.0 badge is a verdict, not a traceback.
|
|
402
|
+
`BadgeSigned.read_from_file` raised a bare RecursionError for a body
|
|
403
|
+
nested past the parser's limit and a UnicodeEncodeError for a lone
|
|
404
|
+
surrogate in `recipient.identity` or `salt`, and `Verifier.check_expiration`
|
|
405
|
+
an OverflowError for an `expires` of -1e300 or -10**30 (the signature had
|
|
406
|
+
already verified, so `get_badge_status` raised instead of returning its
|
|
407
|
+
VerifyInfo). The CLI printed a traceback for each. They are now
|
|
408
|
+
AssertionFormatIncorrect, and an unformattable expiry reads as an invalid
|
|
409
|
+
timestamp. A body whose `expires` is `1e999`, `NaN` or `Infinity` is
|
|
410
|
+
refused at parse (it used to read as "never expires"). And
|
|
411
|
+
`get_badge_status` returns its VerifyInfo when a server answers a badge,
|
|
412
|
+
issuer or revocation URL with a malformed response (a chunked body that
|
|
413
|
+
ends inside a chunk raised `http.client.IncompleteRead` out of it).
|
|
414
|
+
|
|
415
|
+
- fix(ob2): a timestamp with no UTC `datetime` no longer ends in an
|
|
416
|
+
OverflowError. `9999-12-31T23:59:59-05:00` is 10000-01-01T04:59:59Z and
|
|
417
|
+
`0001-01-01T00:00:00+05:00` precedes year 1: valid ISO 8601, comparable,
|
|
418
|
+
and accepted by the parser, but `Assertion.to_dict()` converted them to
|
|
419
|
+
UTC, so a hosted assertion carrying one as `issuedOn` or `expires` raised
|
|
420
|
+
OverflowError out of `OB2Verifier.verify` after the library had fetched the
|
|
421
|
+
attacker's `id` URL, and `OB2Signer.sign` and `OpenBadgeCredential.to_vc()`
|
|
422
|
+
raised it for a datetime like it. The date helper the OB2 and OB3 models
|
|
423
|
+
share still accepts every aware timestamp, as 4.6.2 did (a credential's
|
|
424
|
+
`validFrom`/`validUntil` and a proof's `created`/`expires` too), and the one
|
|
425
|
+
place that converts to UTC now writes such an instant with its own offset
|
|
426
|
+
(`9999-12-31T23:59:59-05:00`), which names the same instant. Every other
|
|
427
|
+
value is written as before, except that a year below 1000 is zero-padded
|
|
428
|
+
whatever the platform (glibc's strftime left it bare: `1-01-01T00:00:00Z`
|
|
429
|
+
for `0001-01-01T00:00:00Z`). A remote CryptographicKey whose
|
|
430
|
+
`publicKeyPem` holds a lone surrogate raised UnicodeEncodeError, even on
|
|
431
|
+
the hosted path that is documented never to fail the verdict; it is an
|
|
432
|
+
OB2VerificationError now.
|
|
433
|
+
|
|
434
|
+
- security(ob3): a hostile JWT-VC is an OB3VerificationError, whatever its
|
|
435
|
+
header or payload carries. PyJWT's own header checks (a non-string `kid`,
|
|
436
|
+
an invalid `crit`) raise InvalidTokenError, DecodeError's parent, which
|
|
437
|
+
`OB3Verifier.verify`, `verify_endorsement_jwt`, the status-list proof check
|
|
438
|
+
and `verify_badge` did not catch (the CLI printed a traceback); a str token
|
|
439
|
+
holding a lone surrogate raised UnicodeEncodeError; a signed payload
|
|
440
|
+
(self-signed by the attacker's did:key) with `creditsAvailable` or
|
|
441
|
+
`creditsEarned` of 400 digits raised OverflowError, and one with a
|
|
442
|
+
`credentialStatus` `statusListIndex` or `statusSize` of `Infinity` (`1e999`)
|
|
443
|
+
raised OverflowError in `check_credential_status`. On Python 3.14 and
|
|
444
|
+
later a header or payload value nested between what the parser takes
|
|
445
|
+
(about 116 000 levels) and what `repr()` takes (about 70 000) turned a
|
|
446
|
+
parsed token into a RecursionError the moment an error message formatted
|
|
447
|
+
it. The header and the payload PyJWT returns are now held to the shared
|
|
448
|
+
bound (_safejson: 128 levels, no lone surrogate, no non-finite number)
|
|
449
|
+
before anything reads them, `issuer_did_from_token` and
|
|
450
|
+
`issuer_did_from_document` likewise, the status list document and the
|
|
451
|
+
did:web document go through the bounded loader, and a number outside the
|
|
452
|
+
range of a float is a malformed credential. `creditsAvailable: Infinity`,
|
|
453
|
+
which used to verify, no longer does.
|
|
454
|
+
|
|
455
|
+
- security(ldp): a hostile Data Integrity document is an OB3VerificationError
|
|
456
|
+
before any signature or context work. A `proof.cryptosuite` that is a JSON
|
|
457
|
+
array or object raised a bare TypeError out of `OB3LdpVerifier.verify`,
|
|
458
|
+
`verify_data_integrity_proof` and `verify_badge`; a lone surrogate in any
|
|
459
|
+
string (the `\ud800` escape of an ASCII document) raised
|
|
460
|
+
UnicodeEncodeError when the document was hashed; `verify_data_integrity_proof`
|
|
461
|
+
(the CLR route) deep-copied a dict nested about 900 levels, raising
|
|
462
|
+
RecursionError; and a document nested 100 000 levels deep (160 KB, within
|
|
463
|
+
the size cap) cost seconds of CPU in the context walk, which rebuilds an
|
|
464
|
+
O(depth) path per node, before any signature was looked at. The document is
|
|
465
|
+
now held to the shared bound (_safejson: 128 levels, no lone surrogate, no
|
|
466
|
+
non-finite number) on parse and at the top of `verify_data_integrity_proof`,
|
|
467
|
+
and only a string cryptosuite is looked up.
|
|
468
|
+
|
|
469
|
+
- fix(cli): `openbadges-verifier --json` prints exactly one strictly valid
|
|
470
|
+
JSON object. A verified credential whose `creditsAvailable` was `1e999` or
|
|
471
|
+
`NaN` made it print `Infinity` or `NaN`, which JSON.parse, jq and serde
|
|
472
|
+
reject. Such a credential no longer verifies (see the ob3 entry above), and
|
|
473
|
+
any other non-finite float the payload ever carries is printed as null. A
|
|
474
|
+
hostile OB1 body, or a JWT whose header PyJWT rejects, now ends in the
|
|
475
|
+
one-object verdict and exit status 1 instead of a traceback.
|
|
476
|
+
|
|
477
|
+
- fix(oid4vci): a lone surrogate in a value the endpoints take from a
|
|
478
|
+
request is an ordinary wrong value, not a 500. A pre-authorized code,
|
|
479
|
+
`tx_code` or access token decoded from JSON (`"\ud800"`) raised
|
|
480
|
+
UnicodeEncodeError out of `handle_token_request` and
|
|
481
|
+
`handle_credential_request`, and a PIN-gated grant skipped its failed-attempt
|
|
482
|
+
counter on that path. They are hashed with `surrogatepass`: the value
|
|
483
|
+
matches nothing, so it is the same `invalid_grant` / `invalid_token` as any
|
|
484
|
+
wrong one, in the same time, and a wrong `tx_code` is counted.
|
|
485
|
+
`build_credential_offer` refuses a recipient that is not valid Unicode with
|
|
486
|
+
IssuanceError before it reserves a status slot (sqlite3 refused the str at
|
|
487
|
+
`save_grant`).
|
|
488
|
+
|
|
489
|
+
- security(util): `download_file` enforces its documented 60-second budget.
|
|
490
|
+
`MAX_DOWNLOAD_SECONDS` was checked only between reads, and a read of 64 KiB
|
|
491
|
+
loops recv until it is satisfied, so a server that sent one byte every few
|
|
492
|
+
seconds of the body, of a response header or of the status line (each recv
|
|
493
|
+
inside the 30-second socket timeout) held the call open for as long as it
|
|
494
|
+
liked, and with it every caller that fetches an attacker-chosen URL: a
|
|
495
|
+
did:web issuer, a credentialStatus list, the OB1/OB2 badge, issuer and
|
|
496
|
+
revocation URLs. Every recv of the response, headers included (the size
|
|
497
|
+
lines of a chunked body too) and across redirects, now spends the one
|
|
498
|
+
budget, and the call raises the ValueError it always documented. Connecting,
|
|
499
|
+
the TLS handshake and DNS resolution are still bounded per operation (30
|
|
500
|
+
seconds), not by the budget. A malformed response, such as a chunked body
|
|
501
|
+
that ends inside a chunk, is still `http.client.IncompleteRead`, an
|
|
502
|
+
HTTPException that is neither a ValueError nor an OSError (as in 4.6.2);
|
|
503
|
+
the docstring now lists what `download_file` raises.
|
|
504
|
+
|
|
505
|
+
- security(deps): the `cryptography` floor rises from 45 to 50.
|
|
506
|
+
`cryptography>=45` named 45.0.0, which is yanked on PyPI, and every
|
|
507
|
+
release before 50.0.0 carries a known advisory (CVE-2026-26007,
|
|
508
|
+
CVE-2026-34073, CVE-2026-39892, CVE-2026-69247, CVE-2026-69248,
|
|
509
|
+
CVE-2026-69249 and, in the OpenSSL bundled in the wheels,
|
|
510
|
+
GHSA-537c-gmf6-5ccf), so an install that lands on the floor (a lockfile
|
|
511
|
+
built with the lowest versions, a constraints file, a pinned image) got a
|
|
512
|
+
package a scanner flags. The weekly scan never saw it: it audits what a
|
|
513
|
+
fresh install resolves, which is the newest release. One advisory is
|
|
514
|
+
reachable from this library: CVE-2026-69249, fixed in 49.0.0, makes path
|
|
515
|
+
building exponential over duplicate self-signed intermediates, and
|
|
516
|
+
`verify_badge_sd_jwt(x5c_trust_anchors=…)` builds the path over the `x5c`
|
|
517
|
+
chain of the untrusted badge before it checks the signature. A 4 KB token
|
|
518
|
+
with six chain entries stalled the call for over 45 s on 45.0.0 and takes
|
|
519
|
+
0.1 s on 50.0.0; there is no integrity impact, and the default
|
|
520
|
+
`pubkey_pem` path never builds a path. The others are not reachable here:
|
|
521
|
+
openvc-core validates with the client verifier and no peer name and binds
|
|
522
|
+
the issuer by exact SAN match, a SECT key parses but every verifier
|
|
523
|
+
refuses it before it operates, and nothing calls the PKCS#7 decryption or
|
|
524
|
+
passes a non-contiguous buffer. 50.0.0 rather than 49.0.0 because it is
|
|
525
|
+
the first release with nothing to report, so the floor itself audits
|
|
526
|
+
clean. Installing with `--only-binary` needs a wheel: 49.0.0 and later
|
|
527
|
+
publish none for macOS x86_64 or 32-bit Windows (an Intel Mac already
|
|
528
|
+
resolved to 50.x and built it with Rust), so those platforms need a Rust
|
|
529
|
+
toolchain or a 64-bit Python. Upgrade with `pip install -U cryptography`.
|
|
530
|
+
|
|
531
|
+
- ci: the weekly Audit workflow has a second job, "pip-audit (declared
|
|
532
|
+
floors)". It installs the exact floor of every runtime dependency of the
|
|
533
|
+
package and of the `ldp`, `eudi`, `ldp-sd` and `oid4vci` extras, read out
|
|
534
|
+
of pyproject.toml, then fails on a yanked floor and on any advisory
|
|
535
|
+
against it. pip-audit runs in its own environment, so the advisories of
|
|
536
|
+
its own dependencies are not counted against the package.
|
|
537
|
+
|
|
538
|
+
- security(ldp): RDF canonicalization of a Data Integrity document is
|
|
539
|
+
bounded in work, in CPU time and in the cost of the JSON-LD to RDF
|
|
540
|
+
conversion before it. RDFC-1.0 resolves blank nodes its first-degree hash
|
|
541
|
+
cannot tell apart by trying their permutations, recursively, and the
|
|
542
|
+
verifier runs it BEFORE it can check the signature, on a document nobody
|
|
543
|
+
has authenticated. The 256 KiB document cap did not bound that and pyld
|
|
544
|
+
3.3.0 has no cap of its own: a credential of 1.2 to 2.2 KB that passes
|
|
545
|
+
context validation (an `evidence` clique of eight labelled blank nodes,
|
|
546
|
+
a tree of eight identical children two deep, two identical parents with
|
|
547
|
+
nine identical children each) cost one verification 15 to 40 seconds of
|
|
548
|
+
CPU (CPython 3.14, a quiet laptop), a ring of 400 labelled nodes (21 KB)
|
|
549
|
+
13 s, and a slightly larger one minutes; the proof options,
|
|
550
|
+
canonicalized too, are attacker input as well. `OB3LdpVerifier`,
|
|
551
|
+
`verify_data_integrity_proof`, `OB3LdpSigner` and
|
|
552
|
+
`add_data_integrity_proof` now canonicalize through
|
|
553
|
+
`ob3/_canon_guard.py`: pyld's own URDNA2015, run with a per-call subclass
|
|
554
|
+
that charges every Hash N-Degree Quads call and every permutation step to
|
|
555
|
+
one budget shared by the document and its proof options, refusing before
|
|
556
|
+
the work when a group of indistinguishable nodes cannot fit. The budget
|
|
557
|
+
is 250,000 model units, about 100 times what a real credential spends
|
|
558
|
+
(at most ~2,400 over 53 real documents; the repo's copy of 1EdTech's
|
|
559
|
+
"Complete OpenBadgeCredential" example spends 1,124) and 1.5 times the
|
|
560
|
+
largest legitimate shape known (an identifier-only subject with 1,400
|
|
561
|
+
identical blank Results). Symmetry on purpose is where it stops: two
|
|
562
|
+
identical blank parents with five identical blank children each pass
|
|
563
|
+
(48,000 units), with six they are refused (297,000), and so is a clique
|
|
564
|
+
of six labelled blank nodes (1.08 million; five pass, 115,000), counted
|
|
565
|
+
on the tests' modelled credential as the root (on 1EdTech's Complete
|
|
566
|
+
example the same shapes cost 41,000, 350,000, 117,000 and 1.08 million: the
|
|
567
|
+
verdicts are the same). The
|
|
568
|
+
budget comes with one CPU-time allowance of 1.0 s inside URDNA2015, read
|
|
569
|
+
from the thread's own CPU clock (a request queued behind another, or a
|
|
570
|
+
loaded host, is not charged for waiting). The clock is the bound that
|
|
571
|
+
holds everywhere: on CPython 3.11 and 3.12 a window of
|
|
572
|
+
document sizes (a circulant graph of 80 to 160 nodes, 8 to 15 KB, moving
|
|
573
|
+
with the caller's stack depth) costs 5 to 10 times more CPU per unit than
|
|
574
|
+
the model says. Each of the shapes above is refused with
|
|
575
|
+
`OB3VerificationError` ("refusing to canonicalize the credential";
|
|
576
|
+
`ErrorSigningFile` on the signing side) after 0.05 to 0.22 s of CPU on
|
|
577
|
+
CPython 3.10 to 3.15, 0.9 s at most inside that window (in our sweeps;
|
|
578
|
+
the allowance caps it at 1.1 s), and 1.04 to 1.11 s on every interpreter
|
|
579
|
+
with the unit budget out of the way. That is a poison graph on its own.
|
|
580
|
+
The allowance covers URDNA2015 only, and a document that also carries a
|
|
581
|
+
flood of the typed nodes of the structure entry below, which costs 1.0 to
|
|
582
|
+
1.4 s of CPU before canonicalization starts, pays both: 1,260 typed nodes
|
|
583
|
+
and a 148-node circulant (102 KB) cost `OB3LdpVerifier.verify` 1.2 to 1.6
|
|
584
|
+
s, and 2.1 to 2.3 s on CPython 3.11 to 3.15 and 2.4 to 2.5 s on 3.10 when
|
|
585
|
+
the unit budget does not trip first (as in the 3.11/3.12 window, where a
|
|
586
|
+
review reached the deadline with it in force and measured 2.24 s). The
|
|
587
|
+
whole suite,
|
|
588
|
+
including the W3C vectors and the Complete example, spends at most 0.5%
|
|
589
|
+
of the budget with byte-identical canonical output. The conversion
|
|
590
|
+
before it has a cost no hook can meter: pyld compares every new value of
|
|
591
|
+
a node property with the ones already there, N^2/2 comparisons for N
|
|
592
|
+
distinct values (8,000 `tag` values, 57 KB, took 12 s), and the same for
|
|
593
|
+
N nodes that all `@reverse` into one node (6,000 spread over 80 parents,
|
|
594
|
+
about 240 KB, took 6 to 11 s). The comparisons are counted on the
|
|
595
|
+
expanded document the way pyld makes them, `@reverse` and repeated values
|
|
596
|
+
included, and a document over 1,000,000 of them, summed over every
|
|
597
|
+
property of every node of the document and its proof options (one
|
|
598
|
+
property of 1,414 distinct values, or two of about 1,000), is refused
|
|
599
|
+
before pyld builds the node map (0.35 to 0.5 s of CPU at the limit). A
|
|
600
|
+
credential issued with 4.6.2 that has more distinct values than that in one
|
|
601
|
+
property (1,500 tags or evidence entries, say; 4.6.2 verified one in 0.6 to
|
|
602
|
+
3.5 s of CPU) therefore no longer verifies: it is refused with "the
|
|
603
|
+
document puts too many values on its node properties", which names the
|
|
604
|
+
property and the node.
|
|
605
|
+
No pyld state is patched, so other users of pyld are unaffected. pyld's
|
|
606
|
+
JSON-LD processor keeps its context caches in plain LRU caches shared by
|
|
607
|
+
the whole process, which are not thread-safe; the path keeps them apart
|
|
608
|
+
per thread (next entry). The guard
|
|
609
|
+
is fitted to pyld 3.3.0 and fails closed if the installed pyld is not the
|
|
610
|
+
one it was calibrated on (another major version, a changed hook, a
|
|
611
|
+
canary document that no longer canonicalizes to the known output, in the
|
|
612
|
+
known work range, with the known permutation steps). That refusal is
|
|
613
|
+
`OB3GuardUnavailable`, a subclass of `OB3VerificationError`, so a
|
|
614
|
+
deployment can alert on "the guard is down" apart from "this credential
|
|
615
|
+
is bad"; its text names the pyld found, what was expected and the
|
|
616
|
+
remedy (pin `pyld==3.3.0`, or upgrade openbadgeslib). pip checks the
|
|
617
|
+
`pyld<4` of `[ldp]` and `[ldp-sd]` only when it resolves, not on a later
|
|
618
|
+
`pip install -U pyld`; past the ceiling this refusal is what protects you.
|
|
619
|
+
pyld 4.0 is unreleased and breaking, and its toRDF drops statements 3.x
|
|
620
|
+
keeps: an IRI containing any of `< > " { } | \ ^` or a backquote, or two
|
|
621
|
+
`#`, as a subject, object, predicate, `@type`, graph name or list member,
|
|
622
|
+
and a literal whose `@language` is not shaped like a BCP 47 tag; and it
|
|
623
|
+
changes the bytes of literals (an `xsd:token` is whitespace-folded, a TAB
|
|
624
|
+
is not escaped). `add_data_integrity_proof` (and so `OB3LdpSigner`) now
|
|
625
|
+
refuses a document over 256 KiB, measured as its compact UTF-8 form,
|
|
626
|
+
before any JSON-LD work, where it used to canonicalize first and
|
|
627
|
+
`OB3LdpSigner` checked the size of its output afterwards. A document
|
|
628
|
+
pyld cannot expand now fails with pyld's message (cut at 300 characters)
|
|
629
|
+
after "could not canonicalize the credential:" instead of "Could not
|
|
630
|
+
convert input to RDF dataset".
|
|
631
|
+
ecdsa-sd-2023 is delegated to openvc-core, which canonicalizes with an
|
|
632
|
+
unbounded pyld of its own: the dataset it will canonicalize is first
|
|
633
|
+
canonicalized here within the same budget (the way openvc-core makes it:
|
|
634
|
+
see the next bullet), which refuses the shapes above before the delegate
|
|
635
|
+
runs, and the number of statements is capped too. Both screen what the
|
|
636
|
+
delegate is handed; neither bounds what it then spends.
|
|
637
|
+
|
|
638
|
+
- security(ldp): the Data Integrity path is thread-safe, and one hostile
|
|
639
|
+
request does not hold the others up. pyld's JSON-LD processor keeps its
|
|
640
|
+
resolved contexts and its inverse contexts in two plain LRU caches shared
|
|
641
|
+
by the whole process, which concurrent calls corrupt, and a corrupted cache
|
|
642
|
+
fails every later verification and signature of the process until it
|
|
643
|
+
restarts: 4.6.2 failed 459 of 480 verifications run by 8 threads on CPython
|
|
644
|
+
3.14 and 182 of 480 on 3.10. One process-wide lock around the pyld calls
|
|
645
|
+
cures that and makes every thread wait for whoever holds it, and a document
|
|
646
|
+
that passes every screen (42 KB of 1,200 typed nodes, say) spends about a
|
|
647
|
+
second of CPU in pyld's linear JSON-LD phase, 98% of it with the lock held:
|
|
648
|
+
a legitimate verification that takes 5 ms alone waited a median 1.1 s
|
|
649
|
+
behind one such request, 4.4 s behind four and 17 s behind sixteen (CPython
|
|
650
|
+
3.14, one verification every 20 ms; a signature waits the same). So the
|
|
651
|
+
caches are kept apart instead. `expand`, `compact` and `to_rdf` of the path
|
|
652
|
+
now run on a resolved-context cache that belongs to the calling thread
|
|
653
|
+
(through the `contextResolver` option pyld takes for internal use) instead
|
|
654
|
+
of pyld's shared one, and a compaction keeps the inverse contexts it
|
|
655
|
+
derives for itself. The canonical output does not change (the caches only
|
|
656
|
+
remember work) and the guard's canary now proves that pyld answers from the
|
|
657
|
+
cache it is handed, failing closed with `OB3GuardUnavailable` if a pyld
|
|
658
|
+
does not (as it now does before context validation, not after). A thread's
|
|
659
|
+
cache is bounded like pyld's (100 contexts; about 1 to 2 MiB once a
|
|
660
|
+
credential has been through, per thread, where pyld's held it once), is
|
|
661
|
+
built by the thread's first call (6.2 ms for a small credential instead of
|
|
662
|
+
4.4) and is dropped by any call that raises, a refusal included, so the
|
|
663
|
+
next call on that thread starts cold. `PYLD_LOCK` is left for what still
|
|
664
|
+
uses pyld's shared caches: pyld writes every inverse context it derives
|
|
665
|
+
into its own process-wide cache, so deriving one takes the lock (about 50
|
|
666
|
+
microseconds; 8 times per legitimate verification, about 1,300 per hostile
|
|
667
|
+
request of the kind above, which holds it for 8% of its second), as do the
|
|
668
|
+
build of the guard and fork(). The openvc-core delegate of ecdsa-sd-2023
|
|
669
|
+
uses pyld's shared caches too, so it is covered only where the library
|
|
670
|
+
holds `PYLD_LOCK` around it, and so is any other call into pyld made in the
|
|
671
|
+
process. With one such hostile request in flight a legitimate verification
|
|
672
|
+
now takes 12 to 14 ms at the median and 21 to 24 ms at p99; with four, 13
|
|
673
|
+
to 29 ms and about 0.5 s; with sixteen, 37 to 47 ms and 0.4 to 0.9 s, the
|
|
674
|
+
slowest single one 1 to 2 s (CPython 3.10, 3.12 and 3.14, best of three
|
|
675
|
+
runs of 12 s; behind the lock, 0.9 to 1.1 s, 3.8 to 5.0 s and 15 to 19 s at
|
|
676
|
+
the median). What is left of the p99 is that lock: a thread that finds it
|
|
677
|
+
taken has to win the GIL back from the CPU-bound ones, up to 60 ms each
|
|
678
|
+
time. With the lock taken out (not safe) the p99 is 95 ms with four hostile
|
|
679
|
+
requests and 0.7 s with sixteen, and 66 and 248 ms when the other threads
|
|
680
|
+
only burn CPU in pure Python. A deployment with a process per request
|
|
681
|
+
(gunicorn sync workers, a process pool) never had the problem. An exception
|
|
682
|
+
out of a pyld call, an interrupt included (a signal handler that raises a
|
|
683
|
+
timeout, KeyboardInterrupt), no longer leaves a half-updated cache behind:
|
|
684
|
+
the thread's cache is dropped, and pyld's shared inverse-context cache,
|
|
685
|
+
which an interrupt can tear (a stale key at the head of the LRU makes every
|
|
686
|
+
later eviction fail, for good: reproduced on CPython 3.10 within a few
|
|
687
|
+
thousand interrupts of a verification) is emptied in place if the exception
|
|
688
|
+
comes out of its derivation, or if a call made without the lock tore it:
|
|
689
|
+
the next derivation here finds the stale key, fails that one verification
|
|
690
|
+
and empties it, where every later call used to fail until the process
|
|
691
|
+
restarted. fork() waits for the lock and releases it on both sides, as
|
|
692
|
+
`logging` does for its own, so a child is not born with a half-written
|
|
693
|
+
cache, and a fork taken inside the lock no longer ends in "cannot release
|
|
694
|
+
un-acquired lock". Not covered: a signal handler that verifies a credential
|
|
695
|
+
on the thread it interrupted (never supported), and CPython 3.14.8, where
|
|
696
|
+
any `with lock:` can leak the lock when an asynchronous exception arrives
|
|
697
|
+
between acquiring it and entering the block (a plain Lock, an RLock and
|
|
698
|
+
acquire/try/finally alike, hundreds of times in 3,000 interrupts; 3.10 to
|
|
699
|
+
3.13 and 3.15 do not): the lock is now held for tens of microseconds a
|
|
700
|
+
derivation instead of a whole verification, which narrows the window, and a
|
|
701
|
+
leaked one stops the next derivation of every other thread until the
|
|
702
|
+
process restarts. The CPU deadline reads `time.thread_time`, which on
|
|
703
|
+
Windows is GetThreadTimes and advances once per scheduler tick (CPython
|
|
704
|
+
reports 15.625 ms; not measured here, there is no Windows host): a span is
|
|
705
|
+
over- or under-charged by up to a tick, a refusal comes a tick or two after
|
|
706
|
+
the allowance, and no real document (1 to 100 ms, in two spans) is refused
|
|
707
|
+
for it; the tests run with a clock quantized that way. A platform without a
|
|
708
|
+
per-thread clock falls back to `process_time`, which counts every thread of
|
|
709
|
+
the process, so there a legitimate canonicalization could be refused under
|
|
710
|
+
load (it fails closed). What the Data Integrity hardening of this release
|
|
711
|
+
costs a legitimate user, against 4.6.2 (CPython 3.14 and 3.10; a loop of
|
|
712
|
+
`verify()` or `add_data_integrity_proof()` with one deep copy per call;
|
|
713
|
+
best of three 6-second runs): verifying a small credential 257 to 205
|
|
714
|
+
operations per second on one thread (-20%; 3.10: -19%) and 270 to 200 on
|
|
715
|
+
eight (-26%), 1EdTech's Complete example 22.9 to 19.3 (-16%), signing with
|
|
716
|
+
`add_data_integrity_proof` 935 to 509 (-46%; 3.10: -45%), about 0.9 ms more
|
|
717
|
+
per signature and 1 ms more per verification (the structure screen, an
|
|
718
|
+
extra expansion to count the duplicate checks, the metered URDNA2015 and,
|
|
719
|
+
for the signer, the context validation of what it signed). The per-thread
|
|
720
|
+
caches cost nothing in steady state: the same as the single lock on one
|
|
721
|
+
thread, 1 to 8% less on eight threads that only do legitimate work, where
|
|
722
|
+
4.6.2 returned errors (57 of about 400 verifications of the Complete
|
|
723
|
+
example over three 6-second runs on CPython 3.10, 11 of about 420 on 3.14).
|
|
724
|
+
|
|
725
|
+
- security(ldp): an ecdsa-sd-2023 credential is screened, counted and
|
|
726
|
+
indexed on the dataset openvc-core's verify canonicalizes, within the
|
|
727
|
+
work budget. `OB3LdpVerifier` checks that the `validFrom`, `validUntil`
|
|
728
|
+
and `credentialStatus` statements of a presentation are mandatory, and to
|
|
729
|
+
index them it canonicalized the document once more, after the signature
|
|
730
|
+
check, with openvc-core's private helpers: an unmetered pyld, on a
|
|
731
|
+
dataset that was not the one openvc-core's verify reads (it turned the
|
|
732
|
+
`urn:bnid:` IRIs of the document into blank nodes; verify does not). A
|
|
733
|
+
crafted credential of a few KB, signed with a key of the attacker's own
|
|
734
|
+
(the default `OB3LdpVerifier()` accepts any did:key issuer), cost tens of
|
|
735
|
+
seconds of CPU and more, and the screen above never saw it. The graph
|
|
736
|
+
that has to be screened and indexed is not the one the JSON expands to,
|
|
737
|
+
though. openvc-core writes the dataset as N-Quads text, parses the text
|
|
738
|
+
back, canonicalizes what the parse made of it, then parses the canonical
|
|
739
|
+
text and writes it again, and pyld's N-Quads escaping and parsing are
|
|
740
|
+
not inverse on a literal that holds a backslash followed by `t`, `n` or
|
|
741
|
+
`r` (it reads back as a backslash and a TAB, a newline or a carriage
|
|
742
|
+
return, which is also what the backslash followed by the real character
|
|
743
|
+
reads as). Two literals the JSON tells apart can be one to openvc-core,
|
|
744
|
+
and the blank nodes that carry them can no longer be told apart: a
|
|
745
|
+
clique of eight blank nodes named by eight spellings of one string (a
|
|
746
|
+
backslash and `t`, or a backslash and a TAB, three times over) is
|
|
747
|
+
harmless to a canonicalizer that reads the JSON and costs openvc-core
|
|
748
|
+
22 to 29 s of CPU for a 2 KB document with no key at all (CPython 3.12
|
|
749
|
+
and 3.14). The statement count, the work budget and the
|
|
750
|
+
mandatory-statement check now replay openvc-core's pipeline step for
|
|
751
|
+
step, the URDNA2015 step under the guard (`ob3._canon_guard.
|
|
752
|
+
canonize_dataset`), and read the document as presented, never
|
|
753
|
+
deskolemized. The lines are computed once, before the delegate runs, and
|
|
754
|
+
read again by the lifecycle check after the signature. A credential
|
|
755
|
+
openvc-core issued, derived and verifies is accepted whatever its
|
|
756
|
+
literals look like (40 of 40, six blank nodes with a `\theta` in each
|
|
757
|
+
evidence name and a credentialStatus without id), and one whose issuer
|
|
758
|
+
left the members of a status entry selective is refused every time. A
|
|
759
|
+
credential openvc-core cannot canonicalize (a Unicode line separator
|
|
760
|
+
U+2028 or U+2029, U+0085, VT, FF, FS, GS or RS in a literal, a `>` in an
|
|
761
|
+
IRI: its N-Quads parser breaks the line there) is refused before the
|
|
762
|
+
delegate, naming that limit, instead of by the delegate's JsonLdError.
|
|
763
|
+
What stays openvc-core's: a backslash followed by `t`, `n` or `r` and
|
|
764
|
+
the same followed by the real character are one string to it and sign as
|
|
765
|
+
one, so a holder can re-spell such a literal of a presentation without
|
|
766
|
+
breaking the signature, and a credential openvc-core issued with one
|
|
767
|
+
does not verify under a canonicalizer that follows RDFC-1.0 (the W3C
|
|
768
|
+
algorithm) to the letter.
|
|
769
|
+
|
|
770
|
+
- security(ldp): the ecdsa-sd-2023 delegate runs under the pyld lock.
|
|
771
|
+
openvc-core's verify calls pyld on its own, outside the lock the rest of
|
|
772
|
+
the Data Integrity path takes, and pyld's context caches are shared by
|
|
773
|
+
the process and are not thread-safe: verified from 16 threads, valid
|
|
774
|
+
credentials were refused at random (1 to 10 of 60 to 100 verifications in
|
|
775
|
+
4 s on CPython 3.10, 3.14 and 3.15), and on 3.12 to 3.14 the caches were
|
|
776
|
+
sometimes left corrupted for good, so that every later verification or
|
|
777
|
+
signature in the process failed, eddsa-rdfc-2022 ones included, until
|
|
778
|
+
a restart. The delegate now takes the same lock as every other pyld call
|
|
779
|
+
of the path. The price is that it holds up the other verifications and
|
|
780
|
+
signatures of the process for as long as it works: a few milliseconds for
|
|
781
|
+
a legitimate credential, at most what the cap below allows for a hostile
|
|
782
|
+
one (the delegate's half of what that credential costs in all: 1.2 s on
|
|
783
|
+
CPython 3.10, 0.6 to 0.8 s on 3.11 to 3.15). A legitimate verification that arrives behind one
|
|
784
|
+
such credential took 0.11 to 0.17 s at the median and 0.8 to 1.5 s at the
|
|
785
|
+
99th percentile (CPython 3.10, 3.12 and 3.14, 60 samples; 0.02 to 0.04 s
|
|
786
|
+
alone), and behind four of them at once 4.1 to 4.9 s and 5.3 to 6.8 s
|
|
787
|
+
(3.10, 3.12 and 3.14, 20 samples): the wait grows with the number of such credentials
|
|
788
|
+
verified at the same moment, so a service that verifies untrusted
|
|
789
|
+
selective-disclosure presentations in threads should do it in a process
|
|
790
|
+
of its own, or keep their number low. Without the lock the same
|
|
791
|
+
legitimate verification is not queued, and fails at random instead.
|
|
792
|
+
|
|
793
|
+
- security(ldp): an ecdsa-sd-2023 credential of more than 1,600 statements
|
|
794
|
+
(`ob3.ldp.MAX_DELEGATED_QUADS`) is refused with `OB3VerificationError`
|
|
795
|
+
before openvc-core sees it, counted on the N-Quads text before anything
|
|
796
|
+
parses it. openvc-core 1.35 to 1.37 parse the dataset back from N-Quads
|
|
797
|
+
text before the signature is checked, which pyld does in time quadratic
|
|
798
|
+
in the number of statements and whatever the graph looks like: a 110 KB
|
|
799
|
+
document of 12,000 statements cost about 14 s of CPU, a 160 KB one 80 s,
|
|
800
|
+
and neither is a poison graph, so the screen above let them through.
|
|
801
|
+
The screen now replays that pipeline, so a credential pays for the parse
|
|
802
|
+
twice (the screen, then the delegate). The worst case is one node with
|
|
803
|
+
several properties of many distinct values; signed with a key of the
|
|
804
|
+
attacker's own and verified by the default `OB3LdpVerifier()`, such a
|
|
805
|
+
credential at the limit (156 KB) costs the whole verification about 2 s
|
|
806
|
+
of CPU on CPython 3.10 (1.97 s interpolated, 2.28 s measured), 1.5 to 1.6
|
|
807
|
+
s on 3.13 and 3.14 and 1.3 to 1.5 s on 3.11, 3.12 and 3.15, half of it the
|
|
808
|
+
screen and half the delegate (openvc-core 1.35.0 and 1.37.0 alike); the
|
|
809
|
+
same count spread over many small nodes costs 1.1 s on 3.10. The
|
|
810
|
+
library's own presentations hold 28 to 273 statements, 1EdTech's
|
|
811
|
+
"Complete" example 322 and a credential with 100 alignments and 100
|
|
812
|
+
pieces of evidence 1,428; what no longer verifies is a credential of
|
|
813
|
+
more than 1,600 statements, roughly more than 110 fully described
|
|
814
|
+
alignments together with as many evidence entries. (A Comprehensive
|
|
815
|
+
Learner Record is not affected: its context is not one the delegate is
|
|
816
|
+
given, so ecdsa-sd-2023 CLRs were never verifiable here.) The limit goes
|
|
817
|
+
when openvc-core canonicalizes the dataset directly or takes a bound.
|
|
818
|
+
|
|
819
|
+
- fix(ldp): the `proofValue` of an ecdsa-sd-2023 proof is checked for its
|
|
820
|
+
shape (a multibase `u` string that starts with the suite's CBOR tag)
|
|
821
|
+
before the document is canonicalized, so a missing or foreign value is
|
|
822
|
+
refused without the screen's cost (a value of that shape that does not
|
|
823
|
+
decode still pays the screen, 0.5 s for a 23 KB document, never more
|
|
824
|
+
than a decodable one does); and a credential whose `proof` is an array
|
|
825
|
+
now verifies for ecdsa-sd-2023 as it already did for eddsa-rdfc-2022 (it
|
|
826
|
+
was refused with "credential has no proof object" by the delegate, which
|
|
827
|
+
was handed the array). Several supported proofs are still refused as
|
|
828
|
+
ambiguous; the other entries of the array (another cryptosuite, an empty
|
|
829
|
+
object, anything that is not an object) are ignored, not verified, for
|
|
830
|
+
both cryptosuites.
|
|
831
|
+
|
|
832
|
+
- security(ldp): the structure of a Data Integrity document is bounded
|
|
833
|
+
before any JSON-LD processing. pyld applies a type-scoped `@context` once
|
|
834
|
+
per entry of every node's `type` array, duplicates included, and once per
|
|
835
|
+
typed node, in expansion and again in compaction (and context validation
|
|
836
|
+
expands and compacts each embedded endorsement again on its own); it
|
|
837
|
+
applies the entries of an `@context` array one by one. The 256 KiB
|
|
838
|
+
document cap bounds the bytes, not that work, and the signature check
|
|
839
|
+
comes after it: 22,500 repeated types over ~300 nodes (258 KB) cost
|
|
840
|
+
`OB3LdpVerifier.verify` 9 to 11 s of CPU, the same inside one embedded
|
|
841
|
+
endorsement 12 to 15 s, and a flood of ~7,000 distinct typed nodes 6 to
|
|
842
|
+
7 s, every one of them ending in "signature mismatch", on a document
|
|
843
|
+
nobody had authenticated. Every release since 3.2.0 pays it (a 229 KB
|
|
844
|
+
document of repeated types took 2.2 s on 4.5.0 and 4.6.0, which only
|
|
845
|
+
canonicalized, and 6.8 s on 4.6.1 and 4.6.2, which also validate the
|
|
846
|
+
contexts; 3.2.0 to 4.4 share the canonicalization path but could not be
|
|
847
|
+
run here), and `verify_data_integrity_proof` and `add_data_integrity_proof`,
|
|
848
|
+
which capped nothing then, also paid ~3 ms for each entry of an `@context`
|
|
849
|
+
array listing one pinned context a thousand times (34 s for 610 KB). The new
|
|
850
|
+
`ob3/_structure_screen.py` makes one iterative pass over the parsed JSON
|
|
851
|
+
(no pyld, no recursion, any nesting) at the top of
|
|
852
|
+
`OB3LdpVerifier.verify`, `verify_data_integrity_proof`,
|
|
853
|
+
`add_data_integrity_proof` and `OB3LdpSigner.sign`, and refuses with
|
|
854
|
+
`OB3VerificationError` ("refusing the credential: ...";
|
|
855
|
+
`ErrorSigningFile` when signing; the message names the limit, never the
|
|
856
|
+
document): a node whose `type` repeats an entry or lists more than 8; a
|
|
857
|
+
document with containers nested more than 36 deep (see the nesting entry
|
|
858
|
+
below); a document with more than 1,600 typed objects, 2,000 type entries
|
|
859
|
+
or 8,000 objects, an embedded endorsement's content counting once more
|
|
860
|
+
for every credential that holds it and a value of a property named like
|
|
861
|
+
any term that has an `@context` of its own counting as one type entry (26
|
|
862
|
+
terms in the pinned contexts, `cnf`, `proofPurpose`, `DataIntegrityProof`,
|
|
863
|
+
`Achievement`, `Profile` among them; the CLR context's three when the
|
|
864
|
+
low-level functions are given it, and those of any `extra_contexts`; pyld
|
|
865
|
+
applies that context to every value, however the arrays are nested: a
|
|
866
|
+
list of 130,000 integers under the key `DataIntegrityProof` cost 6 to 9 s
|
|
867
|
+
of CPU through `verify`, 11 to 16 s inside an endorsement); and, in the
|
|
868
|
+
two low-level functions (context validation bounds it for the verifier),
|
|
869
|
+
an `@context` array of more than 8 entries or 4,096 entries in all. The
|
|
870
|
+
low-level functions run no context validation, a node takes about half
|
|
871
|
+
the passes there, and they take twice the three totals for eddsa-rdfc-2022
|
|
872
|
+
(ecdsa-sd-2023 keeps the verifier's). The limits come from timing the
|
|
873
|
+
most expensive document each one admits through `verify` on CPython 3.10
|
|
874
|
+
to 3.15: 1.25 to 1.55 s of CPU on an Apple M4 Pro (3.10 the slowest, 1.25
|
|
875
|
+
to 1.45 s on 3.11 to 3.15), against 7 to 15 s before, and every hostile
|
|
876
|
+
shape above is refused in tens of milliseconds at most (the screen itself
|
|
877
|
+
takes about a millisecond on a legitimate badge). Real credentials sit
|
|
878
|
+
far below them: the 1EdTech "Complete" example, as the tests model it,
|
|
879
|
+
has 104 typed objects and a badge with 200 alignments, 500 evidence
|
|
880
|
+
entries and 50 results 805. What no longer verifies: a badge with more
|
|
881
|
+
than 1,600 typed objects (a CLR is bounded by its size first: see the
|
|
882
|
+
entry on CLRs below).
|
|
883
|
+
|
|
884
|
+
- security(ldp): `verify_data_integrity_proof` and `add_data_integrity_proof`
|
|
885
|
+
refuse an inline `@context` that uses `@import`. pyld merges an imported
|
|
886
|
+
context into the document the loader returned, and the loader hands out
|
|
887
|
+
the one pinned copy that every call of the process shares, so a document
|
|
888
|
+
handed to either function with {"@import": <a pinned context URL>} in an
|
|
889
|
+
inline context rewrote that bundled context for every later verification
|
|
890
|
+
and signature of the process, in every thread, until it restarted (the
|
|
891
|
+
definition of a term it added or changed was then the attacker's for
|
|
892
|
+
everyone). `OB3LdpVerifier` and `OB3LdpSigner` were not exposed: they
|
|
893
|
+
refuse inline contexts before pyld runs. The two low-level functions
|
|
894
|
+
(the only CLR verification route, and the W3C vectors) did not. The
|
|
895
|
+
structure screen now refuses the key at any depth of an `@context`, in
|
|
896
|
+
the verifier and the signer as well, before any JSON-LD processing.
|
|
897
|
+
|
|
898
|
+
- security(ldp): `verify_data_integrity_proof` bounds the size of the dict
|
|
899
|
+
it is handed, and `add_data_integrity_proof` the size of the document it
|
|
900
|
+
returns. The 256 KiB cap lived in `OB3LdpVerifier`'s parse and in
|
|
901
|
+
`add_data_integrity_proof`; the low-level verify, which is how CLR
|
|
902
|
+
credentials are verified, bounded nothing, so a large dict paid the whole
|
|
903
|
+
Python walk before it was refused (10 million empty objects: 2.1 s of CPU
|
|
904
|
+
and 690 MiB). It now measures the compact UTF-8 form of the dict, as
|
|
905
|
+
`add_data_integrity_proof` does, with `json.dumps` in C before anything
|
|
906
|
+
walks it (0.13 s and 40 MiB for the same dict), and refuses with
|
|
907
|
+
"credential document exceeds the 262144-byte limit". A document
|
|
908
|
+
`OB3LdpVerifier` accepts is never refused here: it measures the document
|
|
909
|
+
as received, spaces and escapes included. `add_data_integrity_proof`
|
|
910
|
+
measured the document without the proof it adds (about 0.4 KB), so one
|
|
911
|
+
within that of the cap was signed and then refused by every verifier: it
|
|
912
|
+
measures the signed document too, and refuses with "N bytes once signed".
|
|
913
|
+
|
|
914
|
+
- security(ldp): a Data Integrity document may nest at most 36 containers
|
|
915
|
+
deep (the JSON bound `_safejson` applies to everything is 128), and the
|
|
916
|
+
limit that remains on CPython 3.11 and 3.12 is documented. On those two
|
|
917
|
+
versions the interpreter allocates its call-stack data in 16 KiB chunks,
|
|
918
|
+
and a tight loop whose calls straddle a chunk boundary pays an allocation
|
|
919
|
+
for each call. pyld's duplicate check for the values of a node property
|
|
920
|
+
(`compare_values`, up to 1,000,000 comparisons, 0.35 s) is such a loop: a
|
|
921
|
+
28 KB document of 34 nested objects around an array of 1,300 distinct
|
|
922
|
+
objects cost `OB3LdpVerifier.verify` and `verify_data_integrity_proof` 5
|
|
923
|
+
to 10 s of CPU (0.3 s at 33 or 35 levels), ending in "signature
|
|
924
|
+
mismatch". Where the boundary falls depends on how deep the caller
|
|
925
|
+
already is (a web framework adds 40 to 100 frames), so whether a
|
|
926
|
+
deployment is exposed depends on its own stack and the document is
|
|
927
|
+
chosen to match it. For the worst shape (objects nested directly) at least
|
|
928
|
+
86 % of the caller depths have a nesting depth at which the loop sits on
|
|
929
|
+
a boundary within the 128 levels, and 22 % within 36 (the deepest document
|
|
930
|
+
the library accepts, 8 embedded endorsements inside a CLR member, is 28
|
|
931
|
+
deep; the 49 1EdTech examples and test documents are 2 to 10). **Known limit**: the cap lowers
|
|
932
|
+
the odds, it does not remove the cliff, and a hit costs about 7
|
|
933
|
+
microseconds per comparison through `verify` (10 through the low-level
|
|
934
|
+
function) against 0.35, up to the 1,000,000 the canonicalization guard
|
|
935
|
+
allows: on 3.11 and 3.12, 5 to 10 s of CPU in the unlucky 22 %. CPython
|
|
936
|
+
3.10 and 3.13 to 3.15 do not have it (no outlier in 3,408
|
|
937
|
+
placements each). Run the workers that verify untrusted credentials under a CPU
|
|
938
|
+
limit (a resource limit or a timeout that kills the worker) where 3.11 or
|
|
939
|
+
3.12 is in use.
|
|
940
|
+
|
|
941
|
+
- fix(ob3): a signed CLR is held to the 256 KiB the verifiers accept, and
|
|
942
|
+
`sign_clr_credential` says how to split one that is over it. Its
|
|
943
|
+
docstring and the wiki quoted "about 280 signed member credentials" and
|
|
944
|
+
a CLR of a thousand achievements plus a thousand associations, counting
|
|
945
|
+
the structural limits only; the size cap binds first on every shape. A
|
|
946
|
+
signed member credential takes 0.93 KB at the least (281 fit in one
|
|
947
|
+
CLR), 1.5 KB with three alignments, a result, evidence and an image
|
|
948
|
+
(176) and 1.7 KB with a result description and an achievement image
|
|
949
|
+
(154); an achievement with an alignment and its association take 0.4 KB
|
|
950
|
+
(about 650), and the thousand-achievement CLR is 400 KB. The structural
|
|
951
|
+
limits come after, at about 500, 285 and 245 members of the three sizes.
|
|
952
|
+
The `ErrorSigningFile` now says what to do: "this CLR holds 300 member
|
|
953
|
+
credentials of about 931 bytes each; sign it as several CLRs of at most
|
|
954
|
+
about 266 member credentials" (or achievements, or associations, for a
|
|
955
|
+
CLR that lists those). **Changed**: 4.6.2 put no cap on a CLR; it signed
|
|
956
|
+
one of 400 minimal members (505 KB) in 0.4 s and
|
|
957
|
+
`verify_data_integrity_proof`, which is how CLRs are verified, took it.
|
|
958
|
+
Both now refuse a CLR over 256 KiB (compact UTF-8), so one that big
|
|
959
|
+
signed by 4.6.2 no longer verifies, and a transcript that embeds more
|
|
960
|
+
members than fit has to be split into several CLRs. The size is not what
|
|
961
|
+
protects the CPU (the structural limits do) but one rule for every Data
|
|
962
|
+
Integrity document, signer and verifier alike. Signing or verifying a
|
|
963
|
+
CLR takes about 1.8 times the CPU of 4.6.2 (0.45 s against 0.25 s for 250
|
|
964
|
+
members), the cost of the checks added in 4.6.3.
|
|
965
|
+
|
|
966
|
+
- docs(compatibility): what 4.6.3 changes for a caller who sends no hostile
|
|
967
|
+
input. Nothing is removed or renamed, and every credential of the test
|
|
968
|
+
suite and of 1EdTech's examples verifies as it did in 4.6.2; what follows
|
|
969
|
+
is what a deployment may notice.
|
|
970
|
+
- Dependencies. `cryptography` must be `>=50` (it was `>=45`): a floor, not
|
|
971
|
+
a pin, but an environment that holds `cryptography<50` (a distribution
|
|
972
|
+
package, a constraints file, a lock file built on the old floor) stops
|
|
973
|
+
resolving until that is lifted, and 49.0.0 and later publish no wheel
|
|
974
|
+
for macOS x86_64 or 32-bit Windows. `pyld>=3.3.0,<4` (the ceiling dates
|
|
975
|
+
from 4.6.2) is a pin in practice, 3.3.0 being the only release in that
|
|
976
|
+
range: the canonicalization guard refuses with `OB3GuardUnavailable` any
|
|
977
|
+
pyld it was not fitted to, and pip checks the range only when it
|
|
978
|
+
resolves.
|
|
979
|
+
- New names. `OB3GuardUnavailable` (a subclass of `OB3VerificationError`,
|
|
980
|
+
exported by `openbadgeslib.ob3`) is the only name this release adds to a
|
|
981
|
+
public `__all__`. `openbadgeslib.ob3.ldp.MAX_DELEGATED_QUADS` is a module
|
|
982
|
+
constant outside any `__all__`; the guard, the structure screen, the JSON
|
|
983
|
+
bound and the lock around pyld live in underscore modules.
|
|
984
|
+
- Refused now, accepted before. A number that is not finite or not a float
|
|
985
|
+
(`Infinity`, `NaN`, `1e999`: an OB1 `expires`, `creditsAvailable`, a
|
|
986
|
+
status entry), a lone surrogate, and JSON nested more than 128 levels in
|
|
987
|
+
a token, a baked assertion or a document a host serves. In a Data
|
|
988
|
+
Integrity document, for both cryptosuites: more than 1,600 typed
|
|
989
|
+
objects, 2,000 type entries or 8,000 objects (twice that through the
|
|
990
|
+
low-level functions, which a CLR uses), a node with more than 8 types
|
|
991
|
+
or a repeated one, more than 1,414 distinct
|
|
992
|
+
values in one property (about 1,000 in each of two), an `@context` of
|
|
993
|
+
more than 8 entries in the low-level functions, a canonicalization
|
|
994
|
+
beyond its work or time budget, and an ecdsa-sd-2023 credential of more
|
|
995
|
+
than 1,600 statements. A real badge is far inside all of them (1EdTech's
|
|
996
|
+
"Complete" example has 104 typed objects and spends 1,124 of the 250,000
|
|
997
|
+
units), but a badge with 1,500 alignments verified in 4.6.2 and does not
|
|
998
|
+
now.
|
|
999
|
+
- Signing. `add_data_integrity_proof`, `OB3LdpSigner` and
|
|
1000
|
+
`sign_clr_credential` refuse a document over 256 KiB (compact UTF-8)
|
|
1001
|
+
before any JSON-LD work, so a CLR that 4.6.2 signed may not be signed
|
|
1002
|
+
again: of member credentials of 1.34 KB (three alignments and an
|
|
1003
|
+
evidence entry) 194 fit, and 4.6.2 signed 400 (538 KB). Verifying one
|
|
1004
|
+
that 4.6.2 signed is unchanged up to the structure limits above.
|
|
1005
|
+
- Accepted now, refused before. A credential whose `proof` is an array of
|
|
1006
|
+
one entry verifies for ecdsa-sd-2023, as it did for eddsa-rdfc-2022.
|
|
1007
|
+
A timestamp with no UTC `datetime` (`9999-12-31T23:59:59-05:00`) is
|
|
1008
|
+
accepted, as in 4.6.2, and now also serialised (with its own offset).
|
|
1009
|
+
- Messages and types. A document pyld cannot expand fails with "could not
|
|
1010
|
+
canonicalize the credential: ..." (it was "Could not convert input to
|
|
1011
|
+
RDF dataset"). A hostile token, body or document that ended in a bare
|
|
1012
|
+
`RecursionError`, `OverflowError`, `TypeError` or `UnicodeEncodeError`
|
|
1013
|
+
is now the typed failure of the verifier it reached
|
|
1014
|
+
(`OB3VerificationError`, `OB2VerificationError`, `ErrorSigningFile`,
|
|
1015
|
+
`AssertionFormatIncorrect`), and OB1's `get_badge_status` returns its
|
|
1016
|
+
VerifyInfo where it raised: code that matches on the old text, or
|
|
1017
|
+
catches the bare exceptions, should use those.
|
|
1018
|
+
- Cost. Signing and verifying an eddsa-rdfc-2022 document takes more CPU
|
|
1019
|
+
(these figures are for that suite; the ecdsa-sd-2023 entries above give
|
|
1020
|
+
theirs): CPython 3.14, minimum of 5 runs against 4.6.2, a badge with 200
|
|
1021
|
+
alignments 0.083 to 0.100 s to verify and one with 1,000 alignments
|
|
1022
|
+
0.51 to 0.60 s (about 1.2 times), a CLR of 100 member credentials
|
|
1023
|
+
(135 KB) 0.15 to 0.26 s and of 150 (202 KB) 0.23 to 0.40 s (about 1.8
|
|
1024
|
+
times), either way to sign or to verify. The pyld calls of the Data
|
|
1025
|
+
Integrity path share one process-wide lock, so verifications on the
|
|
1026
|
+
threads of one process no longer overlap inside pyld; use processes to
|
|
1027
|
+
scale.
|
|
1028
|
+
|
|
7
1029
|
* v4.6.2 - 2026-10-16
|
|
8
1030
|
|
|
9
1031
|
- security(deps): the openvc-core floor of `[eudi]`, `[ldp-sd]` and
|