Skip to content

fix: close signature-verification bypass and harden input validation - #9

Merged
smq9sn5jck-coder merged 2 commits into
mainfrom
claude/repo-audit-fixes-HDq24
Jun 1, 2026
Merged

fix: close signature-verification bypass and harden input validation#9
smq9sn5jck-coder merged 2 commits into
mainfrom
claude/repo-audit-fixes-HDq24

Conversation

@smq9sn5jck-coder

Copy link
Copy Markdown
Owner

Repo audit fixes — causallayer-verifier

Closes a Critical signature-verification bypass plus several correctness/packaging issues found during a code audit.

Critical

  • Signature bypass removed. Check 3 previously accepted any 64-hex-char string in "demo mode" (sigHex.length === 64), reporting it as a passing warn. Demo mode now only warns on an exact expected-digest match and fails closed otherwise. Verified: a forged cert (unknown key + 64-hex signature) is now rejected with a hard fail.

High

  • Validate algorithm agreement (registry key + cert issuer must both be ed25519) and that the signature is a well-formed 128-char hex string before attempting Ed25519 verification — instead of letting Buffer.from(...,"hex") silently truncate malformed input.

Medium / Low

  • Check 1 now validates field types of untrusted input (issuer object, causal_chain array, outputs object, signature/merkle_root strings), not just presence.
  • verify.update() encoding made explicit (utf8) to match sha256Hex.
  • CLI version string now read from package.json (was hardcoded v0.1.0).
  • Fixed malformed .gitignore (literal \n → real newlines, so node_modules/ and dist/ are actually ignored).
  • dist/ rebuilt from patched source.

Not included (need signer-side coordination)

Remote registry trust-pinning, RFC-8785-compliant canonicalization, and Merkle duplicate-leaf domain separation were intentionally left out — changing them alters verification behavior and must be aligned with the signing server.

🤖 Generated during a repository code audit.


Generated by Claude Code

Claude Code added 2 commits June 1, 2026 04:39
…alidation

Security and correctness fixes from repo audit:

- CRITICAL: Check 3 no longer accepts any 64-hex-char string in demo mode.
  Previously `sigHex.length === 64` was treated as a passing (warn) signature.
  Demo mode now only warns on an EXACT expected-digest match and fails closed
  otherwise.
- Validate algorithm agreement (registry key + cert issuer must be ed25519)
  and that the signature is a well-formed 128-char hex string BEFORE attempting
  Ed25519 verification, instead of letting Buffer.from(...,"hex") silently
  truncate malformed input.
- Check 1 now validates field TYPES of untrusted input (issuer object,
  causal_chain array, outputs object, signature/merkle_root strings), not just
  presence, before later checks dereference them.
- Make verify.update() encoding explicit (utf8) to match sha256Hex.
- CLI version string now read from package.json instead of hardcoded, so it
  cannot drift on version bump.
- Fix malformed .gitignore (literal "\n" replaced with real newlines so
  node_modules/ and dist/ are actually ignored).

dist/ rebuilt from patched source.
…es-HDq24

# Conflicts:
#	.gitignore
#	dist/index.js
#	src/index.ts
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