Skip to content

fix(adapters): enforce safe-integer duration bounds and digest validation in Python AGT adapters (#106) - #109

Open
drk-ram wants to merge 2 commits into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-agt-adapters-106
Open

drk-ram wants to merge 2 commits into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-agt-adapters-106

Conversation

@drk-ram

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

Copy link
Copy Markdown

Summary

  • Validate evaluation_duration_ns, duration_ns, and _audit_duration against bool and 0 <= value <= 9007199254740991 (2**53 - 1) in src/agentrust_telemetry/adapters/agt_approval.py and src/agentrust_telemetry/adapters/agt_audit.py.
  • Validate bundle_digest and action_digest against sha256 (64 lowercase hex) / sha384 (96 lowercase hex) in agt_policy_decision_record, agt_audit_policy_decision, and agt_audit_action.

Closes #106

Validation

  • python -m pytest tests/test_agt_approval.py tests/test_agt_audit.py -q
  • python -m ruff check src/agentrust_telemetry/adapters/agt_approval.py src/agentrust_telemetry/adapters/agt_audit.py tests/test_agt_approval.py

…tion in Python AGT adapters (agentrust-io#106)

- Validate evaluation_duration_ns, duration_ns, and _audit_duration against bool and 0 <= value <= 2**53 - 1 in Python agt_approval.py and agt_audit.py.
- Validate bundle_digest and action_digest against sha256/sha384 lowercase hex in agt_policy_decision_record, agt_audit_policy_decision, and agt_audit_action.

Closes agentrust-io#106

Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@drk-ram
drk-ram requested review from a team and imran-siddique as code owners October 23, 2026 22:59
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

🟡 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 23, 2026

@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.

Reviewed source at 029238b. Python unittest discovery passed with inherited OTEL_* variables removed; the initial three OTel failures were environment configuration. TypeScript build and all 44 existing tests passed using node --import tsx --test test/*.test.ts; the npm check launcher itself encountered an IPC-listen EPERM here, so I do not claim that wrapper passed. Local results only, not hosted CI. Python: 159 tests pass.

The new combined test exercises the approval adapter, while this PR also changes agt_audit. Please add independent agt_audit duration/digest regressions, including a valid SHA-384 digest and valid boundary durations, and show each added refusal fails when only that guard is disabled. A passing aggregate suite does not establish coverage of every new predicate.

Source review and local validation are complete within this scope; regression coverage remains for author follow-up before approval.

Prepared with OpenAI Codex.

… regressions

Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@drk-ram

drk-ram commented Oct 24, 2026

Copy link
Copy Markdown
Author

Thanks @dinakarjs! Added independent agt_audit_policy_decision and agt_audit_action duration and digest regressions in tests/test_agt_audit.py (test_audit_policy_decision_validates_duration_and_bundle_digest and test_audit_action_validates_duration_bounds_and_action_digest) alongside valid boundary durations (0 and 2**53 - 1) and valid sha384 digests in both tests/test_agt_approval.py and tests/test_agt_audit.py.

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

Development

Successfully merging this pull request may close these issues.

fix(adapters): enforce safe-integer duration bounds and digest validation in Python and TypeScript AGT adapters

2 participants