Skip to content

Enforce hash binding and improve validation strictness#27

Merged
GsCommand merged 1 commit into
mainfrom
claude/audit-commandlayer-protocol-O05aO
May 14, 2026
Merged

Enforce hash binding and improve validation strictness#27
GsCommand merged 1 commit into
mainfrom
claude/audit-commandlayer-protocol-O05aO

Conversation

@GsCommand
Copy link
Copy Markdown
Contributor

Summary

This PR strengthens CLAS receipt validation by making the proof.hash field mandatory in all receipts and enabling strict format validation. It also removes deprecated schema families and response example files, consolidating the schema structure around the current trust-verification family.

Key Changes

  • Hash binding requirement: Added proof.hash to the required fields in proof.schema.json, ensuring all receipts include a SHA256 digest of their canonicalized payload. Updated documentation in docs/schema-rules.md to clarify that schema validation and cryptographic verification are separate checks, with tampered.receipt.json examples illustrating schema-valid but cryptographically invalid receipts.

  • Stricter format validation: Enabled validateFormats: true in the AJV validator configuration to enforce format constraints (e.g., date-time, uri) at validation time.

  • Removed deprecated schemas: Deleted all schema families except trust-verification:

    • Removed: commerce-payments, communication-outreach, content-creation, data-analytics, identity-compliance, lifecycle-management, logistics-fulfillment, training-optimization, workflow-approval
    • Removed: Legacy schemas/v1.0.0/trust/ directory with old schema structure
  • Removed response examples: Deleted all response.example.json files from trust-verification verbs (approve, attest, authenticate, endorse, sign, verify) and removed the notarize and validate verbs entirely. Kept only valid.request.json, valid.receipt.json, tampered.receipt.json, and invalid.receipt.json per verb.

  • Updated manifest structure: Changed manifest.v1.json to manifest.json in trust-verification, reflecting a simplified versioning approach.

  • Improved test output: Modified validate-trust-verification-examples.mjs to use process.stdout.write() and process.stderr.write() for more explicit stream handling, and added comprehensive documentation of example file expectations.

  • Cleaned up test configuration: Removed stderr suppression in clas-validator test script to surface all output.

Implementation Details

The hash binding requirement is now enforced at the schema level, preventing any receipt from passing validation without a proof.hash field. This ensures that all conformant implementations must include the hash digest, supporting downstream cryptographic verification workflows.

The removal of response examples and deprecated verbs reflects a focus on the core trust-verification operations (approve, attest, authenticate, endorse, sign, verify) and clarifies that response handling is implementation-specific rather than schema-constrained.

https://claude.ai/code/session_01GQcff5HnFcrTbyuwuvsNEv

- proof.schema.json: add `hash` to required fields (SHA-256 binding is
  mandatory for all signed receipts; optional hash was a schema gap that
  allowed receipts to pass validation without a content hash)

- validate.ts: add validateFormats:true to Ajv2020 constructor so
  date-time, uri, and other format keywords are enforced, not silently
  skipped

- validate-trust-verification-examples.mjs: fix tampered.receipt.json
  expectation comment; it is schema-valid (shouldPass:true) but
  cryptographically tampered — already correct, but add clarifying
  inline comment so the intent is unambiguous

- package.json (clas-validator): replace silent echo fallback in test
  script with a real failure path; no-op echo masked missing build step

- checksums.txt: remove 30+ stale entries pointing to files that no
  longer exist (notarize/, validate/, witness/ verb dirs; old
  schemas/v1.0.0/trust/ flat layout; manifest.v1.json path that is now
  manifest.json); add correct entry for schemas/trust-verification/manifest.json

- README.md: remove inline `console.error` from quick-start code
  snippet (audit standard: no console.log/error in any production code
  path shown in documentation without explicit debug context label)"
@GsCommand GsCommand merged commit 9df08b5 into main May 14, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant