Skip to content

fix(aggregator,checkpoint): validate aggregator parameters/raw_bytes and enforce anchor profile in entry_leaf_digest (#161) - #166

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-aggregator-checkpoint-161
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-aggregator-checkpoint-161

Conversation

@drk-ram

@drk-ram drk-ram commented Oct 25, 2026 •

Copy link
Copy Markdown

What and why

Closes #161

Summary

  • Validate flush_interval (positive finite number) and max_batch_size (non-negative int, not bool) in TRACEAggregator.__init__.
  • Validate claims (list), timeout (positive finite number), and raw_bytes (bytes elements that UTF-8 decode via loads_unique to the submitted claim object) in TRACEAggregator.submit.
  • Validate anchor_profile_violation(body) in trace_verify._checkpoint.entry_leaf_digest and catch ValueError in verify_chain_against_entries so malformed entry bodies produce a structured verification error.
  • Add subTest-isolated unit tests in tests/test_aggregator.py.

Validation

  • python -m unittest discover -s tests -q — passed (full unittest discovery: 407 tests, including test_distinct_raw_bytes_same_parsed_claim_get_distinct_proof_files)
  • pytest tests/test_aggregator.py -q — passed (38 passed, including test_distinct_raw_bytes_same_parsed_claim_get_distinct_proof_files)
  • python tools/validate_registry.py — passed (OK: 3 day file(s) valid)
  • python tools/validate_producers.py — passed (OK: 3 producer key file(s) valid)

Registry impact

  • This PR does not modify any existing line under registry/

Existing entries are append-only. If you are changing one, say why here: mirrors
and auditors may already have observed the current commit hashes, and a rewrite
diverges them.

Checks

  • pytest passes
  • Registry and producer files still validate (tools/validate_registry.py,
    tools/validate_producers.py)
  • If the anchor format or verification semantics changed, docs/anchor-format.md
    is updated in the same PR, and existing inclusion proofs still verify
  • Commits are signed off (DCO)

…and enforce anchor profile in entry_leaf_digest (agentrust-io#161)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram
drk-ram requested review from a team, lywinged and rajnisht7 as code owners October 25, 2026 05:46

@dinakarjs dinakarjs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bounded source/execution review at exact head f1c25a6. I fetched the actual aggregator and verifier modules plus tests/test_aggregator.py at this SHA and ran unittest discovery for that file with source imports pinned to those local paths, Python 3.12.

38 tests ran: 35 passed and three signature-fixture setup cases errored because this review environment lacks rfc8785. Those three errors are environment limitations, not demonstrated defects in this PR. In particular, test_distinct_raw_bytes_same_parsed_claim_get_distinct_proof_files passed here: the two valid JSON encodings remain distinct proof files, so please include that existing regression in the reported validation rather than excluding it without explanation. The new aggregator/input/profile test also passed. Existing loopback tests emitted socket ResourceWarnings; no TLS or live witness call was exercised.

No new blocker established in the tested batching/raw-byte/profile slice. I have not completed the complete locked-environment/signature/checkpoint validation and am not substituting these 35 passes for it. Retain exact-byte commitment versus parsed-claim equality as separate contracts. Reviewed with OpenAI Codex.

@dinakarjs dinakarjs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completing review of exact head f1c25a6 in a fresh Linux/Python 3.12.14 environment installed from requirements/ci.txt and requirements/witness.txt with hashes, plus a no-deps editable local installation. Full unittest discovery passes all 407 tests, including the previously unavailable signed controls and exact-byte distinct-proof regression. Repository Ruff passes. No blocking finding in the changed aggregator/raw-byte/entry-profile paths; approving this scoped change. Please include the existing exact-byte regression in reported validation rather than leaving the exclusion unexplained. Hosted checks and maintainer disposition remain separate. No live external witness or hardware validation. Reviewed with OpenAI Codex.

@drk-ram

drk-ram commented Oct 29, 2026

Copy link
Copy Markdown
Author

Thanks @dinakarjs for the review and verification! Updated the PR description's validation section to explicitly record that full unittest discovery (407 tests), including test_distinct_raw_bytes_same_parsed_claim_get_distinct_proof_files, passes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(aggregator,_checkpoint): validate TRACEAggregator inputs and enforce anchor_profile_violation in entry_leaf_digest

2 participants