Skip to content

fix(trace-adapters): validate timestamps/counts, require bool signature_verified, and reject private JWKs in build_record (#375) - #380

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-trace-adapters-375
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-trace-adapters-375

Conversation

@drk-ram

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

Copy link
Copy Markdown
Contributor

Closes #375

Summary

  • Require signature_verified is True, non-empty str verifier / policy_ref, and positive RFC 8785 safe int timestamp in AppraisalEvidence.__post_init__.
  • Require exact int ingested_at in SourceSystem.__post_init__.
  • Validate iat (positive RFC 8785 safe int), tool_call_count (non-negative RFC 8785 safe int), and reject private/symmetric JWK parameters ("d", "p", "q", "dp", "dq", "qi", "oth", "k") in build_record.
  • Add unit tests in packages/agentrust-trace-adapters/tests/test_appraisal.py.

Validation

  • pytest packages/agentrust-trace-adapters/tests/test_appraisal.py packages/agentrust-trace-adapters/tests/test_builder.py -q — passed (34 passed)

@drk-ram
drk-ram requested review from a team, carloshvp and imran-siddique as code owners October 25, 2026 06:59
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Contributor Check: MEDIUM

Check Result
Profile MEDIUM
Credential LOW
Overall MEDIUM

Automated check by AgenTrust Contributor Check.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor check flagged MEDIUM risk label Oct 25, 2026
carloshvp
carloshvp previously approved these changes Oct 25, 2026

@carloshvp carloshvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed exact head ce90b47c25a0ab4ce60470557d4d59f941f91f9c in an isolated checkout.

The evidence/record builders now require literal boolean signature_verified, bounded integer timestamps/counts, public-only JWK inputs and integer ingestion times. The focused control passes here and fails with the baseline modules restored, including the package's public exports. All 128 adapter tests, pip check, the repository CI Ruff subset and diff whitespace checks passed in a fresh hash-locked adapter environment. This validates input/evidence handling, without independently certifying a source system's appraisal or provenance. No blocking finding in the changed paths; hosted checks and maintainer policy remain separate.

Reviewed with OpenAI Codex.

@rajnisht7 rajnisht7 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the overall changes looks good, a few points needs to be addressed:

iat validation still accepts values below the TRACE schema floor.
Current check:

0 < iat <= 9_007_199_254_740_991

but TRACE v0.2 schema + TrustRecord require:minimum: 1700000000
so build_record(..., iat=1) and iat=1699999999 succeed here but produce schema-invalid records. Same package already enforces 1_700_000_000 for ingested_at
align:

1_700_000_000 <= iat <= _MAX_SAFE_INT

and add tests for the exact bounds (1699999999 reject, 1700000000 accept)

non-blocking: new tests use verifier="v" / policy_ref="p". schema marks both as format: uri not a regression vs current model behaviour, but an integration assert (appraisal_from_evidence -> drop into record -> TrustRecord.model_validate) will be good.

…re_verified, and reject private JWKs in build_record (agentrust-io#375)

- Require literal bool signature_verified and bounded integer timestamp in
  AppraisalEvidence, and exact int ingested_at in SourceSystem.
- Enforce TRACE v0.2 schema floor 1_700_000_000 <= iat <= _MAX_SAFE_INT,
  bounded integer tool_call_count, and public-only JWK without private key
  parameters in build_record.

Closes agentrust-io#375

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram

drk-ram commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

@rajnisht7 @carloshvp Rebased onto origin/main and updated at HEAD:

  1. Align iat floor with TRACE v0.2 schema (packages/agentrust-trace-adapters/src/agentrust_trace_adapters/builder.py): Tightened iat validation in build_record to 1_700_000_000 <= iat <= _MAX_SAFE_INT (_MIN_TRACE_IAT = 1_700_000_000), matching the TRACE v0.2 schema (minimum: 1700000000) and SourceSystem.ingested_at.
  2. Exact boundary and TrustRecord.model_validate integration tests (packages/agentrust-trace-adapters/tests/test_appraisal.py): Added exact boundary checks (1_699_999_999 rejected, 1_700_000_000 accepted, 9_007_199_254_740_991 accepted, 9_007_199_254_740_992 rejected), updated verifier and policy_ref to valid URIs (https://verifier.example/v1, https://policy.example/v1), and added test_appraisal_from_evidence_integrates_into_trust_record verifying TrustRecord.model_validate(record) over the assembled record (129 passed).

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

needs-review:MEDIUM Contributor check flagged MEDIUM risk

Projects

None yet

3 participants