Skip to content

Commit

Permalink
chore: vscode specific changes
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed Nov 16, 2021
1 parent 918052b commit 59a82b2
Show file tree
Hide file tree
Showing 9 changed files with 1,618 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
disturl "https://electronjs.org/headers"
target "15.3.1"
runtime "electron"
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@

- Increase electron/osx binary coverage [#1041](https://github.com/mapbox/node-sqlite3/pull/1041) (@kewde)

## 4.0.5

- Improved extended error code handling

## 4.0.4

- Enabled extended error codes when opening of DB fails (via `sqlite3_extended_errcode`)

## 4.0.3

- Enabled extended error codes by default (via `sqlite3_extended_result_codes`)

## 4.0.2

- Fixed HTTP proxy support by using `request` over `needle` in node-pre-gyp
Expand Down
41 changes: 41 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->

## Security

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).

If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
24 changes: 12 additions & 12 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"targets": [
{
"target_name": "<(module_name)",
"target_name": "vscode-sqlite3",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"xcode_settings": { "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
Expand Down Expand Up @@ -51,16 +51,16 @@
],
"defines": [ "NAPI_VERSION=<(napi_build_version)", "NAPI_DISABLE_CPP_EXCEPTIONS=1" ]
},
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}
]
}
#{
# "target_name": "action_after_build",
# "type": "none",
# "dependencies": [ "<(module_name)" ],
# "copies": [
# {
# "files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
# "destination": "<(module_path)"
# }
# ]
#}
]
}
6 changes: 3 additions & 3 deletions lib/sqlite3-binding.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var binary = require('@mapbox/node-pre-gyp');
/*var binary = require('@mapbox/node-pre-gyp');
var path = require('path');
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
var binding = require(binding_path);
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));*/
var binding = require('../build/Release/vscode-sqlite3.node');
module.exports = exports = binding;
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sqlite3",
"name": "@vscode/sqlite3",
"description": "Asynchronous, non-blocking SQLite3 bindings",
"version": "5.0.2",
"homepage": "https://github.com/mapbox/node-sqlite3",
Expand Down Expand Up @@ -40,8 +40,7 @@
"url": "git://github.com/mapbox/node-sqlite3.git"
},
"dependencies": {
"node-addon-api": "^4.2.0",
"@mapbox/node-pre-gyp": "^1.0.0"
"node-addon-api": "^4.2.0"
},
"devDependencies": {
"@mapbox/cloudfriend": "^1.9.0",
Expand All @@ -61,7 +60,6 @@
"node-gyp": "7.x"
},
"scripts": {
"install": "node-pre-gyp install --fallback-to-build",
"pretest": "node test/support/createdb.js",
"test": "mocha -R spec --timeout 480000",
"pack": "node-pre-gyp package"
Expand Down
8 changes: 8 additions & 0 deletions src/database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,21 @@ void Database::Work_Open(napi_env e, void* data) {
);

if (baton->status != SQLITE_OK) {
// Get the extended error code since this error happened
// during open where sqlite3_extended_result_codes was
// not called yet. We overwrite the status with the extended
// code to ensure we can produce a more detailed error.
baton->status = sqlite3_extended_errcode(db->_handle);
baton->message = std::string(sqlite3_errmsg(db->_handle));
sqlite3_close(db->_handle);
db->_handle = NULL;
}
else {
// Set default database handle values.
sqlite3_busy_timeout(db->_handle, 1000);

// Enable extended error codes.
sqlite3_extended_result_codes(db->_handle, 1);
}
}

Expand Down
72 changes: 71 additions & 1 deletion src/node_sqlite3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ Napi::Object RegisterModule(Napi::Env env, Napi::Object exports) {

const char* sqlite_code_string(int code) {
switch (code) {

// Basic Codes
case SQLITE_OK: return "SQLITE_OK";
case SQLITE_ERROR: return "SQLITE_ERROR";
case SQLITE_INTERNAL: return "SQLITE_INTERNAL";
Expand Down Expand Up @@ -99,7 +101,75 @@ const char* sqlite_code_string(int code) {
case SQLITE_NOTADB: return "SQLITE_NOTADB";
case SQLITE_ROW: return "SQLITE_ROW";
case SQLITE_DONE: return "SQLITE_DONE";
default: return "UNKNOWN";

// Extended Codes
case SQLITE_ERROR_MISSING_COLLSEQ: return "SQLITE_ERROR_MISSING_COLLSEQ";
case SQLITE_ERROR_RETRY: return "SQLITE_ERROR_RETRY";
case SQLITE_IOERR_READ: return "SQLITE_IOERR_READ";
case SQLITE_IOERR_SHORT_READ: return "SQLITE_IOERR_SHORT_READ";
case SQLITE_IOERR_WRITE: return "SQLITE_IOERR_WRITE";
case SQLITE_IOERR_FSYNC: return "SQLITE_IOERR_FSYNC";
case SQLITE_IOERR_DIR_FSYNC: return "SQLITE_IOERR_DIR_FSYNC";
case SQLITE_IOERR_TRUNCATE: return "SQLITE_IOERR_TRUNCATE";
case SQLITE_IOERR_FSTAT: return "SQLITE_IOERR_FSTAT";
case SQLITE_IOERR_UNLOCK: return "SQLITE_IOERR_UNLOCK";
case SQLITE_IOERR_RDLOCK: return "SQLITE_IOERR_RDLOCK";
case SQLITE_IOERR_DELETE: return "SQLITE_IOERR_DELETE";
case SQLITE_IOERR_BLOCKED: return "SQLITE_IOERR_BLOCKED";
case SQLITE_IOERR_NOMEM: return "SQLITE_IOERR_NOMEM";
case SQLITE_IOERR_ACCESS: return "SQLITE_IOERR_ACCESS";
case SQLITE_IOERR_CHECKRESERVEDLOCK: return "SQLITE_IOERR_CHECKRESERVEDLOCK";
case SQLITE_IOERR_LOCK: return "SQLITE_IOERR_LOCK";
case SQLITE_IOERR_CLOSE: return "SQLITE_IOERR_CLOSE";
case SQLITE_IOERR_DIR_CLOSE: return "SQLITE_IOERR_DIR_CLOSE";
case SQLITE_IOERR_SHMOPEN: return "SQLITE_IOERR_SHMOPEN";
case SQLITE_IOERR_SHMSIZE: return "SQLITE_IOERR_SHMSIZE";
case SQLITE_IOERR_SHMLOCK: return "SQLITE_IOERR_SHMLOCK";
case SQLITE_IOERR_SHMMAP: return "SQLITE_IOERR_SHMMAP";
case SQLITE_IOERR_SEEK: return "SQLITE_IOERR_SEEK";
case SQLITE_IOERR_DELETE_NOENT: return "SQLITE_IOERR_DELETE_NOENT";
case SQLITE_IOERR_MMAP: return "SQLITE_IOERR_MMAP";
case SQLITE_IOERR_GETTEMPPATH: return "SQLITE_IOERR_GETTEMPPATH";
case SQLITE_IOERR_CONVPATH: return "SQLITE_IOERR_CONVPATH";
case SQLITE_IOERR_VNODE: return "SQLITE_IOERR_VNODE";
case SQLITE_IOERR_AUTH: return "SQLITE_IOERR_AUTH";
case SQLITE_IOERR_BEGIN_ATOMIC: return "SQLITE_IOERR_BEGIN_ATOMIC";
case SQLITE_IOERR_COMMIT_ATOMIC: return "SQLITE_IOERR_COMMIT_ATOMIC";
case SQLITE_IOERR_ROLLBACK_ATOMIC: return "SQLITE_IOERR_ROLLBACK_ATOMIC";
case SQLITE_LOCKED_SHAREDCACHE: return "SQLITE_LOCKED_SHAREDCACHE";
case SQLITE_LOCKED_VTAB: return "SQLITE_LOCKED_VTAB";
case SQLITE_BUSY_RECOVERY: return "SQLITE_BUSY_RECOVERY";
case SQLITE_BUSY_SNAPSHOT: return "SQLITE_BUSY_SNAPSHOT";
case SQLITE_CANTOPEN_NOTEMPDIR: return "SQLITE_CANTOPEN_NOTEMPDIR";
case SQLITE_CANTOPEN_ISDIR: return "SQLITE_CANTOPEN_ISDIR";
case SQLITE_CANTOPEN_FULLPATH: return "SQLITE_CANTOPEN_FULLPATH";
case SQLITE_CANTOPEN_CONVPATH: return "SQLITE_CANTOPEN_CONVPATH";
case SQLITE_CORRUPT_VTAB: return "SQLITE_CORRUPT_VTAB";
case SQLITE_CORRUPT_SEQUENCE: return "SQLITE_CORRUPT_SEQUENCE";
case SQLITE_READONLY_RECOVERY: return "SQLITE_READONLY_RECOVERY";
case SQLITE_READONLY_CANTLOCK: return "SQLITE_READONLY_CANTLOCK";
case SQLITE_READONLY_ROLLBACK: return "SQLITE_READONLY_ROLLBACK";
case SQLITE_READONLY_DBMOVED: return "SQLITE_READONLY_DBMOVED";
case SQLITE_READONLY_CANTINIT: return "SQLITE_READONLY_CANTINIT";
case SQLITE_READONLY_DIRECTORY: return "SQLITE_READONLY_DIRECTORY";
case SQLITE_ABORT_ROLLBACK: return "SQLITE_ABORT_ROLLBACK";
case SQLITE_CONSTRAINT_CHECK: return "SQLITE_CONSTRAINT_CHECK";
case SQLITE_CONSTRAINT_COMMITHOOK: return "SQLITE_CONSTRAINT_COMMITHOOK";
case SQLITE_CONSTRAINT_FOREIGNKEY: return "SQLITE_CONSTRAINT_FOREIGNKEY";
case SQLITE_CONSTRAINT_FUNCTION: return "SQLITE_CONSTRAINT_FUNCTION";
case SQLITE_CONSTRAINT_NOTNULL: return "SQLITE_CONSTRAINT_NOTNULL";
case SQLITE_CONSTRAINT_PRIMARYKEY: return "SQLITE_CONSTRAINT_PRIMARYKEY";
case SQLITE_CONSTRAINT_TRIGGER: return "SQLITE_CONSTRAINT_TRIGGER";
case SQLITE_CONSTRAINT_UNIQUE: return "SQLITE_CONSTRAINT_UNIQUE";
case SQLITE_CONSTRAINT_VTAB: return "SQLITE_CONSTRAINT_VTAB";
case SQLITE_CONSTRAINT_ROWID: return "SQLITE_CONSTRAINT_ROWID";
case SQLITE_NOTICE_RECOVER_WAL: return "SQLITE_NOTICE_RECOVER_WAL";
case SQLITE_NOTICE_RECOVER_ROLLBACK: return "SQLITE_NOTICE_RECOVER_ROLLBACK";
case SQLITE_WARNING_AUTOINDEX: return "SQLITE_WARNING_AUTOINDEX";
case SQLITE_AUTH_USER: return "SQLITE_AUTH_USER";
case SQLITE_OK_LOAD_PERMANENTLY: return "SQLITE_OK_LOAD_PERMANENTLY";

default: return "UNKNOWN";
}
}

Expand Down
Loading

0 comments on commit 59a82b2

Please sign in to comment.