storesafe / cordova-sqlite-storage

A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API
Other
2.14k stars 713 forks source link

iOS Binary Make Use Of Insecure APIs #988

Open waligoraj opened 2 years ago

waligoraj commented 2 years ago

The iOS binary makes use of several APIs that are insecure. These functions are dangerous because they might lead to memory corruption and should not be used. The following binaries were discovered being used: _malloc _fopen _stat _memcpy _strncpy _sscanf _strlen _srand _random

brodybits commented 2 years ago

Thanks but these API functions are used by SQLite which is very well tested as described here: https://sqlite.org/testing.html

I would consider this issue to be invalid and will likely close it unless there are some very, very strong arguments forthcoming.

waligoraj commented 2 years ago

Brody,

Thanks for you quick response. I am trying to get clarification for our security team, and an explanation as to why this plugin is secure and what would be driving these "false positive" security vulnerabilities. In other words, can you explain why these functions listed above, cannot lead to memory corruption? Any and all response will be extremely useful in explaining to my security department why we don't have to be concerned about this plugin.

Thanks, Joseph Waligora

brodybits commented 2 years ago

Hello I am still not yet convinced that we should keep this issue open.

It would be extremely helpful if you could give me an idea of what tool is reporting the use of "insecure" or "dangerous" API functions.

Yes the C functions listed in the description do have to be used very carefully.

As I tried to explain before:

By "extremely well tested" I mean that SQLite has been tested with 100% code and branch coverage for years and has been considered safe for aviation as well:

At the risk of sounding promotional I will also say that SQLite is known as the most widely used database engine:

One more thing is that in terms of this plugin:

I did receive some reports of intermittent database file corruption back in 2017 (3-4 years ago) and applied some build updates in response to these reports: https://github.com/storesafe/cordova-sqlite-storage-help/issues/34 ... I have not seen any more reports of database file corruption since 2018 when I applied these updates.

Given the points above, I would consider this plugin to be very safe against memory corruption.

Does this mean that we can absolutely guarantee that the use of these functions can never lead to memory corruption? Not necessarily, but I think it can and should be plenty good enough. Thanks.