@zowe/db2-for-zowe-cli 6.1.17 → 6.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/lib/Db2PluginLifeCycle.d.ts +11 -9
- package/lib/Db2PluginLifeCycle.js +18 -13
- package/lib/Db2PluginLifeCycle.js.map +1 -1
- package/node_modules/adm-zip/adm-zip.js +32 -6
- package/node_modules/adm-zip/headers/entryHeader.js +13 -1
- package/node_modules/adm-zip/methods/inflater.js +33 -3
- package/node_modules/adm-zip/package.json +2 -2
- package/node_modules/adm-zip/util/errors.js +3 -0
- package/node_modules/adm-zip/util/utils.js +102 -14
- package/node_modules/adm-zip/zipEntry.js +43 -18
- package/node_modules/adm-zip/zipFile.js +10 -0
- package/node_modules/axios/CHANGELOG.md +62 -0
- package/node_modules/axios/README.md +236 -73
- package/node_modules/axios/dist/axios.js +1308 -357
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +1443 -403
- package/node_modules/axios/dist/esm/axios.js +1443 -403
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +1483 -348
- package/node_modules/axios/index.d.cts +24 -1
- package/node_modules/axios/index.d.ts +22 -1
- package/node_modules/axios/lib/adapters/fetch.js +136 -30
- package/node_modules/axios/lib/adapters/http.js +277 -74
- package/node_modules/axios/lib/adapters/xhr.js +172 -16
- package/node_modules/axios/lib/core/Axios.js +87 -27
- package/node_modules/axios/lib/core/AxiosError.js +59 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +17 -4
- package/node_modules/axios/lib/core/InterceptorManager.js +118 -8
- package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
- package/node_modules/axios/lib/core/buildFullPath.js +1 -13
- package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +28 -2
- package/node_modules/axios/lib/core/mergeConfig.js +183 -120
- package/node_modules/axios/lib/core/methodList.js +17 -0
- package/node_modules/axios/lib/defaults/index.js +2 -1
- package/node_modules/axios/lib/defaults/transitional.js +1 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
- package/node_modules/axios/lib/helpers/Http2Sessions.js +4 -1
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +11 -1
- package/node_modules/axios/lib/helpers/composeSignals.js +6 -3
- package/node_modules/axios/lib/helpers/cookies.js +30 -6
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
- package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
- package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -1
- package/node_modules/axios/lib/helpers/fromDataURI.js +11 -4
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
- package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
- package/node_modules/axios/lib/helpers/parseHeaders.js +2 -1
- package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
- package/node_modules/axios/lib/helpers/progressEventReducer.js +1 -1
- package/node_modules/axios/lib/helpers/resolveConfig.js +20 -5
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +197 -6
- package/node_modules/axios/lib/helpers/throttle.js +3 -2
- package/node_modules/axios/lib/helpers/toFormData.js +14 -21
- package/node_modules/axios/lib/utils.js +192 -20
- package/node_modules/axios/package.json +1 -2
- package/node_modules/follow-redirects/README.md +27 -1
- package/node_modules/follow-redirects/index.js +11 -6
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/fs-extra/README.md +0 -1
- package/node_modules/fs-extra/lib/empty/index.js +4 -2
- package/node_modules/fs-extra/lib/util/stat.js +12 -2
- package/node_modules/fs-extra/package.json +1 -1
- package/node_modules/ibm_db/APIDocumentation.md +2883 -2024
- package/node_modules/ibm_db/LICENSE +23 -23
- package/node_modules/ibm_db/README.md +735 -735
- package/node_modules/ibm_db/binding.gyp +99 -98
- package/node_modules/ibm_db/installer/driverInstall.js +984 -958
- package/node_modules/ibm_db/installer/ifx.sh +38 -38
- package/node_modules/ibm_db/installer/setenv.sh +23 -23
- package/node_modules/ibm_db/installer/testODBCConnection.bat +51 -51
- package/node_modules/ibm_db/installer/testODBCConnection.sh +61 -61
- package/node_modules/ibm_db/lib/climacros.js +431 -431
- package/node_modules/ibm_db/lib/odbc.js +4293 -3487
- package/node_modules/ibm_db/lib/simple-queue.js +41 -41
- package/node_modules/ibm_db/package.json +70 -70
- package/node_modules/ibm_db/src/odbc.cpp +1495 -1396
- package/node_modules/ibm_db/src/odbc.h +477 -473
- package/node_modules/ibm_db/src/odbc_connection.cpp +1762 -1612
- package/node_modules/ibm_db/src/odbc_connection.h +228 -215
- package/node_modules/ibm_db/src/odbc_result.cpp +1547 -1547
- package/node_modules/ibm_db/src/odbc_result.h +152 -152
- package/node_modules/ibm_db/src/odbc_statement.cpp +2047 -861
- package/node_modules/ibm_db/src/odbc_statement.h +257 -135
- package/node_modules/ibm_db/src/strptime.c +389 -389
- package/node_modules/ibm_db/src/strptime.h +46 -46
- package/node_modules/ibm_db/test/README +23 -23
- package/node_modules/ibm_db/test/bench-insert.js +62 -62
- package/node_modules/ibm_db/test/bench-insertBatch10.js +74 -74
- package/node_modules/ibm_db/test/bench-insertBatch100.js +75 -75
- package/node_modules/ibm_db/test/bench-insertBatch1000.js +75 -75
- package/node_modules/ibm_db/test/bench-insertBatch10000.js +75 -75
- package/node_modules/ibm_db/test/bench-prepare-bind-execute-closeSync.js +60 -60
- package/node_modules/ibm_db/test/bench-prepare-bind-executeNonQuery.js +53 -53
- package/node_modules/ibm_db/test/bench-prepare-bindSync-execute-closeSync.js +50 -50
- package/node_modules/ibm_db/test/bench-prepare-bindSync-executeNonQuery.js +48 -48
- package/node_modules/ibm_db/test/bench-prepare-execute-closeSync.js +51 -51
- package/node_modules/ibm_db/test/bench-prepare-executeNonQuery.js +47 -47
- package/node_modules/ibm_db/test/bench-prepare-not.js +43 -43
- package/node_modules/ibm_db/test/bench-query-fetch.js +59 -59
- package/node_modules/ibm_db/test/bench-query-fetchAll.js +49 -49
- package/node_modules/ibm_db/test/bench-query-fetchAllSync.js +43 -43
- package/node_modules/ibm_db/test/bench-query.js +40 -40
- package/node_modules/ibm_db/test/bench-querySync-fetchArray.js +28 -28
- package/node_modules/ibm_db/test/bench-querySync.js +29 -29
- package/node_modules/ibm_db/test/common.d.ts +10 -10
- package/node_modules/ibm_db/test/common.js +127 -127
- package/node_modules/ibm_db/test/config.json +7 -7
- package/node_modules/ibm_db/test/config.zos.json +4 -4
- package/node_modules/ibm_db/test/data/sample1.txt +9 -9
- package/node_modules/ibm_db/test/data/trc.fmt +30114 -30114
- package/node_modules/ibm_db/test/nodeEE-leak-huge-query.js +152 -152
- package/node_modules/ibm_db/test/nodeEE-leak-multiple-query-multiple-connections.js +148 -148
- package/node_modules/ibm_db/test/nodeEE-leak-multiple-query-pool-connections.js +154 -154
- package/node_modules/ibm_db/test/nodeEE-leak-multiple-query.js +133 -133
- package/node_modules/ibm_db/test/nodeEE-stress-async-waterfall-multiple-connections.js +174 -174
- package/node_modules/ibm_db/test/nodeEE-stress-async-waterfall.js +169 -169
- package/node_modules/ibm_db/test/nodeEE-stress-mixed-query-multiple-connections.js +159 -159
- package/node_modules/ibm_db/test/nodeEE-stress-mixed-query.js +148 -148
- package/node_modules/ibm_db/test/odbc-bench.c +123 -123
- package/node_modules/ibm_db/test/perfTest.js +53 -53
- package/node_modules/ibm_db/test/quick-example.sh +30 -30
- package/node_modules/ibm_db/test/quick-example.ts +80 -80
- package/node_modules/ibm_db/test/run-bench.js +96 -96
- package/node_modules/ibm_db/test/run-nodeEE.js +132 -132
- package/node_modules/ibm_db/test/run-tests.js +132 -138
- package/node_modules/ibm_db/test/sql-cli.js +28 -28
- package/node_modules/ibm_db/test/test-all-data-types.js +109 -109
- package/node_modules/ibm_db/test/test-array-insert.js +178 -178
- package/node_modules/ibm_db/test/test-async-await.js +105 -105
- package/node_modules/ibm_db/test/test-attributes.js +34 -34
- package/node_modules/ibm_db/test/test-bad-pool-connection-prepare-execute.js +57 -57
- package/node_modules/ibm_db/test/test-basic-test.js +138 -138
- package/node_modules/ibm_db/test/test-binary-array-insert.js +73 -73
- package/node_modules/ibm_db/test/test-blob-from-file.js +90 -90
- package/node_modules/ibm_db/test/test-blob-insert.js +144 -144
- package/node_modules/ibm_db/test/test-blob-stream-insert.js +321 -299
- package/node_modules/ibm_db/test/test-blob-to-file.js +370 -370
- package/node_modules/ibm_db/test/test-block-fetch.js +364 -364
- package/node_modules/ibm_db/test/test-blocking-issue210.js +123 -123
- package/node_modules/ibm_db/test/test-call-async.js +64 -64
- package/node_modules/ibm_db/test/test-call-stmt.js +53 -53
- package/node_modules/ibm_db/test/test-cancel.js +703 -0
- package/node_modules/ibm_db/test/test-chinese-char.js +59 -59
- package/node_modules/ibm_db/test/test-connection.js +306 -0
- package/node_modules/ibm_db/test/test-date.js +32 -32
- package/node_modules/ibm_db/test/test-dbclob.js +93 -93
- package/node_modules/ibm_db/test/test-decimals.js +135 -135
- package/node_modules/ibm_db/test/test-describe-metadata.js +148 -0
- package/node_modules/ibm_db/test/test-executeFile.js +167 -167
- package/node_modules/ibm_db/test/test-executeFileSync.js +85 -85
- package/node_modules/ibm_db/test/test-fetch-apis.js +146 -146
- package/node_modules/ibm_db/test/test-fetchN.js +130 -130
- package/node_modules/ibm_db/test/test-getinfo.js +197 -197
- package/node_modules/ibm_db/test/test-ibm-db-issue14.js +58 -58
- package/node_modules/ibm_db/test/test-ibm-db-issue17.js +54 -54
- package/node_modules/ibm_db/test/test-ibm-db-issue18.js +54 -54
- package/node_modules/ibm_db/test/test-issue-1059-fetchAll-undefined.js +67 -67
- package/node_modules/ibm_db/test/test-issue-1080-array-blob-insert.js +40 -0
- package/node_modules/ibm_db/test/test-issue-54.js +39 -39
- package/node_modules/ibm_db/test/test-issue-get-column-value-2.js +44 -44
- package/node_modules/ibm_db/test/test-issue211.js +80 -80
- package/node_modules/ibm_db/test/test-issue253.js +39 -39
- package/node_modules/ibm_db/test/test-max-pool-size.js +96 -96
- package/node_modules/ibm_db/test/test-memory-leaks-new-objects.js +32 -32
- package/node_modules/ibm_db/test/test-multi-open-query-close.js +75 -75
- package/node_modules/ibm_db/test/test-param-put-data.js +713 -0
- package/node_modules/ibm_db/test/test-pool-idle-connection.js +72 -72
- package/node_modules/ibm_db/test/test-pool-operations.js +325 -0
- package/node_modules/ibm_db/test/test-pool-stale-connections.js +111 -111
- package/node_modules/ibm_db/test/test-pool-uncommited.js +33 -33
- package/node_modules/ibm_db/test/test-prepare-execute.js +339 -0
- package/node_modules/ibm_db/test/test-prepareSync-multiple-execution.js +93 -93
- package/node_modules/ibm_db/test/test-primary-foreign-keys.js +246 -0
- package/node_modules/ibm_db/test/test-procedures.js +243 -0
- package/node_modules/ibm_db/test/test-promise-all-data-types.js +42 -42
- package/node_modules/ibm_db/test/test-query-operations.js +405 -0
- package/node_modules/ibm_db/test/test-quick-example.js +25 -25
- package/node_modules/ibm_db/test/test-row-array-insert.js +167 -167
- package/node_modules/ibm_db/test/test-sp-array.js +54 -54
- package/node_modules/ibm_db/test/test-sp-dbc-6000.js +88 -88
- package/node_modules/ibm_db/test/test-sp-memleak.js +136 -136
- package/node_modules/ibm_db/test/test-sp-resultset-execute.js +269 -269
- package/node_modules/ibm_db/test/test-sp-resultset.js +228 -228
- package/node_modules/ibm_db/test/test-transactions.js +261 -0
- package/node_modules/ibm_db/test/test-typescript.js +48 -48
- package/node_modules/ibm_db/test/test-xml-datatype.js +70 -70
- package/node_modules/ibm_db/test/testWebApp.js +56 -56
- package/node_modules/ibm_db/test/trace +51 -51
- package/node_modules/ibm_db/test/typescript-apis-test.js +978 -978
- package/node_modules/ibm_db/test/webapp.html +17 -17
- package/node_modules/ibm_db/test/webapp.js +79 -79
- package/node_modules/ibm_db/typescript/README.md +28 -28
- package/node_modules/ibm_db/typescript/dist/Database.d.ts +26 -0
- package/node_modules/ibm_db/typescript/dist/ODBCStatement.d.ts +93 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.js +62 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/package.json +37 -0
- package/node_modules/which-typed-array/CHANGELOG.md +14 -0
- package/node_modules/which-typed-array/README.md +0 -2
- package/node_modules/which-typed-array/index.d.ts +288 -11
- package/node_modules/which-typed-array/index.js +6 -7
- package/node_modules/which-typed-array/package.json +12 -11
- package/package.json +10 -11
- package/node_modules/ibm_db/test/disabled/test-binding-statement-rebinding.js +0 -59
- package/node_modules/ibm_db/test/disabled/test-open-dont-close.js +0 -12
- package/node_modules/ibm_db/test/disabled/test-param-select-with-booleans-only.js +0 -21
- package/node_modules/ibm_db/test/disabled/test-param-select-with-decimals-only.js +0 -20
- package/node_modules/ibm_db/test/disabled/test-param-select-with-null.js +0 -21
- package/node_modules/ibm_db/test/disabled/test-param-select-with-nulls-mixed.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-param-select-with-numbers-mixed.js +0 -22
- package/node_modules/ibm_db/test/disabled/test-param-select-with-numbers-only.js +0 -24
- package/node_modules/ibm_db/test/disabled/test-param-select-with-strings-only.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-param-select-with-unicode.js +0 -15
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-closeSync.js +0 -62
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-error.js +0 -49
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-long-string.js +0 -63
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-executeNonQuery.js +0 -63
- package/node_modules/ibm_db/test/disabled/test-prepare-bindSync-execute-closeSync.js +0 -46
- package/node_modules/ibm_db/test/disabled/test-prepare-bindSync-executeNonQuery.js +0 -50
- package/node_modules/ibm_db/test/disabled/test-prepare.js +0 -34
- package/node_modules/ibm_db/test/disabled/test-prepareSync.js +0 -29
- package/node_modules/ibm_db/test/disabled/test-query-select-fetchAll.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-query-select-fetchAllSync.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-query-select-unicode.js +0 -15
- package/node_modules/ibm_db/test/disabled/test-querySync-select-unicode.js +0 -20
- package/node_modules/ibm_db/test/test-affected-rows.js +0 -55
- package/node_modules/ibm_db/test/test-bad-connection-string.js +0 -30
- package/node_modules/ibm_db/test/test-binding-connection-timeOut.js +0 -31
- package/node_modules/ibm_db/test/test-binding-statement-executeSync.js +0 -84
- package/node_modules/ibm_db/test/test-binding-transaction-commit.js +0 -79
- package/node_modules/ibm_db/test/test-binding-transaction-commitSync.js +0 -53
- package/node_modules/ibm_db/test/test-closed.js +0 -14
- package/node_modules/ibm_db/test/test-connection-object.js +0 -16
- package/node_modules/ibm_db/test/test-describe-column.js +0 -92
- package/node_modules/ibm_db/test/test-describe-database.js +0 -18
- package/node_modules/ibm_db/test/test-describe-table.js +0 -31
- package/node_modules/ibm_db/test/test-domains-open.js +0 -19
- package/node_modules/ibm_db/test/test-global-open-close.js +0 -11
- package/node_modules/ibm_db/test/test-instantiate-one-and-end.js +0 -9
- package/node_modules/ibm_db/test/test-multi-open-close.js +0 -45
- package/node_modules/ibm_db/test/test-multi-openSync-closeSync.js +0 -52
- package/node_modules/ibm_db/test/test-open-close.js +0 -29
- package/node_modules/ibm_db/test/test-open-connectTimeout.js +0 -33
- package/node_modules/ibm_db/test/test-openSync.js +0 -31
- package/node_modules/ibm_db/test/test-pool-close.js +0 -120
- package/node_modules/ibm_db/test/test-pool-connect.js +0 -36
- package/node_modules/ibm_db/test/test-pool-rollbackTransaction.js +0 -35
- package/node_modules/ibm_db/test/test-prepareSync-bad-sql.js +0 -34
- package/node_modules/ibm_db/test/test-promise-open-close.js +0 -33
- package/node_modules/ibm_db/test/test-query-create-table-fetchSync.js +0 -23
- package/node_modules/ibm_db/test/test-query-create-table.js +0 -12
- package/node_modules/ibm_db/test/test-query-drop-table.js +0 -13
- package/node_modules/ibm_db/test/test-query-insert.js +0 -38
- package/node_modules/ibm_db/test/test-query-select-fetch.js +0 -21
- package/node_modules/ibm_db/test/test-query-select-fetchMode-array.js +0 -17
- package/node_modules/ibm_db/test/test-query-select.js +0 -64
- package/node_modules/ibm_db/test/test-queryResult.js +0 -35
- package/node_modules/ibm_db/test/test-queryStream.js +0 -43
- package/node_modules/ibm_db/test/test-querySync-select-with-exception.js +0 -25
- package/node_modules/ibm_db/test/test-querySync-select.js +0 -28
- package/node_modules/ibm_db/test/test-require-and-end.js +0 -8
- package/node_modules/ibm_db/test/test-statement-close.js +0 -118
- package/node_modules/ibm_db/test/test-transaction-commit-sync.js +0 -54
- package/node_modules/ibm_db/test/test-transaction-commit.js +0 -79
- package/node_modules/which-typed-array/eslint.config.mjs +0 -12
- package/node_modules/which-typed-array/test/index.js +0 -105
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/LICENSE +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/README.md +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/chownr.js +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/package.json +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/.travis.yml +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/LICENSE +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/README.md +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/lib/string_decoder.js +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/package.json +0 -0
package/README.md
CHANGED
|
@@ -25,19 +25,21 @@ Before you install and use the plug-in:
|
|
|
25
25
|
|
|
26
26
|
- [Install Zowe CLI](https://docs.zowe.org/stable/user-guide/cli-installcli.html) on your computer.
|
|
27
27
|
|
|
28
|
+
- Use Node.js 22 or newer. CI covers Node.js 22, 24, and 26.
|
|
29
|
+
|
|
28
30
|
- Have a license file for IBM Db2 Database for z/OS.
|
|
29
31
|
|
|
30
32
|
For connectivity to Db2 for z/OS, the Db2 region should be `db2connectactivated` or a `db2connect` license file should be provided. Copy the `db2connect` license file to the `[db2 plugin folder]/node_modules/ibm_db/installer/clidriver/license/` folder. For more information, see [Addressing the license requirement](https://docs.zowe.org/stable/user-guide/cli-db2plugin.html#addressing-the-license-requirement) on the Zowe Docs site.
|
|
31
33
|
|
|
32
|
-
- **(Linux and MacOS only)** Download and install [node-gyp](https://www.npmjs.com/package/node-gyp) globally by running `npm install -g node-gyp`
|
|
34
|
+
- **(Linux and MacOS source builds only)** Download and install [node-gyp](https://www.npmjs.com/package/node-gyp) globally by running `npm install -g node-gyp`
|
|
33
35
|
|
|
34
|
-
- **(MacOS only)** Download and Install [Xcode](https://developer.apple.com/xcode/resources/) and [Python 3](https://www.python.org/downloads/mac-osx/).
|
|
36
|
+
- **(MacOS source builds only)** Download and Install [Xcode](https://developer.apple.com/xcode/resources/) and [Python 3](https://www.python.org/downloads/mac-osx/).
|
|
35
37
|
|
|
36
|
-
- **(Linux only - Debian, Ubuntu)** Download and Install the following via apt: `python3 make g++`
|
|
38
|
+
- **(Linux source builds only - Debian, Ubuntu)** Download and Install the following via apt: `python3 make g++`
|
|
37
39
|
|
|
38
|
-
- **(Linux only - CentOS, RHEL)** Download and Install the following via yum: `python3 make gcc-c++`
|
|
40
|
+
- **(Linux source builds only - CentOS, RHEL)** Download and Install the following via yum: `python3 make gcc-c++`
|
|
39
41
|
|
|
40
|
-
-
|
|
42
|
+
- The plug-in bundles `ibm_db` 4, which uses [Node-API](https://github.com/ibmdb/node-ibm_db/tree/v4.0.1#prerequisite) instead of NAN. Its native binding does not need to be rebuilt solely because you upgrade to a newer compatible Node.js version on the same operating system and architecture. The native binding and IBM Db2 ODBC CLI driver must still be installed; see [The `ibm_db` module is not installed](#the-ibm_db-module-is-not-installed) if installation is incomplete. Precompiled bindings are available for supported Windows, Linux, and MacOS platforms when source compilation is unavailable.
|
|
41
43
|
|
|
42
44
|
## Installing
|
|
43
45
|
|
|
@@ -171,9 +173,9 @@ IBM® Db2® Plug-in for Zowe CLI was installed, but its required 'ibm_db' module
|
|
|
171
173
|
Db2 commands will fail until the installation of 'ibm_db' is completed.
|
|
172
174
|
```
|
|
173
175
|
|
|
174
|
-
The
|
|
176
|
+
The IBM Db2 Plug-in for Zowe CLI is installed and registered with Zowe CLI when this failure occurs. Only the `ibm_db` module is incomplete, so you do not need to reinstall the plug-in.
|
|
175
177
|
|
|
176
|
-
**Cause**: The plug-in delivers `ibm_db` as a bundled dependency, so that the plug-in can be installed without access to a public npm registry. However, `ibm_db` is a native module. Its own npm install script must download the IBM Db2 ODBC CLI driver and
|
|
178
|
+
**Cause**: The plug-in delivers `ibm_db` as a bundled dependency, so that the plug-in can be installed without access to a public npm registry. However, `ibm_db` is a native module. Its own npm install script must download the IBM Db2 ODBC CLI driver and install the binding for your platform, either by compiling it or using a precompiled binary. npm does not run the lifecycle scripts of a bundled dependency, so that install script does not run when the plug-in is installed. The `--allow-scripts` option of the `zowe plugins install` command does not change that behavior, because npm skips the scripts of bundled dependencies even when scripts are allowed.
|
|
177
179
|
|
|
178
180
|
**Action**: Run the `ibm_db` install script yourself. The error message contains the full path to the `ibm_db` directory on your system, which is normally the following path:
|
|
179
181
|
|
|
@@ -181,7 +183,7 @@ The plug-in itself is installed and registered with Zowe CLI when this failure o
|
|
|
181
183
|
<zowe home>/plugins/installed/node_modules/@zowe/db2-for-zowe-cli/node_modules/ibm_db
|
|
182
184
|
```
|
|
183
185
|
|
|
184
|
-
Change to that directory and run
|
|
186
|
+
Change to that directory and run the `ibm_db` install script:
|
|
185
187
|
|
|
186
188
|
```bash
|
|
187
189
|
cd "<zowe home>/plugins/installed/node_modules/@zowe/db2-for-zowe-cli/node_modules/ibm_db"
|
|
@@ -192,14 +194,14 @@ If npm is not available, run the same script directly with `node installer/drive
|
|
|
192
194
|
|
|
193
195
|
The script downloads the CLI driver from `https://public.dhe.ibm.com`, so the system needs network access to that site. If the system already has a Db2 client, a Db2 server, or a copy of the CLI driver, set the `IBM_DB_HOME` environment variable to that directory before you run the script to skip the download. For more `ibm_db` installation options, see the `README.md` file in the `ibm_db` directory.
|
|
194
196
|
|
|
195
|
-
###
|
|
197
|
+
### Native binary from an older plug-in installation
|
|
196
198
|
|
|
197
199
|
**Error message**:
|
|
198
200
|
```
|
|
199
201
|
The module 'C:\Users\User\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\build\Release\odbc_bindings.node' was compiled against a different Node.js version using NODE_MODULE_VERSION ###. This version of Node.js requires NODE_MODULE_VERSION ###. Please try re-compiling or re-installing this module (for instance, using npm rebuild or npm install).
|
|
200
202
|
```
|
|
201
203
|
|
|
202
|
-
**Action**:
|
|
204
|
+
**Action**: Upgrade or reinstall the IBM Db2 Database Plug-in for Zowe CLI to replace the old native binary with the bundled `ibm_db` 4 binding. This error can occur with an older `ibm_db` 3 binding compiled for a different Node.js major version. `ibm_db` 4 uses Node-API, so changing between compatible Node.js versions on the same operating system and architecture does not require rebuilding the binding. If the updated module cannot be loaded, follow [The `ibm_db` module is not installed](#the-ibm_db-module-is-not-installed).
|
|
203
205
|
|
|
204
206
|
## Contributing
|
|
205
207
|
|
|
@@ -20,14 +20,6 @@ declare class Db2PluginLifeCycle extends AbstractPluginLifeCycle {
|
|
|
20
20
|
* @memberof Db2PluginLifeCycle
|
|
21
21
|
*/
|
|
22
22
|
static readonly NATIVE_MODULE_NM: string;
|
|
23
|
-
/**
|
|
24
|
-
* A horizontal rule used to make the reported steps stand out among the
|
|
25
|
-
* other messages that are displayed while a plug-in is installed.
|
|
26
|
-
* @type {string}
|
|
27
|
-
* @static
|
|
28
|
-
* @memberof Db2PluginLifeCycle
|
|
29
|
-
*/
|
|
30
|
-
private static readonly DIVIDER;
|
|
31
23
|
/**
|
|
32
24
|
* Confirm that the bundled native module can be loaded after the plug-in
|
|
33
25
|
* has been installed. When it cannot be loaded, report the steps that the
|
|
@@ -51,7 +43,7 @@ declare class Db2PluginLifeCycle extends AbstractPluginLifeCycle {
|
|
|
51
43
|
*
|
|
52
44
|
* @private
|
|
53
45
|
* @static
|
|
54
|
-
* @throws
|
|
46
|
+
* @throws If the native module is missing or installation is incomplete.
|
|
55
47
|
* @memberof Db2PluginLifeCycle
|
|
56
48
|
*/
|
|
57
49
|
private static loadNativeModule;
|
|
@@ -76,5 +68,15 @@ declare class Db2PluginLifeCycle extends AbstractPluginLifeCycle {
|
|
|
76
68
|
* @memberof Db2PluginLifeCycle
|
|
77
69
|
*/
|
|
78
70
|
private static findNativeModuleDir;
|
|
71
|
+
/**
|
|
72
|
+
* A horizontal rule used to make the reported steps stand out among the
|
|
73
|
+
* other messages that are displayed while a plug-in is installed.
|
|
74
|
+
*
|
|
75
|
+
* @private
|
|
76
|
+
* @static
|
|
77
|
+
* @returns {string}
|
|
78
|
+
* @memberof Db2PluginLifeCycle
|
|
79
|
+
*/
|
|
80
|
+
private static get dividerLine();
|
|
79
81
|
}
|
|
80
82
|
export = Db2PluginLifeCycle;
|
|
@@ -37,7 +37,6 @@ class Db2PluginLifeCycle extends imperative_1.AbstractPluginLifeCycle {
|
|
|
37
37
|
* @memberof Db2PluginLifeCycle
|
|
38
38
|
*/
|
|
39
39
|
postInstall() {
|
|
40
|
-
var _a;
|
|
41
40
|
const impLogger = imperative_1.Logger.getImperativeLogger();
|
|
42
41
|
try {
|
|
43
42
|
Db2PluginLifeCycle.loadNativeModule();
|
|
@@ -45,7 +44,7 @@ class Db2PluginLifeCycle extends imperative_1.AbstractPluginLifeCycle {
|
|
|
45
44
|
`after the installation of ${Constants_1.Constants.DISPLAY_NAME}.`);
|
|
46
45
|
}
|
|
47
46
|
catch (err) {
|
|
48
|
-
const warningMsg = Db2PluginLifeCycle.formIncompleteInstallMsg(
|
|
47
|
+
const warningMsg = Db2PluginLifeCycle.formIncompleteInstallMsg(err instanceof Error ? err.message : String(err));
|
|
49
48
|
impLogger.warn(warningMsg);
|
|
50
49
|
throw new imperative_1.ImperativeError({ msg: warningMsg });
|
|
51
50
|
}
|
|
@@ -64,7 +63,7 @@ class Db2PluginLifeCycle extends imperative_1.AbstractPluginLifeCycle {
|
|
|
64
63
|
*
|
|
65
64
|
* @private
|
|
66
65
|
* @static
|
|
67
|
-
* @throws
|
|
66
|
+
* @throws If the native module is missing or installation is incomplete.
|
|
68
67
|
* @memberof Db2PluginLifeCycle
|
|
69
68
|
*/
|
|
70
69
|
static loadNativeModule() {
|
|
@@ -83,7 +82,7 @@ class Db2PluginLifeCycle extends imperative_1.AbstractPluginLifeCycle {
|
|
|
83
82
|
static formIncompleteInstallMsg(reason) {
|
|
84
83
|
const nativeMod = Db2PluginLifeCycle.NATIVE_MODULE_NM;
|
|
85
84
|
const nativeModDir = Db2PluginLifeCycle.findNativeModuleDir();
|
|
86
|
-
return `\n${Db2PluginLifeCycle.
|
|
85
|
+
return `\n${Db2PluginLifeCycle.dividerLine}\n` +
|
|
87
86
|
`${Constants_1.Constants.DISPLAY_NAME} was installed, but its required '${nativeMod}' module could not be loaded.\n` +
|
|
88
87
|
`Db2 commands will fail until the installation of '${nativeMod}' is completed.\n` +
|
|
89
88
|
`\n` +
|
|
@@ -110,7 +109,7 @@ class Db2PluginLifeCycle extends imperative_1.AbstractPluginLifeCycle {
|
|
|
110
109
|
`skip the download.\n` +
|
|
111
110
|
`\n` +
|
|
112
111
|
`See ${path.join(nativeModDir, "README.md")} for more '${nativeMod}' installation options.\n` +
|
|
113
|
-
`${Db2PluginLifeCycle.
|
|
112
|
+
`${Db2PluginLifeCycle.dividerLine}\n`;
|
|
114
113
|
}
|
|
115
114
|
/**
|
|
116
115
|
* Find the directory into which the native module was installed, so that
|
|
@@ -134,6 +133,20 @@ class Db2PluginLifeCycle extends imperative_1.AbstractPluginLifeCycle {
|
|
|
134
133
|
return path.resolve(__dirname, "..", "node_modules", nativeMod);
|
|
135
134
|
}
|
|
136
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* A horizontal rule used to make the reported steps stand out among the
|
|
138
|
+
* other messages that are displayed while a plug-in is installed.
|
|
139
|
+
*
|
|
140
|
+
* @private
|
|
141
|
+
* @static
|
|
142
|
+
* @returns {string}
|
|
143
|
+
* @memberof Db2PluginLifeCycle
|
|
144
|
+
*/
|
|
145
|
+
static get dividerLine() {
|
|
146
|
+
var _a;
|
|
147
|
+
const defaultWidth = 100;
|
|
148
|
+
return "_".repeat(Math.min(((_a = process.stdout) === null || _a === void 0 ? void 0 : _a.columns) || Infinity, defaultWidth));
|
|
149
|
+
}
|
|
137
150
|
}
|
|
138
151
|
/**
|
|
139
152
|
* The name of the native module that Db2 commands require.
|
|
@@ -142,13 +155,5 @@ class Db2PluginLifeCycle extends imperative_1.AbstractPluginLifeCycle {
|
|
|
142
155
|
* @memberof Db2PluginLifeCycle
|
|
143
156
|
*/
|
|
144
157
|
Db2PluginLifeCycle.NATIVE_MODULE_NM = "ibm_db";
|
|
145
|
-
/**
|
|
146
|
-
* A horizontal rule used to make the reported steps stand out among the
|
|
147
|
-
* other messages that are displayed while a plug-in is installed.
|
|
148
|
-
* @type {string}
|
|
149
|
-
* @static
|
|
150
|
-
* @memberof Db2PluginLifeCycle
|
|
151
|
-
*/
|
|
152
|
-
Db2PluginLifeCycle.DIVIDER = "____________________________________________________________________________________________________";
|
|
153
158
|
module.exports = Db2PluginLifeCycle;
|
|
154
159
|
//# sourceMappingURL=Db2PluginLifeCycle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Db2PluginLifeCycle.js","sourceRoot":"","sources":["../src/Db2PluginLifeCycle.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;AAEF,6BAA6B;AAC7B,iDAAoF;AACpF,2CAAwC;AAExC;;;;;;;;;;;;GAYG;AACH,MAAM,kBAAmB,SAAQ,oCAAuB;
|
|
1
|
+
{"version":3,"file":"Db2PluginLifeCycle.js","sourceRoot":"","sources":["../src/Db2PluginLifeCycle.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;AAEF,6BAA6B;AAC7B,iDAAoF;AACpF,2CAAwC;AAExC;;;;;;;;;;;;GAYG;AACH,MAAM,kBAAmB,SAAQ,oCAAuB;IASpD;;;;;;;;;OASG;IACI,WAAW;QACd,MAAM,SAAS,GAAG,mBAAM,CAAC,mBAAmB,EAAE,CAAC;QAC/C,IAAI,CAAC;YACD,kBAAkB,CAAC,gBAAgB,EAAE,CAAC;YACtC,SAAS,CAAC,KAAK,CAAC,QAAQ,kBAAkB,CAAC,gBAAgB,mCAAmC;gBAC1F,6BAA6B,qBAAS,CAAC,YAAY,GAAG,CACzD,CAAC;QACN,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,UAAU,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YACjH,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC3B,MAAM,IAAI,4BAAe,CAAC,EAAC,GAAG,EAAE,UAAU,EAAC,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,YAAY;QACf,gBAAgB;IACpB,CAAC;IAED;;;;;;;OAOG;IACK,MAAM,CAAC,gBAAgB;QAC3B,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;;OASG;IACK,MAAM,CAAC,wBAAwB,CAAC,MAAc;QAClD,MAAM,SAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;QACtD,MAAM,YAAY,GAAG,kBAAkB,CAAC,mBAAmB,EAAE,CAAC;QAE9D,OAAO,KAAK,kBAAkB,CAAC,WAAW,IAAI;YAC1C,GAAG,qBAAS,CAAC,YAAY,qCAAqC,SAAS,iCAAiC;YACxG,qDAAqD,SAAS,mBAAmB;YACjF,IAAI;YACJ,YAAY,MAAM,IAAI;YACtB,IAAI;YACJ,yBAAyB,SAAS,mEAAmE;YACrG,sDAAsD,SAAS,6CAA6C;YAC5G,sGAAsG;YACtG,qGAAqG;YACrG,oGAAoG;YACpG,gFAAgF;YAChF,IAAI;YACJ,iEAAiE;YACjE,IAAI;YACJ,WAAW,YAAY,KAAK;YAC5B,uBAAuB;YACvB,IAAI;YACJ,oEAAoE,SAAS,6BAA6B;YAC1G,sCAAsC;YACtC,IAAI;YACJ,oGAAoG;YACpG,oGAAoG;YACpG,mGAAmG;YACnG,sBAAsB;YACtB,IAAI;YACJ,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,cAAc,SAAS,2BAA2B;YAC7F,GAAG,kBAAkB,CAAC,WAAW,IAAI,CAAC;IAC9C,CAAC;IAED;;;;;;;;OAQG;IACK,MAAM,CAAC,mBAAmB;QAC9B,MAAM,SAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;QACtD,IAAI,CAAC;YACD;;eAEG;YACH,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,eAAe,CAAC,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,wEAAwE;YACxE,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;QACpE,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACK,MAAM,KAAK,WAAW;;QAC1B,MAAM,YAAY,GAAG,GAAG,CAAC;QACzB,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,OAAO,KAAI,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IACnF,CAAC;;AApID;;;;;GAKG;AACoB,mCAAgB,GAAW,QAAQ,CAAC;AAiI/D,iBAAS,kBAAkB,CAAC"}
|
|
@@ -498,7 +498,11 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
498
498
|
addLocalFolderAsync2: function (options, callback) {
|
|
499
499
|
const self = this;
|
|
500
500
|
options = typeof options === "object" ? options : { localPath: options };
|
|
501
|
-
|
|
501
|
+
// Resolve the local filesystem path with the platform resolver. Do NOT
|
|
502
|
+
// run it through fixPath: that normalizes ZIP-internal paths to POSIX
|
|
503
|
+
// and prepends "/", which turns a Windows path like C:\dir into
|
|
504
|
+
// \C:\dir, so readdir finds nothing and the archive comes out empty.
|
|
505
|
+
const localPath = pth.resolve(options.localPath);
|
|
502
506
|
let { zipPath, filter, namefix } = options;
|
|
503
507
|
|
|
504
508
|
if (filter instanceof RegExp) {
|
|
@@ -533,14 +537,21 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
533
537
|
|
|
534
538
|
filetools.fs.open(localPath, "r", function (err) {
|
|
535
539
|
if (err && err.code === "ENOENT") {
|
|
536
|
-
callback(
|
|
540
|
+
// callback is (err, done); errors belong in the first argument,
|
|
541
|
+
// otherwise addLocalFolderPromise treats the error as "done" and
|
|
542
|
+
// resolves instead of rejecting.
|
|
543
|
+
callback(Utils.Errors.FILE_NOT_FOUND(localPath), false);
|
|
537
544
|
} else if (err) {
|
|
538
|
-
callback(
|
|
545
|
+
callback(err, false);
|
|
539
546
|
} else {
|
|
540
547
|
filetools.findFilesAsync(localPath, function (err, fileEntries) {
|
|
541
|
-
if (err) return callback(err);
|
|
548
|
+
if (err) return callback(err, false);
|
|
542
549
|
fileEntries = fileEntries.filter((dir) => filter(relPathFix(dir)));
|
|
543
|
-
|
|
550
|
+
// Nothing to add (empty folder or everything filtered out) is a
|
|
551
|
+
// success, not an error. Report done and stop, otherwise the
|
|
552
|
+
// reduce below runs and the callback fires a second time -- and
|
|
553
|
+
// signalling done=false left addLocalFolderPromise hanging.
|
|
554
|
+
if (!fileEntries.length) return callback(undefined, true);
|
|
544
555
|
|
|
545
556
|
setImmediate(
|
|
546
557
|
fileEntries.reverse().reduce(function (next, entry) {
|
|
@@ -575,7 +586,7 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
575
586
|
addLocalFolderPromise: function (localPath, props) {
|
|
576
587
|
return new Promise((resolve, reject) => {
|
|
577
588
|
this.addLocalFolderAsync2(Object.assign({ localPath }, props), (err, done) => {
|
|
578
|
-
if (err) reject(err);
|
|
589
|
+
if (err) return reject(err);
|
|
579
590
|
if (done) resolve(this);
|
|
580
591
|
});
|
|
581
592
|
});
|
|
@@ -709,6 +720,8 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
709
720
|
// collapsed subdirectories together (issue #306).
|
|
710
721
|
var name = canonical(maintainEntryPath ? child.entryName : child.entryName.substring(item.entryName.length));
|
|
711
722
|
var childName = sanitize(targetPath, name);
|
|
723
|
+
// reject writing through a pre-existing symlink inside the target
|
|
724
|
+
filetools.assertPathSafe(targetPath, childName);
|
|
712
725
|
// The reverse operation for attr depend on method addFile()
|
|
713
726
|
const fileAttr = keepOriginalPermission ? child.header.fileAttr : undefined;
|
|
714
727
|
filetools.writeFileTo(childName, content, overwrite, fileAttr);
|
|
@@ -719,6 +732,9 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
719
732
|
var content = item.getData(_zip.password);
|
|
720
733
|
if (!content) throw Utils.Errors.CANT_EXTRACT_FILE();
|
|
721
734
|
|
|
735
|
+
// reject writing through a pre-existing symlink inside the target
|
|
736
|
+
filetools.assertPathSafe(targetPath, target);
|
|
737
|
+
|
|
722
738
|
if (filetools.fs.existsSync(target) && !overwrite) {
|
|
723
739
|
throw Utils.Errors.CANT_OVERRIDE();
|
|
724
740
|
}
|
|
@@ -775,6 +791,8 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
775
791
|
const dirEntries = [];
|
|
776
792
|
_zip.entries.forEach(function (entry) {
|
|
777
793
|
var entryName = sanitize(targetPath, canonical(entry.entryName));
|
|
794
|
+
// reject writing through a pre-existing symlink inside the target
|
|
795
|
+
filetools.assertPathSafe(targetPath, entryName);
|
|
778
796
|
if (entry.isDirectory) {
|
|
779
797
|
filetools.makeDir(entryName);
|
|
780
798
|
// defer restoring the directory permission until its files are written
|
|
@@ -854,6 +872,8 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
854
872
|
// The reverse operation for attr depend on method addFile()
|
|
855
873
|
const dirAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
|
|
856
874
|
try {
|
|
875
|
+
// reject writing through a pre-existing symlink inside the target
|
|
876
|
+
filetools.assertPathSafe(targetPath, dirPath);
|
|
857
877
|
filetools.makeDir(dirPath);
|
|
858
878
|
} catch (er) {
|
|
859
879
|
callback(getError("Unable to create folder", dirPath));
|
|
@@ -890,6 +910,12 @@ module.exports = function (/**String*/ input, /** object */ options) {
|
|
|
890
910
|
} else {
|
|
891
911
|
const entryName = pth.normalize(canonical(entry.entryName));
|
|
892
912
|
const filePath = sanitize(targetPath, entryName);
|
|
913
|
+
try {
|
|
914
|
+
// reject writing through a pre-existing symlink inside the target
|
|
915
|
+
filetools.assertPathSafe(targetPath, filePath);
|
|
916
|
+
} catch (er) {
|
|
917
|
+
return next(er);
|
|
918
|
+
}
|
|
893
919
|
entry.getDataAsync(function (content, err_1) {
|
|
894
920
|
if (err_1) {
|
|
895
921
|
next(err_1);
|
|
@@ -185,7 +185,12 @@ module.exports = function () {
|
|
|
185
185
|
|
|
186
186
|
// get Unix file permissions
|
|
187
187
|
get fileAttr() {
|
|
188
|
-
|
|
188
|
+
// Mask to the 9 rwxrwxrwx bits only. The setuid (0o4000), setgid
|
|
189
|
+
// (0o2000) and sticky (0o1000) bits are attacker-controlled archive
|
|
190
|
+
// metadata; preserving them on extraction (keepOriginalPermission)
|
|
191
|
+
// lets a crafted zip plant a setuid-root binary when extracting as
|
|
192
|
+
// root, a local privilege escalation (GHSA-679w-jf3m-wh39).
|
|
193
|
+
return ((_attr || 0) >> 16) & 0o777;
|
|
189
194
|
},
|
|
190
195
|
|
|
191
196
|
get offset() {
|
|
@@ -212,6 +217,13 @@ module.exports = function () {
|
|
|
212
217
|
},
|
|
213
218
|
|
|
214
219
|
loadLocalHeaderFromBinary: function (/*Buffer*/ input) {
|
|
220
|
+
// The LOC offset comes from the central directory and is attacker
|
|
221
|
+
// controlled. Reject one that would read past the end of the buffer,
|
|
222
|
+
// otherwise readUInt32LE below throws a raw RangeError instead of a
|
|
223
|
+
// clean INVALID_LOC (and escapes the async error path).
|
|
224
|
+
if (_offset < 0 || _offset + Constants.LOCHDR > input.length) {
|
|
225
|
+
throw Utils.Errors.INVALID_LOC();
|
|
226
|
+
}
|
|
215
227
|
var data = input.slice(_offset, _offset + Constants.LOCHDR);
|
|
216
228
|
// 30 bytes and should start with "PK\003\004"
|
|
217
229
|
if (data.readUInt32LE(0) !== Constants.LOCSIG) {
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
const version = +(process?.versions?.node ?? "").split(".")[0] || 0;
|
|
2
|
+
const Errors = require("../util/errors");
|
|
2
3
|
|
|
3
4
|
module.exports = function (/*Buffer*/ inbuf, /*number*/ expectedLength) {
|
|
4
5
|
var zlib = require("zlib");
|
|
5
|
-
|
|
6
|
+
// Cap decompression output at the entry's declared uncompressed size to bound
|
|
7
|
+
// decompression bombs (CVE-2026-39244). A declared size of 0 must not disable
|
|
8
|
+
// the cap: a genuinely empty entry inflates to 0 bytes, so a 1-byte floor
|
|
9
|
+
// still lets it through while stopping a bomb that lies about its size
|
|
10
|
+
// (GHSA-rcw4-f5rp-g42v). zlib requires maxOutputLength >= 1.
|
|
11
|
+
const maxOutputLength = expectedLength > 0 ? expectedLength : 1;
|
|
12
|
+
const option = version >= 15 ? { maxOutputLength } : {};
|
|
6
13
|
|
|
7
14
|
return {
|
|
8
15
|
inflate: function () {
|
|
@@ -12,12 +19,35 @@ module.exports = function (/*Buffer*/ inbuf, /*number*/ expectedLength) {
|
|
|
12
19
|
inflateAsync: function (/*Function*/ callback) {
|
|
13
20
|
var tmp = zlib.createInflateRaw(option),
|
|
14
21
|
parts = [],
|
|
15
|
-
total = 0
|
|
22
|
+
total = 0,
|
|
23
|
+
done = false;
|
|
24
|
+
const fail = function (err) {
|
|
25
|
+
if (done) return;
|
|
26
|
+
done = true;
|
|
27
|
+
tmp.destroy();
|
|
28
|
+
callback && callback(Buffer.alloc(0), err);
|
|
29
|
+
};
|
|
30
|
+
// Route stream errors (e.g. Z_DATA_ERROR on malformed input) through the
|
|
31
|
+
// callback. Without an "error" listener zlib re-throws the event as an
|
|
32
|
+
// uncaught exception on a later tick, crashing the host process instead
|
|
33
|
+
// of failing the call (GHSA-8238-w5pm-2374).
|
|
34
|
+
tmp.on("error", function (err) {
|
|
35
|
+
fail(err);
|
|
36
|
+
});
|
|
16
37
|
tmp.on("data", function (data) {
|
|
17
|
-
|
|
38
|
+
if (done) return;
|
|
18
39
|
total += data.length;
|
|
40
|
+
// The streaming API ignores maxOutputLength, so enforce the cap by
|
|
41
|
+
// hand; otherwise the async path decompresses without limit while the
|
|
42
|
+
// sync path is capped (GHSA-v429-h5qx-84wm, GHSA-c6fg-446q-cg94).
|
|
43
|
+
if (total > maxOutputLength) {
|
|
44
|
+
return fail(Errors.MAX_OUTPUT_EXCEEDED());
|
|
45
|
+
}
|
|
46
|
+
parts.push(data);
|
|
19
47
|
});
|
|
20
48
|
tmp.on("end", function () {
|
|
49
|
+
if (done) return;
|
|
50
|
+
done = true;
|
|
21
51
|
var buf = Buffer.alloc(total),
|
|
22
52
|
written = 0;
|
|
23
53
|
buf.fill(0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adm-zip",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Javascript implementation of zip for nodejs with support for electron original-fs. Allows user to create or extract zip files both in memory or to/from disk",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "mocha -R spec",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"chai": "^6.2.2",
|
|
51
51
|
"iconv-lite": "^0.7.2",
|
|
52
|
-
"mocha": "12.0.0
|
|
52
|
+
"mocha": "^12.0.0",
|
|
53
53
|
"prettier": "^3.8.1",
|
|
54
54
|
"rimraf": "^3.0.2"
|
|
55
55
|
}
|
|
@@ -12,6 +12,7 @@ const errors = {
|
|
|
12
12
|
/* ZipEntry error messages*/
|
|
13
13
|
NO_DATA: "Nothing to decompress",
|
|
14
14
|
BAD_CRC: "CRC32 checksum failed {0}",
|
|
15
|
+
MAX_OUTPUT_EXCEEDED: "Decompressed data exceeds the declared uncompressed size",
|
|
15
16
|
FILE_IN_THE_WAY: "There is a file in the way: {0}",
|
|
16
17
|
UNKNOWN_METHOD: "Invalid/unsupported compression method",
|
|
17
18
|
|
|
@@ -33,11 +34,13 @@ const errors = {
|
|
|
33
34
|
DISK_ENTRY_TOO_LARGE: "Number of disk entries is too large",
|
|
34
35
|
NO_ZIP: "No zip file was loaded",
|
|
35
36
|
NO_ENTRY: "Entry doesn't exist",
|
|
37
|
+
DUPLICATE_ENTRY: "Duplicate entry name {0}",
|
|
36
38
|
DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
|
|
37
39
|
FILE_NOT_FOUND: 'File not found: "{0}"',
|
|
38
40
|
NOT_IMPLEMENTED: "Not implemented",
|
|
39
41
|
INVALID_FILENAME: "Invalid filename",
|
|
40
42
|
INVALID_FORMAT: "Invalid or unsupported zip format. No END header found",
|
|
43
|
+
ZIP64_VALUE_TOO_LARGE: "Zip64 value exceeds the maximum safe integer",
|
|
41
44
|
INVALID_PASS_PARAM: "Incompatible password parameter",
|
|
42
45
|
WRONG_PASSWORD: "Wrong Password",
|
|
43
46
|
|
|
@@ -159,8 +159,59 @@ Utils.prototype.writeFileToAsync = function (/*String*/ path, /*Buffer*/ content
|
|
|
159
159
|
});
|
|
160
160
|
};
|
|
161
161
|
|
|
162
|
+
// Guard extraction against writing through a symlink that already exists inside
|
|
163
|
+
// the target directory. sanitize() only proves the textual path stays under the
|
|
164
|
+
// root; it cannot see that a component on disk is a symlink pointing elsewhere,
|
|
165
|
+
// so open()/mkdir() would follow it and write outside the root. Walk every path
|
|
166
|
+
// component strictly below root and reject any that is a symlink. Components at
|
|
167
|
+
// or above root are the caller's own choice and are left untouched, so a root
|
|
168
|
+
// that itself lives under a symlink (e.g. /tmp on macOS) still extracts.
|
|
169
|
+
Utils.prototype.assertPathSafe = function (/*String*/ root, /*String*/ target) {
|
|
170
|
+
const self = this;
|
|
171
|
+
if (typeof self.fs.lstatSync !== "function") return;
|
|
172
|
+
|
|
173
|
+
const resolvedRoot = pth.resolve(root);
|
|
174
|
+
const resolvedTarget = pth.resolve(target);
|
|
175
|
+
if (resolvedTarget === resolvedRoot) return;
|
|
176
|
+
|
|
177
|
+
const rel = pth.relative(resolvedRoot, resolvedTarget);
|
|
178
|
+
// Not under root: sanitize() is responsible for that case; nothing to walk.
|
|
179
|
+
if (!rel || rel === ".." || rel.startsWith(".." + pth.sep) || pth.isAbsolute(rel)) return;
|
|
180
|
+
|
|
181
|
+
let cur = resolvedRoot;
|
|
182
|
+
for (const part of rel.split(pth.sep)) {
|
|
183
|
+
if (!part || part === ".") continue;
|
|
184
|
+
cur = pth.join(cur, part);
|
|
185
|
+
let stat;
|
|
186
|
+
try {
|
|
187
|
+
stat = self.fs.lstatSync(cur);
|
|
188
|
+
} catch (e) {
|
|
189
|
+
break; // component does not exist yet: nothing below it can be a symlink
|
|
190
|
+
}
|
|
191
|
+
if (stat.isSymbolicLink()) throw Errors.FILE_IN_THE_WAY(`"${cur}"`);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
162
195
|
Utils.prototype.findFiles = function (/*String*/ path) {
|
|
163
196
|
const self = this;
|
|
197
|
+
const canLstat = typeof self.fs.lstatSync === "function";
|
|
198
|
+
const rootReal = self.fs.realpathSync(path);
|
|
199
|
+
|
|
200
|
+
// A symlink whose target lies outside the folder being archived must not be
|
|
201
|
+
// followed: statSync would dereference it and copy the target's contents into
|
|
202
|
+
// the archive, disclosing files outside the root (GHSA-wx42-xcp7-pgr4). Allow
|
|
203
|
+
// symlinks that resolve to a location inside the root, reject any that escape.
|
|
204
|
+
function escapesRoot(/*String*/ p) {
|
|
205
|
+
if (!canLstat) return false;
|
|
206
|
+
if (!self.fs.lstatSync(p).isSymbolicLink()) return false;
|
|
207
|
+
let real;
|
|
208
|
+
try {
|
|
209
|
+
real = self.fs.realpathSync(p);
|
|
210
|
+
} catch (e) {
|
|
211
|
+
return true; // dangling or unresolvable symlink: do not follow
|
|
212
|
+
}
|
|
213
|
+
return !(real === rootReal || real.startsWith(rootReal + pth.sep));
|
|
214
|
+
}
|
|
164
215
|
|
|
165
216
|
function findSync(/*String*/ dir, /*RegExp*/ pattern, /*Boolean*/ recursive, /*Set*/ visited) {
|
|
166
217
|
if (typeof pattern === "boolean") {
|
|
@@ -170,6 +221,9 @@ Utils.prototype.findFiles = function (/*String*/ path) {
|
|
|
170
221
|
let files = [];
|
|
171
222
|
self.fs.readdirSync(dir).forEach(function (file) {
|
|
172
223
|
const path = pth.join(dir, file);
|
|
224
|
+
|
|
225
|
+
if (escapesRoot(path)) return;
|
|
226
|
+
|
|
173
227
|
const stat = self.fs.statSync(path);
|
|
174
228
|
|
|
175
229
|
if (!pattern || pattern.test(path)) {
|
|
@@ -191,7 +245,7 @@ Utils.prototype.findFiles = function (/*String*/ path) {
|
|
|
191
245
|
return files;
|
|
192
246
|
}
|
|
193
247
|
|
|
194
|
-
return findSync(path, undefined, true, new Set([
|
|
248
|
+
return findSync(path, undefined, true, new Set([rootReal]));
|
|
195
249
|
};
|
|
196
250
|
|
|
197
251
|
/**
|
|
@@ -217,6 +271,25 @@ Utils.prototype.findFilesAsync = function (dir, cb) {
|
|
|
217
271
|
cb(err, err ? undefined : results);
|
|
218
272
|
};
|
|
219
273
|
|
|
274
|
+
const canLstat = typeof self.fs.lstat === "function";
|
|
275
|
+
let rootReal = null;
|
|
276
|
+
|
|
277
|
+
// Reject a symlink whose target escapes the root being archived, so its
|
|
278
|
+
// contents are not dereferenced and copied into the archive
|
|
279
|
+
// (GHSA-wx42-xcp7-pgr4). A symlink resolving to a location inside the root is
|
|
280
|
+
// allowed; a dangling or escaping one is skipped. Calls back (err, escapes).
|
|
281
|
+
const escapesRoot = function (file, cb) {
|
|
282
|
+
if (!canLstat) return cb(null, false);
|
|
283
|
+
self.fs.lstat(file, function (err, lst) {
|
|
284
|
+
if (err) return cb(err);
|
|
285
|
+
if (!lst || !lst.isSymbolicLink()) return cb(null, false);
|
|
286
|
+
self.fs.realpath(file, function (err, real) {
|
|
287
|
+
if (err) return cb(null, true); // dangling: do not follow
|
|
288
|
+
cb(null, !(real === rootReal || real.startsWith(rootReal + pth.sep)));
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
|
|
220
293
|
// Descend by resolved real path and skip directories already visited, so a
|
|
221
294
|
// symlink pointing back to an ancestor cannot recurse forever (issue #541).
|
|
222
295
|
const walk = function (dir, visited, done) {
|
|
@@ -226,27 +299,34 @@ Utils.prototype.findFilesAsync = function (dir, cb) {
|
|
|
226
299
|
if (!pending) return done();
|
|
227
300
|
list.forEach(function (name) {
|
|
228
301
|
const file = pth.join(dir, name);
|
|
229
|
-
|
|
302
|
+
escapesRoot(file, function (err, escapes) {
|
|
230
303
|
if (err) return done(err);
|
|
231
|
-
if (
|
|
232
|
-
if (!--pending) done();
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
results.push(pth.normalize(file) + (stat.isDirectory() ? self.sep : ""));
|
|
236
|
-
if (!stat.isDirectory()) {
|
|
304
|
+
if (escapes) {
|
|
237
305
|
if (!--pending) done();
|
|
238
306
|
return;
|
|
239
307
|
}
|
|
240
|
-
self.fs.
|
|
308
|
+
self.fs.stat(file, function (err, stat) {
|
|
241
309
|
if (err) return done(err);
|
|
242
|
-
if (
|
|
310
|
+
if (!stat) {
|
|
243
311
|
if (!--pending) done();
|
|
244
312
|
return;
|
|
245
313
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if (err) return done(err);
|
|
314
|
+
results.push(pth.normalize(file) + (stat.isDirectory() ? self.sep : ""));
|
|
315
|
+
if (!stat.isDirectory()) {
|
|
249
316
|
if (!--pending) done();
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
self.fs.realpath(file, function (err, realDir) {
|
|
320
|
+
if (err) return done(err);
|
|
321
|
+
if (visited.has(realDir)) {
|
|
322
|
+
if (!--pending) done();
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
visited.add(realDir);
|
|
326
|
+
walk(file, visited, function (err) {
|
|
327
|
+
if (err) return done(err);
|
|
328
|
+
if (!--pending) done();
|
|
329
|
+
});
|
|
250
330
|
});
|
|
251
331
|
});
|
|
252
332
|
});
|
|
@@ -256,6 +336,7 @@ Utils.prototype.findFilesAsync = function (dir, cb) {
|
|
|
256
336
|
|
|
257
337
|
self.fs.realpath(dir, function (err, realDir) {
|
|
258
338
|
if (err) return finish(err);
|
|
339
|
+
rootReal = realDir;
|
|
259
340
|
walk(dir, new Set([realDir]), finish);
|
|
260
341
|
});
|
|
261
342
|
};
|
|
@@ -365,7 +446,14 @@ Utils.toBuffer = function toBuffer(/*buffer, Uint8Array, string*/ input, /* func
|
|
|
365
446
|
Utils.readBigUInt64LE = function (/*Buffer*/ buffer, /*int*/ index) {
|
|
366
447
|
const lo = buffer.readUInt32LE(index);
|
|
367
448
|
const hi = buffer.readUInt32LE(index + 4);
|
|
368
|
-
|
|
449
|
+
const value = hi * 0x100000000 + lo;
|
|
450
|
+
// The result is a JS number, so values above 2^53 - 1 cannot be represented
|
|
451
|
+
// exactly. These are zip64 sizes/offsets/counts used as buffer indices; a
|
|
452
|
+
// silently rounded value would misparse the archive. Reject instead.
|
|
453
|
+
if (value > Number.MAX_SAFE_INTEGER) {
|
|
454
|
+
throw Errors.ZIP64_VALUE_TOO_LARGE();
|
|
455
|
+
}
|
|
456
|
+
return value;
|
|
369
457
|
};
|
|
370
458
|
|
|
371
459
|
Utils.writeBigUInt64LE = function (/*Buffer*/ buffer, /*Number*/ value, /*int*/ index) {
|