voltrue2 / in-app-purchase

A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows.
http://iap.gracenode.org
Other
1.04k stars 287 forks source link

Apple Sandbox validation - Check for empty data #311

Open l0gg3r opened 4 years ago

l0gg3r commented 4 years ago

Starting on April 3, 2020 Apple Sandbox validation started to fail,

As I've debugged, the data variable is empty. most probably this is Apple's fault, but anyway this causes to an unhandled exception.

TypeError: Cannot read property 'status' of undefined
    at /opt/someproj/node_modules/in-app-purchase/lib/apple.js:207:22
    at Request._callback (/opt/someproj/API/node_modules/in-app-purchase/lib/apple.js:410:16)
    at Request.self.callback (/opt/someproj/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/opt/someproj/node_modules/request/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/opt/someproj/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1055:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

This happens as there is a reference to data.status without checking data for undefined.