fix: Use the same registry version in CatchUpPackageParam and verification - #11358
fix: Use the same registry version in CatchUpPackageParam and verification #11358eichhorl wants to merge 3 commits into
CatchUpPackageParam and verification #11358Conversation
CertificateParams and verification CertificateParams and verification
CertificateParams and verification CatchUpPackageParam and verification
|
✅ No security or compliance issues detected. Reviewed everything up to e46aeeb. Security Overview
Detected Code Changes
|
pierugo-dfinity
left a comment
There was a problem hiding this comment.
the validation context, which in principal could be smaller than the one of the DKG summary
You mean the opposite? So it's actually the other way around, we could technically validate the CUP with a "future" public key of the subnet.
The fix is anyways still correct: we should use the same registry version for validation than the one we used to sign it. The latter is the one from the high threshold transcript of the summary, and the payload builder ensures it is equal to the summary's registry version, which is what you are using here. Though it does not look like this implicit invariant is actually enforced by any tests today.
| assert_eq!( | ||
| *crypto.verified_at.lock().unwrap(), | ||
| Some(summary_registry_version) | ||
| ); |
There was a problem hiding this comment.
Maybe also add an assert_ne!(verified_at, context_registry_version)
There was a problem hiding this comment.
Done, also added a test making sure that both versions are the same for registry cups
No, I mean that assuming the CUP is completely forged, then that forgery could also contain a validation context with a registry version that is smaller than the one of the DKG summary Under normal operation I agree that the risk is the one you describe (although it should never happen with the argument that recovery/splitting set both versions to the same value) |
|
Ah yes, I understand your argument |
The orchestrator only fetches a CUP if it has a higher height and registry version than the local CUP. Here, the relevant registry version is the one of the DKG summary.
However, when validating the CUPs signature, we used the version of the validation context, which in principal could be smaller than the one of the DKG summary. This could lead to the CUP being verified with an old public key from the registry.
With this PR, we also use the registry version of the DKG summary for signature verification. This is fine, since under normal operation, both versions should always point to the same public key: