Repository navigation
fix(telemetry): close tuple privacy bypass, reject array AgenTrust headers in TS propagation, and validate digests in TRACE finalization - #102
Conversation
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
dinakarjs
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
|
Thanks @rajnisht7! Added trailing-newline ( |
…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 <177662415+drk-ram@users.noreply.github.com>
7472836 to
92ee54c
Compare
|
Thanks @rajnisht7! Updated in
|
Summary
Closes #101
(list, tuple)in_prohibited_paths,prohibited_paths, and_json_shape_errorinsrc/agentrust_telemetry/validation.pyandconformance/runner/validate.py, and reject duplicate JSON object keys viaobject_pairs_hookwhen loading JSON files.x-agentrust-run-id,x-agentrust-workflow-id,x-agentrust-agent-id) withPropagationErrorinpackages/typescript/src/propagation.ts, and check!== undefinedinstead of truthiness inExtractedContext.eventFields, matching Pythonextract_context.build_digest/buildDigestand policybundle_digest(algorithmandvalue) against canonical lowercase^sha(256:[0-9a-f]{64}|384:[0-9a-f]{96})$syntax in bothsrc/agentrust_telemetry/trace_adapter.pyandpackages/typescript/src/trace-finalizer.tsbefore signing, including trailing-newline (sha256:...\n) rejection tests in both SDK suites.Contract impact
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.tsandnpm --prefix packages/typescript run build(passed: 46 TypeScript tests passed andtscbuild succeeded)python -m build(not run locally)Privacy and security
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.