-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlite: support db.loadExtension
#53900
Conversation
Found another small issue: nodejs/core-validate-commit#122 |
Duplicate of nodejs/core-validate-commit#121 |
I will re start this PR |
edb5f58
to
8e80ca7
Compare
sqlite3.loadExtension
sqlite3.loadExtension
8e80ca7
to
200e60b
Compare
sqlite3.loadExtension
sqlite.loadExtension
sqlite.loadExtension
db.loadExtension
141f72c
to
10faf88
Compare
8b1dba0
to
67fe19a
Compare
I have no idea how to write a test for load extension now. |
/cc @nodejs/sqlite (no such group?) anyway I cc @nodejs/tsc since this is a breaking change |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #53900 +/- ##
==========================================
+ Coverage 87.99% 88.52% +0.53%
==========================================
Files 656 657 +1
Lines 188999 189929 +930
Branches 35981 36472 +491
==========================================
+ Hits 166301 168133 +1832
+ Misses 15865 14992 -873
+ Partials 6833 6804 -29
|
cc @cjihrig |
I took a quick look at the code. I'm not sure what makes this a breaking change though. I do think the TSC needs to decide if they want to support loading arbitrary native code in this manner. It wouldn't be the first way that Node supports loading native code, so maybe it's fine.
Is it possible to create a very trivial extension that can be accessed as a test fixture? |
It definitely must be disabled when the experimental permission model is enabled, just like native add-ons etc. |
For the native test, I'm not sure if we should build an SQLite binding from scratch or if we should just copy some community dll/so/lib to fixtures. |
We also need a test that tries to load an unexpected file (that is not a sqlite extension). It should throw, not crash the process. |
c01c585
to
1bf194b
Compare
IMO we should build from scratch to avoid any potential attack and make update tests fixture easier if we ever need to update them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
FYI - I think |
6ee1209
to
50715ef
Compare
not sure how to fix it right now. setting up local env on my local windows pc |
ok the error is legitimately falling, testing on my windows locally, I think because wrong usage of the cp api |
50715ef
to
08280ba
Compare
OK, I found because |
will merge this today |
PR-URL: #53900 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Landed in 5c2f599 |
Closes #53898
This PR will implement
loadExtension
API to align with other SQLite3 JS library likebetter-sqlite3
,node-sqlite3
,jsr:@db/sqlite
,bun:sqlite
Example Code: