diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d06558c8..70947bc3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,7 +65,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - node-version: ['lts/*'] + node-version: [18, 20, 22, 'lts/*'] steps: - name: Checkout diff --git a/CHANGELOG.md b/CHANGELOG.md index 264e5751..263ea4af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ # Changelog +### 3.5.4 + +- fix the `os.machine` breaking some dependents, fix [#994](https://github.com/node-formidable/formidable/issues/994) +- add Node 16, 18, 20, 22 to CI/CD + ### 3.5.3 +- security report by ZAST.AI help for some vulnerabilities addressing (primarily the random names generation) - update failing tests - update CI/CD workflows and actions; - update CodeQL github action for security analysis diff --git a/package.json b/package.json index 9782e6f7..b238008c 100644 --- a/package.json +++ b/package.json @@ -57,19 +57,25 @@ "lint": "pnpm run lint:prepare .", "lint:prepare": "eslint --cache --fix --quiet --format codeframe", "fresh": "rm -rf ./node_modules", - "pretest": "rm -rf ./test/tmp && mkdir ./test/tmp", + "test-specific": "node --disable-warning=ExperimentalWarning --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=test/standalone/keep-alive-error.test.js", - "test": "pnpm audit --prod && pnpm run test-jest && pnpm run test-node", "test-jest": "node --disable-warning=ExperimentalWarning --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=test/ --coverage", - "test-node": "node --disable-warning=ExperimentalWarning --test test-node/**/*.test.js", - "pretest:ci": "pnpm run pretest", - "test:ci": "node --disable-warning=ExperimentalWarning --experimental-vm-modules node_modules/.bin/nyc jest --testPathPattern=test/ --coverage && node --disable-warning=ExperimentalWarning --experimental-vm-modules node_modules/.bin/nyc node --test test-node/" + "test-node": "node --disable-warning=ExperimentalWarning --test ./test-node/**/*.test.js", + + "test-jest:ci": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=test/ --coverage", + + "test:local": "pnpm run test-node && pnpm run test-jest", + + "audit": "pnpm audit --prod --fix", + "pretest": "rm -rf ./test/tmp && mkdir ./test/tmp", + "test": "pnpm run audit && node --test ./test-node/**/*.test.js && pnpm run test-jest:ci" }, "dependencies": { "@paralleldrive/cuid2": "^2.2.2", "dezalgo": "^1.0.4", "once": "^1.4.0" }, +"packageManager": "pnpm@10.8.1", "devDependencies": { "@rollup/plugin-commonjs": "^25.0.2", "@rollup/plugin-node-resolve": "^15.1.0", @@ -90,10 +96,12 @@ "rollup": "^3.25.3", "supertest": "6.1.6" }, + "engines": { + "node": ">=14.0.0" + }, "jest": { "verbose": true }, - "packageManager": "pnpm@10.8.1", "keywords": [ "multipart", "form", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 764e3448..77fc7fbe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -314,8 +314,8 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - '@noble/hashes@1.7.2': - resolution: {integrity: sha512-biZ0NUSxyjLLqo6KxEJ1b+C2NAx0wtDoFvCaXHGgUkeHzf3Xc1xKumFKREuT7f7DARNZ/slvYUwFG6B0f2b6hQ==} + '@noble/hashes@1.8.0': + resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} engines: {node: ^14.21.3 || >=16} '@nodelib/fs.scandir@2.1.5': @@ -648,8 +648,8 @@ packages: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} - caniuse-lite@1.0.30001714: - resolution: {integrity: sha512-mtgapdwDLSSBnCI3JokHM7oEQBLxiJKVRtg10AxM1AyeiKcM96f0Mkbqeq+1AbiCtvMcHRulAAEMu693JrSWqg==} + caniuse-lite@1.0.30001715: + resolution: {integrity: sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==} chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} @@ -908,8 +908,8 @@ packages: ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - electron-to-chromium@1.5.139: - resolution: {integrity: sha512-GGnRYOTdN5LYpwbIr0rwP/ZHOQSvAF6TG0LSzp28uCBb9JiXHJGmaaKw29qjNJc5bGnnp6kXJqRnGMQoELwi5w==} + electron-to-chromium@1.5.140: + resolution: {integrity: sha512-o82Rj+ONp4Ip7Cl1r7lrqx/pXhbp/lh9DpKcMNscFJdh8ebyRofnc7Sh01B4jx403RI0oqTBvlZ7OBIZLMr2+Q==} emittery@0.8.1: resolution: {integrity: sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg==} @@ -1921,6 +1921,7 @@ packages: node-domexception@1.0.0: resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} engines: {node: '>=10.5.0'} + deprecated: Use your platform's native DOMException instead node-int64@0.4.0: resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} @@ -3149,7 +3150,7 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@noble/hashes@1.7.2': {} + '@noble/hashes@1.8.0': {} '@nodelib/fs.scandir@2.1.5': dependencies: @@ -3165,7 +3166,7 @@ snapshots: '@paralleldrive/cuid2@2.2.2': dependencies: - '@noble/hashes': 1.7.2 + '@noble/hashes': 1.8.0 '@rollup/plugin-commonjs@25.0.8(rollup@3.29.5)': dependencies: @@ -3492,8 +3493,8 @@ snapshots: browserslist@4.24.4: dependencies: - caniuse-lite: 1.0.30001714 - electron-to-chromium: 1.5.139 + caniuse-lite: 1.0.30001715 + electron-to-chromium: 1.5.140 node-releases: 2.0.19 update-browserslist-db: 1.1.3(browserslist@4.24.4) @@ -3540,7 +3541,7 @@ snapshots: camelcase@6.3.0: {} - caniuse-lite@1.0.30001714: {} + caniuse-lite@1.0.30001715: {} chalk@2.4.2: dependencies: @@ -3764,7 +3765,7 @@ snapshots: ee-first@1.1.1: {} - electron-to-chromium@1.5.139: {} + electron-to-chromium@1.5.140: {} emittery@0.8.1: {} diff --git a/src/Formidable.js b/src/Formidable.js index 3f4c1e03..916b5396 100644 --- a/src/Formidable.js +++ b/src/Formidable.js @@ -16,7 +16,7 @@ import DummyParser from './parsers/Dummy.js'; import MultipartParser from './parsers/Multipart.js'; import { json, multipart, octetstream, querystring } from './plugins/index.js'; -const CUID2_FINGERPRINT = `${process.env.NODE_ENV}-${os.platform()}-${os.hostname()}-${os.machine()}` +const CUID2_FINGERPRINT = `${process.env.NODE_ENV}-${os.platform()}-${os.hostname()}` const createId = cuid2init({ length: 25, fingerprint: CUID2_FINGERPRINT.toLowerCase() }); const DEFAULT_OPTIONS = {