noir_passport : Bind tbs_certificate_len into the commitment chain
Nobody has claimed this yet.
- Dominant language
- Noir
- Stars
- 138
- Forks
- 47
- Avg merge
- 1d 34m
- Merged PRs (30d)
- 6
Description
Description
t_add_dsc_verify_1300/src/main.nr uses tbs_certificate_len to determine which bytes are passed to sha256_finalize, but the length itself is never included in the output commitment:
comm_out = hash_salt_country_tbs(salt_out, country, tbs_certificate)
A prover can supply an undersized tbs_certificate_len to shorten the range of bytes that get SHA-256'd, potentially excluding authenticated certificate content from the commitment chain.
Root Cause
hash_salt_country_tbs commits to the full 1300-byte tbs_certificate buffer and to salt_out / country, but not to tbs_certificate_len. The length is consumed only by the SHA-256 path (determining which bytes get hashed for RSA verification) and is otherwise unconstrained with respect to the commitment output.
Fix
Either:
- Option A — Include
tbs_certificate_lenas an explicit field in thehash_salt_country_tbsPoseidon2 hash, or - Option B — Restructure the commitment to hash only the authenticated prefix (the first
tbs_certificate_lenbytes) rather than the raw fixed-size buffer.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in t_add_dsc_verify_1300/src/main.nr, focusing on the comm_out assignment and the sha256_finalize path that consumes tbs_certificate_len. Compare the two proposed fixes and confirm the chosen commitment binds the length or authenticated prefix, while preserving the intended SHA-256 input. Done means undersized lengths can no longer exclude certificate content from the commitment chain.
Written by the indexing model from the issue text.
Assessment
- Domain
- cryptography, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100