docs: Tutorial 46 — selective-disclosure receipts (extends Tutorial 33)#1489
docs: Tutorial 46 — selective-disclosure receipts (extends Tutorial 33)#1489tomjwxf wants to merge 1 commit into
Conversation
…disclosure receipts)
Adds Tutorial 46 (Selective-Disclosure Receipts) with a companion worked
example. Extends Tutorial 33's offline-verifiable receipt construction
with per-field Merkle commitments per RFC 6962, so an issuer can reveal
specific fields to specific auditors and prove the rest are unchanged
without exposing them.
Construction
============
Each receipt field is committed as a leaf via
SHA-256(0x00 || JCS({name, salt, value})) with a fresh 16-byte salt per
field. Leaves are arranged into an RFC 6962-style Merkle tree (node prefix
0x01, non-power-of-two leaf handling matches the CT spec). The receipt
envelope carries a single committed_fields_root field, signed Ed25519
over the JCS-canonical bytes alongside the public fields.
A disclosure is a separate JSON artifact carrying (name, value, salt,
proof, index, leaf_count) tuples for the fields the issuer chose to
reveal to a specific auditor. The verifier walks each Merkle proof to
recompute the root, then verifies the envelope signature against the
public key. No issuer cooperation needed.
Files
=====
- docs/tutorials/46-selective-disclosure-receipts.md (33,454 bytes)
Full tutorial covering the construction, generating disclosures,
verifying offline, composing with Tutorial 33's chain, the
Article 12 + GDPR composition use case, cross-implementation interop,
and a CI/CD workflow for gating merges on disclosure verification.
- examples/selective-disclosure-governed/getting_started.py (~13K)
Single-file Python reference with end-to-end round-trip self-test.
Mints a 7-field receipt, issues three disclosure profiles (Article 12,
GDPR, counterparty), verifies each, then exercises tamper detection
for both field-level and envelope-level modifications, plus a chained
receipt composing parent_receipt_hash with selective disclosure.
All 7 assertions pass; exits 0 on success.
- examples/selective-disclosure-governed/README.md (~10K)
Quick start, scenario table, architecture diagram, disclosure profile
examples, cross-implementation verification notes, standards
references.
Tutorial number selection
=========================
34 is currently 34-maf-integration.md. The next available sequential
slot is 46 (after the recent batch through 45-shift-left-governance.md).
Standards
=========
- Ed25519 (RFC 8032), JCS (RFC 8785), SHA-256
- RFC 6962 Merkle tree construction (Certificate Transparency)
- IETF draft-farley-acta-signed-receipts-01 §5 (commitment-mode profile,
on datatracker, AGT listed as Appendix A.9 conformant implementation)
Verification
============
- All 7 round-trip assertions in getting_started.py pass:
1. Envelope signature valid with no disclosures attached
2. Article 12 disclosure (every committed field) verifies
3. GDPR disclosure (process metadata only) verifies
4. Counterparty disclosure (auth scope only) verifies
5. Tampered field value rejected (merkle proof fails)
6. Tampered envelope rejected (signature invalid)
7. Chained receipt rcpt-0001 -> rcpt-0002 verifies (composes
parent_receipt_hash with field-level Merkle root)
- Cross-implementation conformance is checkable against the open
Apache-2.0 testvectors at github.com/ScopeBlind/agent-governance-
testvectors, which already includes commitment-mode fixtures across
TypeScript / Python / Rust / Go.
Cross-references
================
- Direct prerequisite: Tutorial 33 (Offline-Verifiable Decision Receipts)
- Related: Tutorial 04 (Audit & Compliance), Tutorial 12 (Liability &
Attribution), Tutorial 18 (Compliance Verification), Tutorial 23
(Delegation Chains), Tutorial 26 (SBOM & Signing)
|
Welcome to the Agent Governance Toolkit! Thanks for your first pull request. |
There was a problem hiding this comment.
🤖 AI Agent: code-reviewer
Review Summary
This pull request introduces a new tutorial (Tutorial 46) and accompanying example code for implementing selective-disclosure receipts using RFC 6962-style Merkle trees. The tutorial builds on Tutorial 33's offline-verifiable receipts and extends the functionality to allow selective disclosure of specific fields while maintaining cryptographic integrity for the rest. The implementation is well-documented, adheres to established standards (Ed25519, JCS, SHA-256, RFC 6962), and includes comprehensive examples and tests.
Feedback
🔴 CRITICAL: Security Issues
-
Salt Generation and Storage:
- The salt generation uses
os.urandom(16)for per-field salting, which is cryptographically secure. However, the tutorial does not explicitly address the secure storage of these salts. If salts are lost, the corresponding fields become undisclosable, which could lead to operational issues. Ensure that salts are securely stored and managed in production environments.
- The salt generation uses
-
Disclosure Proof Validation:
- The
verify_prooffunction assumes that theproofarray andleaf_countare correctly provided by the issuer. If an attacker manipulates these values, it could lead to incorrect verification results. Consider adding stricter validation checks for these inputs, such as verifying thatleaf_countmatches the expected number of leaves in the Merkle tree.
- The
-
Replay Attacks:
- The tutorial does not address the risk of replay attacks, where a valid disclosure proof could be reused maliciously. Consider adding a mechanism to ensure that disclosures are tied to specific auditors or contexts, such as including a nonce or timestamp in the disclosure proof.
🟡 WARNING: Potential Breaking Changes
- Backward Compatibility:
- The introduction of the
committed_fields_rootfield in the receipt envelope changes the structure of the receipt. Ensure that this change does not break existing systems that rely on the previous format. Provide clear migration guidelines for users upgrading from Tutorial 33 to Tutorial 46.
- The introduction of the
💡 Suggestions for Improvement
-
Thread Safety:
- The tutorial does not explicitly address thread safety in concurrent agent execution. If the library is intended for use in multi-threaded environments, ensure that the salt generation and storage mechanisms are thread-safe.
-
Type Safety and Validation:
- While the tutorial uses Python's type hints, consider integrating Pydantic models for strict validation of receipt and disclosure data structures. This would ensure type safety and prevent malformed data from being processed.
-
Error Handling:
- The error handling in the
verify_receipt_with_disclosurefunction could be improved. Instead of returning a tuple(False, "error message"), consider raising specific exceptions for different error conditions. This would make debugging and integration easier.
- The error handling in the
-
Performance Optimization:
- The
merkle_rootfunction uses a recursive approach to compute the Merkle root. For large numbers of leaves, this could lead to stack overflow. Consider implementing an iterative approach to improve scalability.
- The
-
Documentation:
- While the tutorial is comprehensive, it could benefit from a dedicated section on security considerations, including the risks of salt loss, replay attacks, and the importance of secure key management.
-
Testing:
- The tutorial includes 7 assertions for end-to-end testing, which is excellent. However, consider adding tests for edge cases, such as:
- Receipts with a single field.
- Receipts with a large number of fields (e.g., 1,000+).
- Invalid or malformed disclosure proofs.
- The tutorial includes 7 assertions for end-to-end testing, which is excellent. However, consider adding tests for edge cases, such as:
-
Cross-Implementation Interoperability:
- The tutorial mentions interoperability with other implementations (e.g., TypeScript, Rust, Go). Consider providing a compatibility matrix or test results to demonstrate cross-implementation consistency.
-
GDPR Compliance:
- The tutorial mentions GDPR compliance but does not provide specific guidance on how to handle sensitive fields (e.g.,
user_id) in practice. Consider adding a section on best practices for GDPR-compliant receipt generation and disclosure.
- The tutorial mentions GDPR compliance but does not provide specific guidance on how to handle sensitive fields (e.g.,
Conclusion
This pull request is a well-thought-out addition to the repository, providing valuable functionality for selective disclosure receipts. Addressing the critical security issues and potential breaking changes will ensure the robustness and reliability of the implementation. The suggestions provided can further enhance the tutorial's usability, security, and compliance.
🤖 AI Agent: security-scanner — Security Review for Pull Request: Tutorial 46 — Selective-Disclosure ReceiptsSecurity Review for Pull Request: Tutorial 46 — Selective-Disclosure ReceiptsThis pull request introduces a new tutorial and example implementation for selective-disclosure receipts, which extend Tutorial 33's offline-verifiable receipts with per-field Merkle commitments. The goal is to allow issuers to selectively disclose specific fields to auditors while maintaining the integrity of the entire receipt. Security Findings1. Prompt Injection Defense BypassRating: 🔵 LOW Recommendation:
2. Policy Engine CircumventionRating: 🟠 HIGH Attack Vector: Recommendation:
3. Trust Chain WeaknessesRating: 🟡 MEDIUM Attack Vector: Recommendation:
4. Credential ExposureRating: 🔵 LOW Recommendation:
5. Sandbox EscapeRating: 🔵 LOW Recommendation:
6. Deserialization AttacksRating: 🟡 MEDIUM Attack Vector: Recommendation:
7. Race ConditionsRating: 🟠 HIGH Attack Vector: Recommendation:
8. Supply Chain RisksRating: 🟠 HIGH Attack Vector: Recommendation:
Summary of Findings
Overall AssessmentThis pull request introduces a well-documented and robust mechanism for selective-disclosure receipts, which is a valuable addition to the toolkit. However, there are several areas where security could be improved, particularly around salt management, key rotation, and dependency security. Addressing these issues will ensure the integrity and trustworthiness of the selective-disclosure mechanism. Recommendation: Address the identified HIGH and MEDIUM severity issues before merging this pull request. |
|
Closing: contributor reputation check flagged this submission as HIGH risk. Signals detected:
This matches the credential-laundering pattern described in our contributor check tooling. The content itself references external projects (ScopeBlind, VeritasActa) and foundation submissions that appear designed to build perceived legitimacy. We welcome genuine contributions. If you believe this was flagged in error, please open a discussion. |
|
For the record, I dispute the allegations and imputations made in this thread concerning me, my business ScopeBlind, my open source organization Veritas Acta, and foundation submissions where both me and my work are explicitly relied on (see: Microsoft's AAIF Project Proposal 19). I have served Concerns Notice and Preservation Notice correspondence concerning these publications and related records. I reserve all rights and will not engage further substantively in this thread pending the private process. |
Adds Tutorial 46 — Selective-Disclosure Receipts with a companion worked example
under
examples/selective-disclosure-governed/. Extends Tutorial 33's offline-verifiablereceipt construction with per-field Merkle commitments (RFC 6962-style), so an issuer
can reveal specific fields to specific auditors and prove the rest are unchanged
without exposing them.
What this adds
docs/tutorials/46-selective-disclosure-receipts.mdexamples/selective-disclosure-governed/getting_started.pyexamples/selective-disclosure-governed/README.mdConstruction (one paragraph)
Each receipt field is committed as a leaf via
SHA-256(0x00 || JCS({name, salt, value}))with a fresh 16-byte salt per field. Leaves are arranged into an RFC 6962 Merkle tree
(node prefix
0x01, non-power-of-two leaf handling matches the CT spec). The receiptenvelope carries a single
committed_fields_rootfield, signed Ed25519 over theJCS-canonical bytes alongside the public fields. A disclosure is a separate JSON
artifact carrying
(name, value, salt, proof, index, leaf_count)tuples for thefields the issuer chose to reveal. The verifier walks each Merkle proof to recompute
the root, then verifies the envelope signature against the public key.
Use case: EU AI Act Article 12 + GDPR composition
The same signed receipt can serve multiple auditors with different disclosure scopes
simultaneously, without re-signing. Article 12 audit sees every field; GDPR data
controller sees only process metadata; cross-org counterparty sees auth scope only.
The construction is described in §5 of
draft-farley-acta-signed-receipts-01(liveon datatracker, AGT listed as Appendix A.9 conformant implementation).
Tutorial number selection
Slot 34 is currently
34-maf-integration.md. The next available sequential slot is 46(after
45-shift-left-governance.md).Verification
All 7 round-trip assertions in
getting_started.pypass end-to-end:Run locally with:
Cross-implementation conformance is checkable against the open Apache-2.0 testvectors
at https://github.com/ScopeBlind/agent-governance-testvectors, which already includes
commitment-mode fixtures across TypeScript / Python / Rust / Go.
Standards
Cross-references
protect-mcp-governed/(Tutorial 33's worked example),physical-attestation-governed/(same primitive on hardware sensors)Note on timing
This lands during AGT's foundation review window. The selective-disclosure capability
the tutorial covers is the construction referenced in the recent foundation submissions
as part of AGT's open-standards integration story:
Tutorial 33 already covered the basic offline-verification path. Tutorial 46 covers
the EU AI Act Article 12 + GDPR composition story (one signed receipt, multiple
disclosure scopes, no per-pair adapters), which is the production-readiness primitive
the foundation TCs evaluating those submissions will likely look for.