nativescript-community / https

Secure HTTP client with SSL pinning for Nativescript - iOS/Android
https://nativescript-community.github.io/https/
Other
51 stars 42 forks source link

[IOS] Object key sorting by NSMutableDictionary and NSMutableArray #62

Closed kefahB closed 4 years ago

kefahB commented 4 years ago

Hi @EddyVerbruggen

sorry, I've been asking you a lot lately ..

I have a question about using NSMutableDictionary and NSMutableArray on IOS before sending the body; for security reasons I sign all data & params into header and I do compare on server side if the data was changed.... the problem is I have a differences between the body signed before sending the data and the body send by the plugin !

I have done some debugging :

I don't know if you have specific reason for using NSMutableDictionary and NSMutableArray .. if not sending the opts.body directly resolve conflict

kefahB commented 4 years ago

Hi @farfromrefug,

What do you think about that ? NSMutableDictionary and NSMutableArray do ordering data and also remove the key:value if the value it is NULL what i understand but the real problem that on server side with the ordering of data, ex: will proceed to ordering data by alphabetical first then the numeric...

Do you think there is a way to do some think with ?

farfromrefug commented 4 years ago

@kefahB funny you said that we implemented that very recently :D And there is no way to force the order. You will never be sure to have the same order between js and php for example. What we did is write a simple little function to generate a "string" signature: The JS one The PHP one

kefahB commented 4 years ago

Hi,

I've found the way to mange this on php side that is not a problem, it was just a question if there is a way to prevent this ;)

I will close this