[aesmd] Fix breaking change in InitQuoteExRequest schema+handling - #1107
Conversation
Without this fix, old enclaves using v2.29 clients and before cannot acquire remote attestations from the AESM service, as the `buf_size` field was marked `required` with v2.30. Old clients did not set `buf_size` when they did not set `b_pub_key_id`, as the `buf_size` field is not relevant in that case. This diff reverts the `buf_size` field back to `optional` and allows it to be unset or explicitly `buf_size=0` when `b_pub_key_id` is unset. Likewise, when `b_pub_key_id`, it allows `buf_size` in the range [1, 4096]. Note that we don't need explicit `has_buf_size()` checks, as proto2 defaults the field getter to 0 when unset. Signed-off-by: Philip Kannegaard Hayes <philiphayes9@gmail.com>
fb2878c to
c88d632
Compare
|
cc @fqiu1 |
|
LGTM, @phlip9 thank you for providing the fix! |
There was a problem hiding this comment.
Pull request overview
Restores backwards compatibility for aesmd IPC InitQuoteExRequest parsing/validation so older (v2.29 and earlier) clients can continue requesting the pubkey-id size without being rejected, while preserving existing buf_size hardening when a pubkey-id buffer is actually requested.
Changes:
- Reverts
InitQuoteExRequest.buf_sizefromrequiredback tooptionalin the proto2 schema. - Removes the strict
has_buf_size()gate inAEInitQuoteExRequest::check()and relies on semantic validation (buf_size()==0/!=0) keyed offb_pub_key_id.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| psw/ae/aesm_service/source/core/ipc/messages.proto | Makes InitQuoteExRequest.buf_size optional again to allow old clients to parse successfully. |
| psw/ae/aesm_service/source/core/ipc/AEInitQuoteExRequest.cpp | Updates request validation to allow buf_size unset/0 when b_pub_key_id is false, while still rejecting unset/0 (and oversize) when b_pub_key_id is true. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Hi @phlip9 ! Thanks for submitting the issue and proposing a fix! The plan is to release a new version by tomorrow with your fix included (internal version of the packages will be updated from |
|
Update: Intel® SGX SDK/PSW 2.30.1 containing this change is now released. |
Problem
This commit included in v2.30 d630abf6 - Harden AESM IPC request parsing and semantic validation breaks backwards compatibility. Clients or enclaves using v2.29 clients and older can no longer get remote attestations.
Cause
The issue is overly-strict hardening that breaks old clients, even when it is not strictly necessary. Specifically,
InitQuoteExRequest.buf_sizewent fromoptionaltorequired:message InitQuoteExRequest{ optional bytes att_key_id = 1; required bool b_pub_key_id = 3; - optional uint64 buf_size = 4; + required uint64 buf_size = 4; optional uint32 timeout = 9; }You can see relevant log lines where
aesmdrejects a pubkey size request from an old enclave:Before the hardening change, v2.29 clients omitted
buf_sizewhenb_pub_key_id=false(essentially querying the pubkey size). Making the fieldrequiredcausesaesmdfrom v2.30 to reject requests generated by prev. SGX releases.Fix
Fortunately, we can both keep the max
buf_sizehardening and maintain backwards compatibility. Whenb_pub_key_idis set, it still correctly rejectsbuf_sizeunset orbuf_size=0. But whenb_pub_key_idis unset, we'll allowbuf_sizeunset orbuf_size=0. Recall that proto2 getters return default values for unset optional fields, sobuf_size() == 0when unset. This way old enclaves keep working, and we can enjoy a saferaesmd: )