Skip to content

fix(telemetry): close tuple privacy bypass, reject array AgenTrust headers in TS propagation, and validate digests in TRACE finalization - #102

Merged
rajnisht7 merged 2 commits into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-telemetry-privacy-propagation-digest
Nov 18, 2026
Merged

rajnisht7 merged 2 commits into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-telemetry-privacy-propagation-digest

Conversation

@drk-ram

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

Copy link
Copy Markdown
Contributor

Summary

Closes #101

  • Walk (list, tuple) in _prohibited_paths, prohibited_paths, and _json_shape_error in src/agentrust_telemetry/validation.py and conformance/runner/validate.py, and reject duplicate JSON object keys via object_pairs_hook when loading JSON files.
  • Reject array-valued and non-string AgenTrust carrier headers (x-agentrust-run-id, x-agentrust-workflow-id, x-agentrust-agent-id) with PropagationError in packages/typescript/src/propagation.ts, and check !== undefined instead of truthiness in ExtractedContext.eventFields, matching Python extract_context.
  • Validate build_digest / buildDigest and policy bundle_digest (algorithm and value) against canonical lowercase ^sha(256:[0-9a-f]{64}|384:[0-9a-f]{96})$ syntax in both src/agentrust_telemetry/trace_adapter.py and packages/typescript/src/trace-finalizer.ts before signing, including trailing-newline (sha256:...\n) rejection tests in both SDK suites.

Contract impact

  • No wire-contract change
  • Backward-compatible contract change with fixtures
  • Breaking contract change with migration notes

Evidence

  • python tools/sync_schemas.py (passed)
  • python tools/check_schemas.py (passed: 8 bundled schemas match normative bytes)
  • python conformance/runner/validate.py (passed: all 18 conformance and appraisal fixtures pass)
  • python -m unittest discover -s tests -v (passed: 165 tests, 163 passed, 2 Ubuntu-only workflow tests skipped on Windows)
  • node --import tsx --test packages/typescript/test/*.test.ts and npm --prefix packages/typescript run build (passed: 46 TypeScript tests passed and tsc build succeeded)
  • python -m build (not run locally)

Privacy and security

  • No real prompts, source, credentials, personal data, or production identifiers added
  • New fields have capture semantics and privacy classification
  • Security-sensitive changes received maintainer review

Limits

Validates digest syntax and JSON/container shapes in Python and TypeScript SDKs; does not alter the JSON Schema wire contract or cryptographic verification semantics in agentrust-trace.

@drk-ram
drk-ram requested review from a team and imran-siddique as code owners October 23, 2026 01:35
@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 exact head 4f42131 (full commit attached). Checked tuple traversal for privacy/JSON-shape checks, duplicate-member schema/fixture parsing, digest validation and TypeScript propagation/header refusal. With hash-locked Python test dependencies, all 165 unittest cases and conformance validation passed. TypeScript build passed and all 46 tests passed using node --import tsx --test test/*.test.ts (the tsx CLI IPC socket is unavailable here). The first Python run inherited a host 1% OTel sampler; clearing OTEL_TRACES_SAMPLER/ARG resolved the three sampling-dependent failures, which also reproduced on main. Hosted CI/CodeQL/fuzz are still action_required, so this is a source/local-test approval and does not claim hosted validation.

@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 things needs to be addressed:

  • Digest tests - Python suite tests trailing newline (sha256:…\n). TS regex rejects it too, but the new test matrix doesn’t cover it, add the same case for both buildDigest and policy bundle_digest.
  • extractContext wording -The changelog/PR says “carrier headers”, but the code only validates the three AgenTrust headers (run-id, workflow-id, agent-id). OTel headers (traceparent etc.) are still passed through, matching Python, kindly narrow the wording to “AgenTrust carrier headers” so the claim matches the implementation.

@drk-ram drk-ram changed the title fix(telemetry): close tuple privacy bypass, reject array headers in TS propagation, and validate digests in TRACE finalization fix(telemetry): close tuple privacy bypass, reject array AgenTrust headers in TS propagation, and validate digests in TRACE finalization Oct 25, 2026
@drk-ram

drk-ram commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @rajnisht7! Added trailing-newline (sha256:...\n) regression cases for both buildDigest and policy.bundle_digest in packages/typescript/test/trace-finalizer.test.ts, and narrowed the PR title and description wording to "AgenTrust carrier headers".

@drk-ram
drk-ram force-pushed the drk-ram-fix-telemetry-privacy-propagation-digest branch from 7472836 to 92ee54c Compare October 29, 2026 15:55
@drk-ram

drk-ram commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @rajnisht7! Updated in 92ee54c:

  • Added trailing-newline (sha256:...\n) regression cases for both buildDigest and policy.bundle_digest in packages/typescript/test/trace-finalizer.test.ts (and tests/test_trace_adapter_refusals.py).
  • Narrowed the wording in CHANGELOG.md, the PR description, and the commit message to "AgenTrust carrier headers".

…aders in TS propagation, and validate digests in TRACE finalization

- Walk (list, tuple) in _prohibited_paths, prohibited_paths, and _json_shape_error in src/agentrust_telemetry/validation.py and conformance/runner/validate.py, and reject duplicate JSON object keys via object_pairs_hook when loading JSON files.
- Reject array-valued and non-string AgenTrust carrier headers with PropagationError in packages/typescript/src/propagation.ts, and check !== undefined instead of truthiness in ExtractedContext.eventFields, matching Python extract_context.
- Validate build_digest / buildDigest and policy bundle_digest (algorithm and value) against canonical lowercase sha256/sha384 hex digest syntax in both src/agentrust_telemetry/trace_adapter.py and packages/typescript/src/trace-finalizer.ts before signing, including trailing-newline rejection tests in both SDK suites.

Closes agentrust-io#101

Signed-off-by: Raghuvar Karthik Durga <[email protected]>
@drk-ram
drk-ram force-pushed the drk-ram-fix-telemetry-privacy-propagation-digest branch from 92ee54c to 7c5e448 Compare November 12, 2026 17:04
@drk-ram

drk-ram commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto origin/main (db085d2) in 7c5e448. The only conflict was CHANGELOG.md; both the existing Unreleased delivery-fault note and the #101 fixes are kept. python -m pytest tests: 172 passed, 2 skipped, 174 subtests passed. gh pr view 102 --json mergeable now reports MERGEABLE.

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

Approving at 7c5e448: ran conformance, the Python suite and the TS check on this head; each new test fails against main's source; all 11 PRs in this series merge onto main together without conflicts and pass combined.

@rajnisht7
rajnisht7 merged commit f66a847 into agentrust-io:main Nov 18, 2026
9 checks passed
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(telemetry): close tuple privacy bypass, reject array headers in TS propagation, and validate digests in TRACE finalization

4 participants