fix: verify_server_keys_response fails on non-standard json fields

Previously `verify_server_keys_response` would work with re-serialized 
ServerSigningKeys, which drops any extra, non-standard fields from the
origin server response. The signature is made over the whole response
though, meaning that any response including extra fields will not pass
signature verification.
This commit is contained in:
hexchen authored and Ellis Git committed 2026-11-18 15:10:51 +00:00
1 parent ad50b9a3b3
commit cec1f85f88
4 files changed
+125 -30

No files matched your search

+6
View File
@@ -37,9 +37,15 @@ pub(crate) async fn get_server_keys_route(
if resp.valid_until_ts > in_one_week() {
continue;
}
let raw_resp = Raw::new(&resp)?;
let trusted = services.config.trusted_servers.iter().any(|notary| {
// Re-verifying here rejects any key that passes extra,
// non-standard json keys as a part of the ServerSigningKeys
// object. Since these extra json keys are stripped, the
// signature won't validate.
server_keys::Service::verify_server_keys_response(
&resp,
&raw_resp,
Some((notary.server_name(), notary.verify_keys())),
)
.is_ok()