{ "id": "154462", "key": "MOD-2259", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10034", "key": "MOD", "name": "Appcelerator Modules", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "18128", "name": "encryptedDatabase 1.3.1", "archived": false, "released": true } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-07-05T06:08:49.000+0000", "created": "2016-01-21T19:18:26.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "database" ], "versions": [], "issuelinks": [ { "id": "52566", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "162886", "key": "MOD-2291", "fields": { "summary": "Android : SQLite Database Encryption Module version 1.3.1 throwing error with example ToDo Alloy Apps ", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "55412", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "168931", "key": "MOD-2348", "fields": { "summary": "iOS: Encrypted Database upgrade-error when using Ti.Database", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": null, "updated": "2018-08-06T17:49:26.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13609", "name": "Encrypted SQLite DB" } ], "description": "h6.Issue Description\r\nApp uses Encrypted database module v1.0.0. When the app uses module v1.3.0, it results in white screen and doesn't support the update. Console error below. \r\n\r\nh6.Steps to reproduce \r\nFrom Studio:\r\n1) Get sample app attached and install it (contains both module versions already)\r\nhttps://www.dropbox.com/s/kppn75te6xaarft/Test_EncryptedDB.zip?dl=0\r\n2) Run Encrypted DB module 1.0.0 on sim/device\r\n3) DB operations work as expected\r\n4) Clean Build and upgrade module version to 1.3.0\r\n5) Run app and monitor console logs. Stack trace below is shown. \r\n\r\nh6.Stack Trace\r\n{code}\r\nJan 21 11:06:55 iPad SpringBoard[48] : SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName] \r\nJan 21 11:06:55 iPad SpringBoard[48] : MIS: Using empty blacklist. \r\nJan 21 11:06:55 iPad SpringBoard[48] : SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName] \r\nJan 21 11:06:55 iPad SpringBoard[48] : MIS: Using empty blacklist. \r\nJan 21 11:06:55 iPad securityd[81] : secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found \r\nJan 21 11:06:55 iPad securityd[81] : secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found \r\nJan 21 11:06:55 iPad amfid[655] : SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName] \r\nJan 21 11:06:55 iPad amfid[655] : MIS: Using empty blacklist. \r\nJan 21 11:06:55 iPad securityd[81] : SecOCSPSingleResponseCalculateValidity OCSPSingleResponse: nextUpdate 0.82 days ago \r\nJan 21 11:06:55 iPad securityd[81] : SecOCSPResponseCreateWithID OCSPResponse: decode failure at top level 3C68746D6C3E0A3C686561643E0A3C6D65746120687474702D65717569763D27726566726573682720636F6E74656E743D27313B2075726C3D687474703A2F2F6F6373702E6170706C652E636F6D2F6367692D62696E2F6C6F67696E3F636D643D72656469726563742661727562616C703D62636436636161622D343339302D343635322D386236322D35653363373763393035272F3E0A3C2F686561643E0A3C2F68746D6C3E0A\r\nJan 21 11:06:55 iPad securityd[81] : SecOCSPResponseCreateWithID OCSPResponse: no responseStatus 3C68746D6C3E0A3C686561643E0A3C6D65746120687474702D65717569763D27726566726573682720636F6E74656E743D27313B2075726C3D687474703A2F2F6F6373702E6170706C652E636F6D2F6367692D62696E2F6C6F67696E3F636D643D72656469726563742661727562616C703D62636436636161622D343339302D343635322D386236322D35653363373763393035272F3E0A3C2F686561643E0A3C2F68746D6C3E0A\r\nJan 21 11:06:56 iPad kernel[0] : xpcproxy[932] Container: /private/var/mobile/Containers/Data/Application/EEC10B5D-9ADE-44DC-AB96-83C10AF75F4B (sandbox) \r\nJan 21 11:06:56 iPad Test EncryptedDB[932] : [ERROR] A SQLite database error occurred on database '/var/mobile/Containers/Data/Application/EEC10B5D-9ADE-44DC-AB96-83C10AF75F4B/Library/Private Documents/todo.enc.db.sql': Error Domain=com.plausiblelabs.EncPLDatabase Code=3 \"An error occured parsing the provided SQL statement.\" UserInfo={com.plausiblelabs.EncPLDatabase.error.vendor.code=26, com.plausiblelabs.EncPLDatabase.error.vendor.string=file is encrypted or is not a database, NSLocalizedDescription=An error occured parsing the provided SQL statement., com.plausiblelabs.EncPLDatabase.error.query.string=CREATE TABLE IF NOT EXISTS migrations (latest TEXT, model TEXT);} (SQLite #26: file is encrypted or is not a database) (query: 'CREATE TABLE IF NOT EXISTS migrations (latest TEXT, model TEXT);') \r\nJan 21 11:06:56 iPad Test EncryptedDB[932] : [ERROR] Application received error: invalid SQL statement at enc.db.js (line 1) \r\nJan 21 11:06:56 iPad Test EncryptedDB[932] : [ERROR] Application received error: Module \"alloy/models/Todo\" failed to leave a valid exports object\r\n{code}", "attachment": [ { "id": "58402", "filename": "appc_info.txt", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2016-03-03T08:51:52.000+0000", "size": 602948, "mimeType": "text/plain" }, { "id": "59193", "filename": "enc.db.js", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-05-12T05:43:02.000+0000", "size": 18796, "mimeType": "application/x-javascript" }, { "id": "58401", "filename": "errorlog", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2016-03-03T08:52:01.000+0000", "size": 2791861, "mimeType": "text/html" }, { "id": "58404", "filename": "IMG_0329.jpg", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2016-03-03T08:53:12.000+0000", "size": 42274, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "iOS: Encrypted Database Adapter error on module upgrade", "creator": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "environment": "Encrypted DB module 1.3.0\r\n\r\nEnvironment details: \r\nXcode – 7.1 \r\nAppcelerator SDK – 5.1.1.GA \r\niOS simulator – iOS 8.4 & 9.1 iPad 2 \r\nStudio Version - 4.4.0.201511241829 \r\nOSX version – 10.10.5 \r\nNode v0.12.7\r\nAppcelerator Command-Line Interface, version 5.1.0", "closedSprints": [ { "id": 678, "state": "closed", "name": "2016 Sprint 14 SDK", "startDate": "2016-07-02T00:25:57.921Z", "endDate": "2016-07-16T00:25:00.000Z", "completeDate": "2016-07-18T03:18:29.729Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "375606", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "body": "The migrations cannot be done due this file (migrations table):\r\n\r\n* app/assets/alloy/sync/enc.db.js\r\n\r\n{code}\r\n// Gets the current saved migration\r\nfunction GetMigrationFor(dbname, table) {\r\n var mid = null;\r\n var db = _database.open(dbname);\r\n db.execute('DROP TABLE IF EXISTS migrations'); \r\n db.execute('CREATE TABLE IF NOT EXISTS migrations (latest TEXT, model TEXT);');\r\n var rs = db.execute('SELECT latest FROM migrations where model = ?;', table);\r\n if (rs.isValidRow()) {\r\n mid = rs.field(0) + '';\r\n }\r\n rs.close();\r\n db.close();\r\n return mid;\r\n}\r\n{code}", "updateAuthor": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-02-01T17:13:06.000+0000", "updated": "2016-02-01T17:13:06.000+0000" }, { "id": "385500", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Basically, the difference between appcelerator.encrypteddatabase 1.0.0 and 1.3.0 is that they contain different default settings, and thus existing databases need to be migrated or upgraded from older settings to a new version. \r\n\r\nI'm still working on a way to do a in-place conversion of a existing database to a new one (which will take time), but at the mean time, a simple way to enable the usage of 1.3.0 module is, in your titanium app, in every {code}var db = database.open{code} being called, you just need to add this in the following line: {code}db.execute('PRAGMA kdf_iter = 4000;'); {code}\r\nSo in the attached sample app, you are adding this line in {{/app/assets/alloy/sync/enc.db.js}} after {code}_database.open(..);{code}\r\n\r\nThis basically tells the new module to read the table with the old setting. (the new one is kdf_iter = 64000)This really doesn't have any impact on the overall usage of the database. And it's a good solution for now if you really need this out asap.\r\n\r\nEventually we will need a solution like this (pseudocode):\r\n{code}\r\nif (olderDatabaseExists && !hasMigrated) {\r\n db.open();\r\n db.migrate();\r\n hasMigrated = true;\r\n}\r\n{code}\r\nThe eventual solution *will still work* in a later release if you choose to the above fix first in an interim version.\r\n\r\n[~shossain] ^", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-05-12T05:29:37.000+0000", "updated": "2016-05-12T05:52:40.000+0000" }, { "id": "385502", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "h4. Steps to test if above fix works\r\n1. Starting from scratch (no pre-existing app on the simulator)\r\n2. Get sample app attached and install it (contains both module versions already)\r\nhttps://www.dropbox.com/s/kppn75te6xaarft/Test_EncryptedDB.zip?dl=0\r\n3) Run Encrypted DB module 1.0.0 on sim/device: *appc run -p ios -C * only ipad2 works now because the module 1.0.0 is 32bit.\r\n4) DB operations work as expected\r\n5) Clean Build and upgrade module version to 1.3.0\r\n6) replace {{/app/assets/alloy/sync/enc.db.js}} with the one attached in ticket\r\n7) Run app again and it will still work", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-05-12T05:42:30.000+0000", "updated": "2016-05-12T05:42:30.000+0000" }, { "id": "386382", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "To clarify, what Kiat has proposed is a workaround for now. The 32-bit to 64-bit SDK change forced a change in the connection parameters. However, it currently fails during the migration. Thus, what Kiat is suggesting is to read the tables with the old default:\r\n \r\nhttps://www.zetetic.net/sqlcipher/sqlcipher-api/#kdf_iter\r\nhttps://www.zetetic.net/blog/2013/9/3/sqlcipher-300-beta-release.html\r\n\r\n(it went from 4000 in 1.0.0 to 64000 in 1.3.0, thus the pragma definition he adds of setting it back to 4000). This change is not something we can control if we wish to take advantage of 64-bit support.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-05-20T21:12:07.000+0000", "updated": "2016-05-20T21:14:28.000+0000" }, { "id": "386383", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Note also the description of \"cypher_migrate\" in https://www.zetetic.net/blog/2013/9/3/sqlcipher-300-beta-release.html, so perhaps ACE could explore that pragma as a workaround.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-05-20T21:15:52.000+0000", "updated": "2016-05-20T21:15:52.000+0000" }, { "id": "386754", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR here: https://github.com/appcelerator-modules/appcelerator.encrypteddatabase/pull/12\r\n", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-05-25T10:15:33.000+0000", "updated": "2016-05-25T10:15:33.000+0000" }, { "id": "386850", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR updated. release updated. Tested on new project as well as attached project. \r\nh4. Steps to test\r\n1. Starting from scratch (no pre-existing app on the simulator)\r\n2. Get sample app attached and install it (contains both module versions already)\r\nhttps://www.dropbox.com/s/kppn75te6xaarft/Test_EncryptedDB.zip?dl=0\r\n3) Run Encrypted DB module 1.0.0 on sim/device: *appc run -p ios -C * only ipad2 works now because the module 1.0.0 is 32bit.\r\n4) DB operations work as expected\r\n5) Clean Build and upgrade module version to 1.3.1\r\n7) Run app again and it will still work", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-05-26T04:36:56.000+0000", "updated": "2016-05-26T04:36:56.000+0000" }, { "id": "386877", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "CR approved. Waiting for the customer to confirm the supplied solution before merging.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-05-26T08:36:29.000+0000", "updated": "2016-05-26T08:36:29.000+0000" }, { "id": "388061", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~arohini] did you have an updated test case?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-10T16:41:44.000+0000", "updated": "2016-06-10T16:41:44.000+0000" }, { "id": "388833", "author": { "name": "arohini", "key": "arohini", "displayName": "Ajith Rohini", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~cng], Can we please give this a high priority? I had an email from Richard who is the Dir.Technical Architecture and IT Strategy @ ACE mentioning that they are getting pretty upset since this has been going on since Jan.\r\n\r\nAny help would be much appreciated", "updateAuthor": { "name": "arohini", "key": "arohini", "displayName": "Ajith Rohini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-22T15:17:28.000+0000", "updated": "2016-06-22T15:17:28.000+0000" }, { "id": "388865", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~sliang] Use this version please. https://github.com/appcelerator-modules/appcelerator.encrypteddatabase/releases/tag/1.3.1\r\nand try it against your reproducible case. it's a new build.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-06-22T19:08:28.000+0000", "updated": "2016-06-22T19:08:28.000+0000" }, { "id": "388884", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "[~cng] I think I did use this one, I downloaded and tested it yesterday. Did you build a new today?", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2016-06-23T00:56:44.000+0000", "updated": "2016-06-23T00:56:44.000+0000" }, { "id": "389211", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "[~cng], I tried your latest build for v1.3.1 servial time. And the problem still there.\r\n\r\nHere is the step:\r\n\r\n1. Delete the old app from simulator. (important)\r\n2. Go with the reproduce steps in my comment. (v1.0.0 to v1.3.1)\r\n\r\nThis error will pop out.\r\n\r\n{code}\r\n[INFO] : Opening DB...\r\n[ERROR] : Error occurred calling next on a EncPLSqliteResultSet. SQLite error: 'attempt to write a readonly database' for 'INSERT OR IGNORE INTO testtable(id) VALUES (3);'\r\n[ERROR] : Script Error {\r\n[ERROR] : column = 21;\r\n[ERROR] : line = 19;\r\n[ERROR] : message = \"Error occurred calling next on a EncPLSqliteResultSet. SQLite error: 'attempt to write a readonly database' for 'INSERT OR IGNORE INTO testtable(id) VALUES (3);'\";\r\n[ERROR] : sourceURL = \"file:///Users/shuoliang/Library/Developer/CoreSimulator/Devices/44C74F69-DC96-461F-9FE1-93256A9F224D/data/Containers/Bundle/Application/03127931-BB65-413C-8CEF-FDEFFCF82117/AlloyTest6.app/app.js\";\r\n[ERROR] : stack = \"[native code]\\ninsert@file:///Users/shuoliang/Library/Developer/CoreSimulator/Devices/44C74F69-DC96-461F-9FE1-93256A9F224D/data/Containers/Bundle/Application/03127931-BB65-413C-8CEF-FDEFFCF82117/AlloyTest6.app/app.js:19:21\\nglobal code@file:///Users/shuoliang/Library/Developer/CoreSimulator/Devices/44C74F69-DC96-461F-9FE1-93256A9F224D/data/Containers/Bundle/Application/03127931-BB65-413C-8CEF-FDEFFCF82117/AlloyTest6.app/app.js:41:7\";\r\n[ERROR] : }\r\n{code}\r\n\r\nNote: If I run the app again with v1.3.1 right after this error (not delete app, not clean the project), the error will gone. ", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2016-06-28T02:32:01.000+0000", "updated": "2016-06-28T02:34:10.000+0000" }, { "id": "389445", "author": { "name": "sdavenport", "key": "sdavenport", "displayName": "Scott Davenport", "active": true, "timeZone": "America/Havana" }, "body": "[~cbowley] can you work with Ajith and make sure this one gets over the line? Thanks...Ajith just FYI Chris works very closely with the ACE/Chubb team as they have paid for 1 year of a Solutions Architect 6 hours a week. He knows the ins and outs of the account from an app perspective.", "updateAuthor": { "name": "sdavenport", "key": "sdavenport", "displayName": "Scott Davenport", "active": true, "timeZone": "America/Havana" }, "created": "2016-06-29T20:28:10.000+0000", "updated": "2016-06-29T20:28:10.000+0000" }, { "id": "389569", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~sliang] I'll try your test case again and see what I can do. Meanwhile, instead of your test case, can the customer provide a 100% reproducible one? ", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-06-30T10:58:01.000+0000", "updated": "2016-06-30T10:58:01.000+0000" }, { "id": "440165", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-06T17:49:26.000+0000", "updated": "2018-08-06T17:49:26.000+0000" } ], "maxResults": 63, "total": 63, "startAt": 0 } } }