mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 17:45:18 -05:00
Azure Blob storage: WeKan's own adapter on @azure/storage-blob, without @azure/identity and MSAL - 36 MiB less.
@tweedegolf/sab-adapter-azure-blob required @azure/identity when it was loaded, and with it @azure/msal-node, msal-common and msal-browser - 36 MiB in every bundle, msal-browser alone 17 - for one branch: Microsoft Entra passwordless sign-in, taken only when neither a connection string nor an account key is given. WeKan always gives one of them (buildProviderConfig), so it never ran. WeKan's login with Azure AD and B2C is OIDC (packages/wekan-oidc) and never used these packages either. server/lib/azureBlobAdapter.js is the adapter interface the other providers have, like server/lib/webdavAdapter.js: getFileAsStream with an inclusive byte range (#6745), addFileFromPath, addFileFromStream, removeFile (a missing file is no error) and listFiles ([name, size], "container/prefix" lists the prefix), each { value, error }, and configError for a configuration that cannot work. server/methods/backup.js already used @azure/storage-blob directly. The package and the @azure/msal-node override (GHSA-xcx6-jx8p-x3h5) are gone with what they brought; Admin Panel / Attachments takes the same settings. tests/azureBlobAdapter.test.cjs runs it against Azurite, Microsoft's Azure Storage emulator, when it is installed (.tools/azurite): up from a path and a stream, back whole and as a range, listed, removed, and the errors - and checks the configuration errors without it. tests/msalNodeAdvisory.test.cjs now pins that no @azure/identity or MSAL package is locked. The rebuilt bundle has neither and boots; the source audit allows the adapter's https://<account>.blob.core.windows.net. Thanks to xet7 !
This commit is contained in:
1 parent
09424fd9ba
commit
de7b622960
7 files changed
+242
-350
No files matched your search
@@ -69,8 +69,10 @@ function loadAdapterClass(provider) {
|
||||
mod = require('@tweedegolf/sab-adapter-amazon-s3');
|
||||
break;
|
||||
case STORAGE_NAME_AZURE:
|
||||
// WeKan's own, on @azure/storage-blob alone: the package adapter
|
||||
// loaded @azure/identity and MSAL, 36 MiB, for a sign-in WeKan never uses.
|
||||
// eslint-disable-next-line global-require
|
||||
mod = require('@tweedegolf/sab-adapter-azure-blob');
|
||||
mod = require('/server/lib/azureBlobAdapter');
|
||||
break;
|
||||
case STORAGE_NAME_GCS:
|
||||
// eslint-disable-next-line global-require
|
||||
|
||||
Generated
-325
@@ -26,7 +26,6 @@
|
||||
"@textcomplete/core": "^0.1.13",
|
||||
"@textcomplete/textarea": "^0.1.13",
|
||||
"@tweedegolf/sab-adapter-amazon-s3": "^3.0.5",
|
||||
"@tweedegolf/sab-adapter-azure-blob": "^3.0.3",
|
||||
"@tweedegolf/sab-adapter-google-cloud": "^3.0.3",
|
||||
"@wekan/office-open-xml-viewer": "file:npm-packages/office-open-xml-viewer",
|
||||
"@wekanteam/autolink": "file:npm-packages/autolink",
|
||||
@@ -627,15 +626,6 @@
|
||||
"node": ">=22.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-process": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-process/-/core-process-1.0.0.tgz",
|
||||
"integrity": "sha512-/shnJ+ooO8WPxDhPEeI/2oRQuubn16gZ6CvlbpWbEswZfzwI9tI/sMAHmF3x1LuQ9yZYXfLW3TjzGMLEC5blKg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=22.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-rest-pipeline": {
|
||||
"version": "1.25.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.25.0.tgz",
|
||||
@@ -693,29 +683,6 @@
|
||||
"node": ">=22.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/identity": {
|
||||
"version": "4.14.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.14.0.tgz",
|
||||
"integrity": "sha512-8utCLdTZn14CiAe0HW4JbtzUMsc0mdDwnjUvStFMrR4IxQP8S2eL9zVAdplpfORVJGYmidZElpeXRYjJQ4UyUw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.0.0",
|
||||
"@azure/core-auth": "^1.9.0",
|
||||
"@azure/core-client": "^1.9.2",
|
||||
"@azure/core-process": "^1.0.0",
|
||||
"@azure/core-rest-pipeline": "^1.17.0",
|
||||
"@azure/core-tracing": "^1.0.0",
|
||||
"@azure/core-util": "^1.11.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"@azure/msal-browser": "^5.5.0",
|
||||
"@azure/msal-node": "^6.0.0",
|
||||
"open": "^11.0.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/logger": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.4.0.tgz",
|
||||
@@ -729,49 +696,6 @@
|
||||
"node": ">=22.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-browser": {
|
||||
"version": "5.25.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-5.25.0.tgz",
|
||||
"integrity": "sha512-7GyXzDUrdLG5zPDCYJbQdJqbl9a2U9SWUSC4lxr7cXjkBq6diTfWcJsi0UjdGWlqy+EevQg9dSC4g3s3BEp19g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/msal-common": "16.14.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-common": {
|
||||
"version": "16.14.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.14.2.tgz",
|
||||
"integrity": "sha512-HOBR0Gfo39TMrkxNG8k6cfjRkrRjXZc3JQs3ebMWQc9S4cihuknMYra3sgmzbZB752oQBqBN9+WF7c826p2vIQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-node": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-7.1.1.tgz",
|
||||
"integrity": "sha512-zHXTJB38XVrsNaXrPBCMqEUjeyQysFfgmKtUHRDsEKTRjNIPckJ/w6fE5wBXrmJXBim1D3C7O7LOag0msPTrgw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/msal-common": "16.14.3",
|
||||
"jsonwebtoken": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-node/node_modules/@azure/msal-common": {
|
||||
"version": "16.14.3",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.14.3.tgz",
|
||||
"integrity": "sha512-tz3GvMrR9V/plb2lDdW8qaO8CPpfZevdExBKjltzzbAtyhK0eB2UIvji1aU+gkyHj3fxQ2ie+LNHyMXdmo8wOg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/storage-blob": {
|
||||
"version": "12.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.34.0.tgz",
|
||||
@@ -5033,16 +4957,6 @@
|
||||
"@aws-sdk/s3-request-presigner": "^3.1148.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tweedegolf/sab-adapter-azure-blob": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tweedegolf/sab-adapter-azure-blob/-/sab-adapter-azure-blob-3.0.3.tgz",
|
||||
"integrity": "sha512-gncHQZb1xZD9SUD5rfsHX2MC8p3VNM3UijCRTfuzQ3of5F0CdBJWVYZ8hycq0TG4exZAUDfWYRdPe7rdL1kUWg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/identity": "^4.13.3",
|
||||
"@azure/storage-blob": "^12.34.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tweedegolf/sab-adapter-google-cloud": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tweedegolf/sab-adapter-google-cloud/-/sab-adapter-google-cloud-3.0.3.tgz",
|
||||
@@ -6878,21 +6792,6 @@
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/bundle-name": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.1.tgz",
|
||||
"integrity": "sha512-DdH81/zPLVS11EUgWq3tEu/xn+EzljlMYooDNdzWEnFha3R3NBMpMV1UqYIpjYHV/SgpFKMIX1Oh7o06SjM/oA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"run-applescript": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.9.tgz",
|
||||
@@ -7587,34 +7486,6 @@
|
||||
"node": ">=16.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser": {
|
||||
"version": "5.5.1",
|
||||
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.5.1.tgz",
|
||||
"integrity": "sha512-m1pAzaJgZ/gssEqlOhJkPJp8Xly7QyW6xcrkUa2KKcDeDSEMP7X8xipU3snUcfisTQx0w1AGae+9UtJSfVnXGw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bundle-name": "^4.1.0",
|
||||
"default-browser-id": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/default-browser-id": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.1.tgz",
|
||||
"integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/define-data-property": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
|
||||
@@ -7632,18 +7503,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/define-lazy-prop": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",
|
||||
"integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/define-properties": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
|
||||
@@ -10199,21 +10058,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/is-docker": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",
|
||||
"integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"is-docker": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-document.all": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-document.all/-/is-document.all-1.0.0.tgz",
|
||||
@@ -10289,36 +10133,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-in-ssh": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-in-ssh/-/is-in-ssh-1.0.0.tgz",
|
||||
"integrity": "sha512-jYa6Q9rH90kR1vKB6NM7qqd1mge3Fx4Dhw5TVlK1MUBqhEOuCagrEHMevNuCcbECmXZ0ThXkRm+Ymr51HwEPAw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-inside-container": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
|
||||
"integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-docker": "^3.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"is-inside-container": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-map": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz",
|
||||
@@ -10565,21 +10379,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/is-wsl": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz",
|
||||
"integrity": "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-inside-container": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/isarray": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
|
||||
@@ -10850,28 +10649,6 @@
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonwebtoken": {
|
||||
"version": "9.0.3",
|
||||
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz",
|
||||
"integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jws": "^4.0.1",
|
||||
"lodash.includes": "^4.3.0",
|
||||
"lodash.isboolean": "^3.0.3",
|
||||
"lodash.isinteger": "^4.0.4",
|
||||
"lodash.isnumber": "^3.0.3",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.isstring": "^4.0.1",
|
||||
"lodash.once": "^4.0.0",
|
||||
"ms": "^2.1.1",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12",
|
||||
"npm": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/jszip": {
|
||||
"version": "3.10.2",
|
||||
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.2.tgz",
|
||||
@@ -11209,42 +10986,6 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.includes": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
"integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isboolean": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
|
||||
"integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isinteger": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
|
||||
"integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isnumber": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
|
||||
"integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isplainobject": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isstring": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
|
||||
"integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
@@ -11252,12 +10993,6 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.once": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
|
||||
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "11.5.3",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz",
|
||||
@@ -13405,26 +13140,6 @@
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/open": {
|
||||
"version": "11.0.4",
|
||||
"resolved": "https://registry.npmjs.org/open/-/open-11.0.4.tgz",
|
||||
"integrity": "sha512-++Zlftm0kVLPmzC06t6epuWmcRMDbI4z5P3NNX979WA/k23+NtSOynEGzsVfZwguKw2mi5umVgnBlJQMwRz4Pg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"default-browser": "^5.5.1",
|
||||
"define-lazy-prop": "^3.0.0",
|
||||
"is-in-ssh": "^1.0.0",
|
||||
"is-inside-container": "^1.0.0",
|
||||
"powershell-utils": "^0.2.1",
|
||||
"wsl-utils": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/optionator": {
|
||||
"version": "0.9.4",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
|
||||
@@ -13887,18 +13602,6 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/powershell-utils": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/powershell-utils/-/powershell-utils-0.2.1.tgz",
|
||||
"integrity": "sha512-C+y9x90UElAddDZmV4qOx9W53B61PO7cIqWz2dQsWlwswuq4mr8NEwytdGKboYbQlGZ3awrkTeNvcZiZNHnQ8A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/prelude-ls": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||
@@ -14428,18 +14131,6 @@
|
||||
"integrity": "sha512-W/mzCdxfV+EXOdpfwcLWc2TZ9EYa2LYumAMgpTn27bSEOO0BQz/SA8qfnJRCMkJyNST2URxmwqBmQbh5tLFwsg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/run-applescript": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz",
|
||||
"integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/run-parallel": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
|
||||
@@ -16530,22 +16221,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/wsl-utils": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-1.0.1.tgz",
|
||||
"integrity": "sha512-c16PKLIRxBYpR3jSWsdS7SFp0COm5SOQdiFjY818dYFHJbMGuLBszpF07LBWmOS1uzrHa9VGdynsEgoeKy0oOQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-wsl": "^3.1.0",
|
||||
"powershell-utils": "^0.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/xml-crypto": {
|
||||
"version": "6.4.0",
|
||||
"resolved": "https://registry.npmjs.org/xml-crypto/-/xml-crypto-6.4.0.tgz",
|
||||
|
||||
@@ -74,7 +74,6 @@
|
||||
"@textcomplete/core": "^0.1.13",
|
||||
"@textcomplete/textarea": "^0.1.13",
|
||||
"@tweedegolf/sab-adapter-amazon-s3": "^3.0.5",
|
||||
"@tweedegolf/sab-adapter-azure-blob": "^3.0.3",
|
||||
"@tweedegolf/sab-adapter-google-cloud": "^3.0.3",
|
||||
"@wekan/office-open-xml-viewer": "file:npm-packages/office-open-xml-viewer",
|
||||
"@wekanteam/autolink": "file:npm-packages/autolink",
|
||||
@@ -146,7 +145,6 @@
|
||||
"uuid": "^14.0.0",
|
||||
"webpack-dev-server": "^5.2.6",
|
||||
"http-proxy-middleware": "^2.0.10",
|
||||
"@azure/msal-node": "^7.1.1",
|
||||
"express": {
|
||||
"qs": "6.16.0",
|
||||
"body-parser": {
|
||||
|
||||
@@ -54,6 +54,9 @@
|
||||
"https://api\\.cloudflare\\.com.*",
|
||||
"https://\\$\\{domain\\.domain.*"
|
||||
],
|
||||
"server/lib/azureBlobAdapter.js": [
|
||||
"https://\\$\\{accountName"
|
||||
],
|
||||
"models/lib/taskwarriorFormat.js": [
|
||||
"https://taskwarrior\\.org/docs/design/task/"
|
||||
],
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
// Azure Blob attachment storage on @azure/storage-blob alone.
|
||||
//
|
||||
// models/lib/cloudStorage.js used @tweedegolf/sab-adapter-azure-blob, which
|
||||
// loads @azure/identity when it is required - and with it @azure/msal-node,
|
||||
// @azure/msal-common and @azure/msal-browser, 36 MiB in every bundle - for
|
||||
// one branch: Microsoft Entra passwordless sign-in, used only when neither a
|
||||
// connection string nor an account key is given. WeKan always gives one of
|
||||
// them (buildProviderConfig), so that branch never ran. server/methods/backup.js
|
||||
// already uses @azure/storage-blob directly.
|
||||
//
|
||||
// It is the adapter interface the other providers have (server/lib/webdavAdapter.js):
|
||||
// getFileAsStream, addFileFromPath, addFileFromStream, removeFile, listFiles,
|
||||
// each answering { value, error }, and configError for a configuration that
|
||||
// cannot work. The answers are the old adapter's: a missing file to remove is
|
||||
// not an error, and listFiles gives [name, size] pairs, with "container/prefix"
|
||||
// listing only that prefix.
|
||||
const fs = require('fs');
|
||||
|
||||
// Azure's own SDK, loaded when an Azure storage is configured.
|
||||
function blobSdk() {
|
||||
// eslint-disable-next-line global-require
|
||||
return require('@azure/storage-blob');
|
||||
}
|
||||
|
||||
function errorMessage(error) {
|
||||
return (error && (error.message || error.code)) || String(error);
|
||||
}
|
||||
|
||||
class AdapterAzureBlob {
|
||||
constructor(config) {
|
||||
this.config = config || {};
|
||||
this.configError = null;
|
||||
this.client = null;
|
||||
const { connectionString, accountName, accountKey } = this.config;
|
||||
try {
|
||||
const { BlobServiceClient, StorageSharedKeyCredential } = blobSdk();
|
||||
if (connectionString) {
|
||||
this.client = BlobServiceClient.fromConnectionString(connectionString);
|
||||
} else if (accountName && accountKey) {
|
||||
this.client = new BlobServiceClient(`https://${accountName}.blob.core.windows.net`,
|
||||
new StorageSharedKeyCredential(accountName, accountKey));
|
||||
} else {
|
||||
this.configError = '[configError] Please provide a connection string, or an account name and an account key';
|
||||
}
|
||||
} catch (error) {
|
||||
this.configError = `[configError] ${errorMessage(error)}`;
|
||||
}
|
||||
}
|
||||
|
||||
container(bucketName) {
|
||||
return this.client.getContainerClient(bucketName || this.config.bucketName);
|
||||
}
|
||||
|
||||
async upload({ stream, bucketName, targetPath, options }) {
|
||||
try {
|
||||
const blob = this.container(bucketName).getBlockBlobClient(targetPath);
|
||||
// 64 KB blocks, 20 at a time - what the old adapter used.
|
||||
const response = await blob.uploadStream(stream, 64000, 20, options || {});
|
||||
return response && response.errorCode ? { value: null, error: response.errorCode } : { value: 'ok', error: null };
|
||||
} catch (error) {
|
||||
return { value: null, error: errorMessage(error) };
|
||||
}
|
||||
}
|
||||
|
||||
async addFileFromPath({ origPath, bucketName, targetPath, options }) {
|
||||
let stream;
|
||||
try {
|
||||
await fs.promises.access(origPath, fs.constants.R_OK);
|
||||
stream = fs.createReadStream(origPath);
|
||||
} catch (error) {
|
||||
return { value: null, error: errorMessage(error) };
|
||||
}
|
||||
return this.upload({ stream, bucketName, targetPath, options });
|
||||
}
|
||||
|
||||
async addFileFromStream({ stream, bucketName, targetPath, options }) {
|
||||
if (!stream) return { value: null, error: 'could not read local file, buffer or stream' };
|
||||
return this.upload({ stream, bucketName, targetPath, options });
|
||||
}
|
||||
|
||||
// range: { start, end } with end inclusive (#6745), or nothing for the whole file.
|
||||
async getFileAsStream(bucketName, key, range) {
|
||||
try {
|
||||
const offset = range && range.start !== undefined ? range.start : 0;
|
||||
const count = range && range.end !== undefined ? range.end - offset + 1 : undefined;
|
||||
const response = await this.container(bucketName).getBlobClient(key).download(offset, count);
|
||||
return response.readableStreamBody
|
||||
? { value: response.readableStreamBody, error: null }
|
||||
: { value: null, error: `No file '${key}' found in bucket '${bucketName}'` };
|
||||
} catch (error) {
|
||||
return { value: null, error: errorMessage(error) };
|
||||
}
|
||||
}
|
||||
|
||||
async removeFile(bucketName, key) {
|
||||
try {
|
||||
await this.container(bucketName).getBlobClient(key).deleteIfExists();
|
||||
return { value: 'ok', error: null };
|
||||
} catch (error) {
|
||||
return { value: null, error: errorMessage(error) };
|
||||
}
|
||||
}
|
||||
|
||||
async listFiles(bucketName, numFiles = 10000) {
|
||||
try {
|
||||
let name = bucketName || this.config.bucketName;
|
||||
let prefix = '';
|
||||
if (name.includes('/')) [name, prefix] = [name.slice(0, name.indexOf('/')), name.slice(name.indexOf('/') + 1)];
|
||||
const files = [];
|
||||
for await (const blob of this.container(name).listBlobsFlat({ prefix })) {
|
||||
if (blob.properties && blob.properties.contentLength !== undefined) files.push([blob.name, blob.properties.contentLength]);
|
||||
if (files.length >= numFiles) break;
|
||||
}
|
||||
return { value: files, error: null };
|
||||
} catch (error) {
|
||||
return { value: null, error: errorMessage(error) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { AdapterAzureBlob };
|
||||
@@ -0,0 +1,100 @@
|
||||
'use strict';
|
||||
// Azure Blob attachment storage on @azure/storage-blob alone
|
||||
// (server/lib/azureBlobAdapter.js), in place of @tweedegolf/sab-adapter-azure-blob,
|
||||
// which loaded @azure/identity and MSAL - 36 MiB in every bundle - for a sign-in
|
||||
// WeKan never used. Run: node tests/azureBlobAdapter.test.cjs
|
||||
//
|
||||
// Against Azurite, Microsoft's Azure Storage emulator, when it is installed
|
||||
// (.tools/azurite, or AZURITE_BLOB to its azurite-blob): a file goes up from a
|
||||
// path and from a stream, comes back whole and as a byte range, is listed with
|
||||
// its size, and is removed - and a missing one removed again is not an error.
|
||||
// Always: the configuration that cannot work is a configError, not a throw,
|
||||
// and cloudStorage.js loads this adapter for Azure.
|
||||
const { test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
const net = require('node:net');
|
||||
const { spawn } = require('node:child_process');
|
||||
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const { AdapterAzureBlob } = require('../server/lib/azureBlobAdapter');
|
||||
const azuriteBin = process.env.AZURITE_BLOB || path.join(root, '.tools/azurite/node_modules/.bin/azurite-blob');
|
||||
// Azurite's well-known development account (published in Microsoft's docs).
|
||||
const DEV_ACCOUNT = 'devstoreaccount1';
|
||||
const DEV_KEY = 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==';
|
||||
|
||||
test('a configuration that cannot work is a configError, not a throw', () => {
|
||||
for (const config of [{}, { accountName: 'acct' }, { accountKey: 'k' }, null]) {
|
||||
const a = new AdapterAzureBlob(config);
|
||||
assert.match(a.configError, /^\[configError\] /, JSON.stringify(config));
|
||||
}
|
||||
assert.match(new AdapterAzureBlob({ connectionString: 'not a connection string' }).configError, /^\[configError\] /);
|
||||
assert.equal(new AdapterAzureBlob({ accountName: 'acct', accountKey: DEV_KEY, bucketName: 'b' }).configError, null);
|
||||
assert.equal(new AdapterAzureBlob({ connectionString: `DefaultEndpointsProtocol=https;AccountName=acct;AccountKey=${DEV_KEY};EndpointSuffix=core.windows.net` }).configError, null);
|
||||
});
|
||||
|
||||
test('cloudStorage.js loads it for Azure, and nothing loads the package adapter', () => {
|
||||
const src = fs.readFileSync(path.join(root, 'models/lib/cloudStorage.js'), 'utf8');
|
||||
assert.match(src, /case STORAGE_NAME_AZURE:[\s\S]*?mod = require\('\/server\/lib\/azureBlobAdapter'\);/);
|
||||
assert.doesNotMatch(src, /sab-adapter-azure-blob/);
|
||||
// Its code, not its comment that says why: no Entra sign-in, so no MSAL.
|
||||
const code = fs.readFileSync(path.join(root, 'server/lib/azureBlobAdapter.js'), 'utf8').replace(/^\s*\/\/.*$/gm, '');
|
||||
assert.doesNotMatch(code, /@azure\/identity|DefaultAzureCredential|msal/);
|
||||
assert.match(code, /require\('@azure\/storage-blob'\)/);
|
||||
});
|
||||
|
||||
const freePort = () => new Promise(resolve => {
|
||||
const s = net.createServer().listen(0, '127.0.0.1', () => { const { port } = s.address(); s.close(() => resolve(port)); });
|
||||
});
|
||||
|
||||
test('against Azurite: up, down, a range, listed, removed', { skip: !fs.existsSync(azuriteBin) && 'Azurite is not installed' }, async t => {
|
||||
const dir = fs.mkdtempSync(path.join(process.env.TMPDIR || os.tmpdir(), 'azurite-'));
|
||||
const port = await freePort();
|
||||
const server = spawn(azuriteBin, ['--silent', '--skipApiVersionCheck', '--location', dir, '--blobHost', '127.0.0.1', '--blobPort', String(port)], { stdio: 'ignore' });
|
||||
t.after(() => { server.kill(); fs.rmSync(dir, { recursive: true, force: true }); });
|
||||
const connectionString = `DefaultEndpointsProtocol=http;AccountName=${DEV_ACCOUNT};AccountKey=${DEV_KEY};BlobEndpoint=http://127.0.0.1:${port}/${DEV_ACCOUNT};`;
|
||||
const { BlobServiceClient } = require('@azure/storage-blob');
|
||||
const service = BlobServiceClient.fromConnectionString(connectionString);
|
||||
for (let i = 0; ; i++) {
|
||||
try { await service.getContainerClient('wekan').createIfNotExists(); break; } catch (e) {
|
||||
if (i > 50) throw e;
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
}
|
||||
}
|
||||
const a = new AdapterAzureBlob({ connectionString, bucketName: 'wekan' });
|
||||
assert.equal(a.configError, null);
|
||||
const read = async result => {
|
||||
assert.equal(result.error, null);
|
||||
const chunks = [];
|
||||
for await (const c of result.value) chunks.push(c);
|
||||
return Buffer.concat(chunks).toString();
|
||||
};
|
||||
|
||||
const file = path.join(dir, 'up.txt');
|
||||
fs.writeFileSync(file, '0123456789abcdef');
|
||||
assert.deepEqual(await a.addFileFromPath({ origPath: file, bucketName: 'wekan', targetPath: 'cards/a.txt', options: { ContentLength: 16 } }),
|
||||
{ value: 'ok', error: null });
|
||||
assert.deepEqual(await a.addFileFromStream({ stream: fs.createReadStream(file), bucketName: 'wekan', targetPath: 'backup/b.txt' }),
|
||||
{ value: 'ok', error: null });
|
||||
assert.equal(await read(await a.getFileAsStream('wekan', 'cards/a.txt')), '0123456789abcdef');
|
||||
// #6745: a byte range with an inclusive end.
|
||||
assert.equal(await read(await a.getFileAsStream('wekan', 'cards/a.txt', { start: 2, end: 5 })), '2345');
|
||||
assert.equal(await read(await a.getFileAsStream('wekan', 'cards/a.txt', { start: 10 })), 'abcdef');
|
||||
|
||||
assert.deepEqual((await a.listFiles('wekan')).value.sort(), [['backup/b.txt', 16], ['cards/a.txt', 16]]);
|
||||
assert.deepEqual((await a.listFiles('wekan/backup')).value, [['backup/b.txt', 16]], 'container/prefix lists the prefix');
|
||||
assert.equal((await a.listFiles('wekan', 1)).value.length, 1, 'and no more than asked for');
|
||||
|
||||
assert.deepEqual(await a.removeFile('wekan', 'cards/a.txt'), { value: 'ok', error: null });
|
||||
// Negative: what is gone is not there, and removing it again is no error.
|
||||
const gone = await a.getFileAsStream('wekan', 'cards/a.txt');
|
||||
assert.equal(gone.value, null);
|
||||
assert.ok(gone.error, 'reading a removed file is an error');
|
||||
assert.deepEqual(await a.removeFile('wekan', 'cards/a.txt'), { value: 'ok', error: null });
|
||||
// Negative: a missing local file and a missing container are errors, not throws.
|
||||
assert.ok((await a.addFileFromPath({ origPath: path.join(dir, 'nope'), bucketName: 'wekan', targetPath: 'x' })).error);
|
||||
assert.ok((await a.listFiles('no-such-container')).error);
|
||||
assert.ok((await a.addFileFromStream({ bucketName: 'wekan', targetPath: 'x' })).error);
|
||||
});
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
// GHSA-xcx6-jx8p-x3h5: @azure/msal-node >= 5.0.0-beta.0, < 7.1.0 may disclose
|
||||
// authorization code flow parameters to an attacker-controlled endpoint. It
|
||||
// reaches WeKan through @tweedegolf/sab-adapter-azure-blob -> @azure/identity,
|
||||
// whose newest release (4.14.0, and 4.15.0-beta.1) still asks for
|
||||
// msal-node ^6.0.0, so `npm audit fix` - forced or not - could not apply it.
|
||||
// package.json overrides it to ^7.1.1; 7.0.0's only breaking change removed
|
||||
// responseMode from acquireTokenInteractive, which @azure/identity never
|
||||
// passes. This pins the override and that no vulnerable copy is locked.
|
||||
// reached WeKan only through @tweedegolf/sab-adapter-azure-blob ->
|
||||
// @azure/identity, the Microsoft Entra passwordless sign-in that adapter loaded
|
||||
// and WeKan never used, and package.json overrode it to ^7.1.1. Azure Blob
|
||||
// storage is now WeKan's own adapter on @azure/storage-blob alone
|
||||
// (server/lib/azureBlobAdapter.js), so neither MSAL nor @azure/identity is a
|
||||
// dependency at all, and the override went with them. This pins that: a
|
||||
// package that brings MSAL back brings this advisory back with it.
|
||||
// Run: node tests/msalNodeAdvisory.test.cjs
|
||||
|
||||
const assert = require('assert');
|
||||
@@ -21,26 +22,18 @@ const lock = JSON.parse(fs.readFileSync(path.join(root, 'package-lock.json'), 'u
|
||||
let passed = 0;
|
||||
function test(name, fn) { fn(); passed += 1; console.log(' ok -', name); }
|
||||
|
||||
const parse = v => v.split(/[.-]/).slice(0, 3).map(n => Number.parseInt(n, 10));
|
||||
const atLeast = (v, min) => {
|
||||
const a = parse(v), b = parse(min);
|
||||
for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return a[i] > b[i];
|
||||
return true;
|
||||
};
|
||||
|
||||
console.log('msalNodeAdvisory:');
|
||||
|
||||
test('package.json overrides @azure/msal-node to a fixed version', () => {
|
||||
const o = pkg.overrides && pkg.overrides['@azure/msal-node'];
|
||||
assert.ok(o, 'the override is there');
|
||||
assert.ok(atLeast(o.replace(/^[\^~>=]+/, ''), '7.1.0'), o);
|
||||
test('negative: no @azure/identity or MSAL package is locked', () => {
|
||||
const copies = Object.keys(lock.packages || {})
|
||||
.filter(k => /(^|\/)node_modules\/@azure\/(identity|msal-[a-z]+)$/.test(k));
|
||||
assert.deepEqual(copies, [], 'Azure Blob storage needs @azure/storage-blob only');
|
||||
});
|
||||
|
||||
test('negative: no locked copy of @azure/msal-node is in the vulnerable range', () => {
|
||||
const copies = Object.entries(lock.packages || {})
|
||||
.filter(([k]) => /(^|\/)node_modules\/@azure\/msal-node$/.test(k));
|
||||
assert.ok(copies.length >= 1, 'it is in the lock file');
|
||||
for (const [k, v] of copies) assert.ok(atLeast(v.version, '7.1.0'), `${k} ${v.version}`);
|
||||
test('negative: the package that brought them is not a dependency, and nothing needs the override', () => {
|
||||
assert.ok(!('@tweedegolf/sab-adapter-azure-blob' in (pkg.dependencies || {})));
|
||||
assert.ok(!(pkg.overrides && '@azure/msal-node' in pkg.overrides));
|
||||
assert.ok('@azure/storage-blob' in pkg.dependencies, 'Azure Blob storage is still there');
|
||||
});
|
||||
|
||||
console.log(`msalNodeAdvisory: ${passed} passed`);
|
||||
Reference in new issue
Block a user