Title: fix(capture-core): reject duplicate JSON keys and non-finite numbers in load_state/sha_mapping and check seal.alg in check_seal · Issue #366 · agentrust-io/integrations · GitHub
Open Graph Title: fix(capture-core): reject duplicate JSON keys and non-finite numbers in load_state/sha_mapping and check seal.alg in check_seal · Issue #366 · agentrust-io/integrations
X Title: fix(capture-core): reject duplicate JSON keys and non-finite numbers in load_state/sha_mapping and check seal.alg in check_seal · Issue #366 · agentrust-io/integrations
Description: Summary Three state-integrity boundary gaps exist in packages/agentrust-capture-core/src/agentrust_capture_core/: Duplicate JSON keys and non-finite constants accepted in load_state (packages/agentrust-capture-core/src/agentrust_capture_...
Open Graph Description: Summary Three state-integrity boundary gaps exist in packages/agentrust-capture-core/src/agentrust_capture_core/: Duplicate JSON keys and non-finite constants accepted in load_state (packages/agent...
X Description: Summary Three state-integrity boundary gaps exist in packages/agentrust-capture-core/src/agentrust_capture_core/: Duplicate JSON keys and non-finite constants accepted in load_state (packages/agent...
Opengraph URL: https://github.com/agentrust-io/integrations/issues/366
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fix(capture-core): reject duplicate JSON keys and non-finite numbers in load_state/sha_mapping and check seal.alg in check_seal","articleBody":"### Summary\n\nThree state-integrity boundary gaps exist in `packages/agentrust-capture-core/src/agentrust_capture_core/`:\n\n1. **Duplicate JSON keys and non-finite constants accepted in `load_state` (`packages/agentrust-capture-core/src/agentrust_capture_core/state.py` lines 65-80):**\n - `load_state(path)` calls bare `json.loads(path.read_text(encoding=\"utf-8\"))` without `object_pairs_hook` or `parse_constant`, accepting state/baseline files with duplicate JSON keys or `NaN`/`Infinity` constants instead of returning `None` (corrupt state).\n\n2. **`allow_nan=True` default in `sha_mapping` (`packages/agentrust-capture-core/src/agentrust_capture_core/hashing.py` lines 76-80):**\n - `sha_mapping(value)` calls `json.dumps(value, sort_keys=True, separators=(\",\", \":\"))` without `allow_nan=False`, allowing `NaN` and `Infinity` to serialize into non-standard JSON before hashing.\n\n3. **Unchecked `seal[\"alg\"]` in `check_seal` (`packages/agentrust-capture-core/src/agentrust_capture_core/seal.py` lines 61-71):**\n - `attach_seal` writes `{\"alg\": \"SHA-256\", \"digest\": state_digest(snapshot), \"sealed_at\": ...}`, but `check_seal` only checks `isinstance(seal.get(\"digest\"), str)` and `seal[\"digest\"] == state_digest(snapshot)`, returning `INTEGRITY_OK` even when `seal.get(\"alg\") != \"SHA-256\"`.\n\n### Proposed Fix\n\n- Reject duplicate JSON keys and `NaN`/`Infinity` constants in `load_state` (returning `None`).\n- Pass `allow_nan=False` to `json.dumps` in `sha_mapping`.\n- Check `seal.get(\"alg\") == \"SHA-256\"` in `check_seal`, returning `INTEGRITY_BROKEN` when `\"alg\"` is present and not `\"SHA-256\"`.","author":{"url":"https://github.com/drk-ram","@type":"Person","name":"drk-ram"},"datePublished":"2026-10-23T23:03:00Z","url":"https://github.com/agentrust-io/integrations/issues/366"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a6b2bf3a-78cc-317f-7b9b-76ee74061be3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A452:197342:3ED626:568E78:6AF82164 |
| html-safe-nonce | 8fbfce0977f2ca054937c8cce142d2ec2c5c2181e9e48e9bee3c2d26d86afa79 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDUyOjE5NzM0MjozRUQ2MjY6NTY4RTc4OjZBRjgyMTY0IiwidmlzaXRvcl9pZCI6IjUxODIxMTE1NjE3OTA1Mjk4OTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 45d80d16bcc11c60831fe4d58cc63747600cbc6b8f8e8200aedce8bf0a76aa7b |
| hovercard-subject-tag | issue:6006716320 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/agentrust-io/integrations/366/issue_layout |
| twitter:image | https://opengraph.githubassets.com/29df0cc33fe1a583a76ec0af67ea2f776bd4fab105488318d0853ca2245925b6/agentrust-io/integrations/issues/366 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/29df0cc33fe1a583a76ec0af67ea2f776bd4fab105488318d0853ca2245925b6/agentrust-io/integrations/issues/366 |
| og:image:alt | Summary Three state-integrity boundary gaps exist in packages/agentrust-capture-core/src/agentrust_capture_core/: Duplicate JSON keys and non-finite constants accepted in load_state (packages/agent... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | drk-ram |
| hostname | github.com |
| expected-hostname | github.com |
| None | 546a7c1ea6fe4760d7adf768b8f50bc606bf78c616479f24d962875fc3eab103 |
| turbo-cache-control | no-preview |
| go-import | github.com/agentrust-io/integrations git https://github.com/agentrust-io/integrations.git |
| octolytics-dimension-user_id | 290505154 |
| octolytics-dimension-user_login | agentrust-io |
| octolytics-dimension-repository_id | 1267583801 |
| octolytics-dimension-repository_nwo | agentrust-io/integrations |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1267583801 |
| octolytics-dimension-repository_network_root_nwo | agentrust-io/integrations |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1903e4626205229231bf94a4d9dd3be1b2795df9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width