I have started implementing support for the new App Store Server notifications (version 2): https://developer.apple.com/documentation/appstoreservernotifications/receiving_app_store_server_notifications
I am not sure how to prevent a possible mad-in-the-middle attack when using those notifications. The decoded header that I get for notifications in the Sandbox environment is missing the "kid" field that is used to identify the key used to generate a signature.
Yes, I understand the the whole entire certificate chain is available in the "x5c" field and it could be verified by itself. However, this does not guarantee that a notification was signed by Apple.
This approach (with no specific key, with a certificate chain in x5c) works fine when verifying a receipt on device with StoreKit 2 but it does not work when getting a notification on a server.
-
—
Krivers
-
—
omerlevi123
-
—
southernkasaist
Add a CommentI also have the same doubts
Did you solve it?
I have exactly the same question. I took half a day to figure out how to verify the cert chain in x5c, couldn't make it until I found this question.
It's really bad work as there's nothing described in the official guide https://developer.apple.com/documentation/appstoreservernotifications Not mentioned in WWDC21 session as well https://developer.apple.com/videos/play/wwdc2021/10174/