diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index be1997d14..c730aabde 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -43,8 +43,6 @@ jobs: sudo sh -c "echo '127.0.0.1 testrequestbucket.localhost' >> /etc/hosts" - name: test and coverage run: yarn --silent coverage - env: - NODE_OPTIONS: "--tls-max-v1.2" - name: run functional tests run: yarn ft_test - uses: codecov/codecov-action@v4 diff --git a/README.md b/README.md index c0bd9bb7c..bfb7cd23c 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,10 @@ console.log(errors.AccessDenied); ## Build Status ![Public Build Status][badgepub] -![Private Build Status][badgepriv] + +## Codecov Status + +![codecov][codecov] ## Clustering @@ -152,4 +155,4 @@ to the process (which results in an immediate termination, and this signal can't be caught). [badgepub]: https://circleci.com/gh/scality/Arsenal.svg?style=svg -[badgepriv]: http://ci.ironmann.io/gh/scality/Arsenal.svg?style=svg&circle-token=c3d2570682cba6763a97ea0bc87521941413d75c +[codecov]: https://codecov.io/gh/scality/Arsenal/branch/main/graph/badge.svg diff --git a/lib/network/kmip/Client.ts b/lib/network/kmip/Client.ts index 848531579..2eb98b069 100644 --- a/lib/network/kmip/Client.ts +++ b/lib/network/kmip/Client.ts @@ -363,7 +363,7 @@ export default class Client { KMIP.Structure('Template-Attribute', attributes), ], (err, response) => { if (err) { - const error = arsenalErrorKMIP(JSON.stringify(err)); + const error = arsenalErrorKMIP(err); logger.error('KMIP::createBucketKey', { error, serverInformation: this.serverInformation }); diff --git a/lib/network/kmip/transport/TransportTemplate.ts b/lib/network/kmip/transport/TransportTemplate.ts index 434e6f130..ce9573af9 100644 --- a/lib/network/kmip/transport/TransportTemplate.ts +++ b/lib/network/kmip/transport/TransportTemplate.ts @@ -90,9 +90,14 @@ export default class TransportTemplate { readyCallback: (error: Error | null) => void, ) { try { + const options = { + ...this.options.tls, + host: '127.0.0.1', + family: 4, + }; const socket = this.channel.connect( this.options.tls.port || DEFAULT_KMIP_PORT, - this.options.tls, + options, () => { if (this.handshakeFunction) { this.handshakeFunction(logger, readyCallback); diff --git a/lib/network/rpc/sio-stream.ts b/lib/network/rpc/sio-stream.ts index 3cf3596e3..6d1ed1251 100644 --- a/lib/network/rpc/sio-stream.ts +++ b/lib/network/rpc/sio-stream.ts @@ -341,7 +341,6 @@ class SIOStreamSocket { encodedObj = {}; // user objects are simple flat objects and we want to // copy all their properties - for (const k in arg) { encodedObj[k] = this.encodeStreams(arg[k]); } @@ -415,7 +414,6 @@ class SIOStreamSocket { decodedObj = {}; // user objects are simple flat objects and we want to // copy all their properties - for (const k in arg) { decodedObj[k] = this.decodeStreams(arg[k]); } diff --git a/lib/policyEvaluator/requestUtils.ts b/lib/policyEvaluator/requestUtils.ts index ec73a9b50..7fb269cae 100644 --- a/lib/policyEvaluator/requestUtils.ts +++ b/lib/policyEvaluator/requestUtils.ts @@ -18,8 +18,7 @@ export function getClientIp(request: IncomingMessage, s3config?: S3Config): stri const requestConfig = s3config?.requests; const remoteAddress = request.socket.remoteAddress; // TODO What to do if clientIp === undefined ? - const clientIp = (requestConfig ? remoteAddress : request.headers['x-forwarded-for'] || - remoteAddress)?.toString() ?? ''; + const clientIp = remoteAddress?.toString() ?? ''; if (requestConfig) { const { trustedProxyCIDRs, extractClientIPFromHeader } = requestConfig; /** diff --git a/lib/s3routes/routesUtils.ts b/lib/s3routes/routesUtils.ts index 46d722716..e5b998a54 100644 --- a/lib/s3routes/routesUtils.ts +++ b/lib/s3routes/routesUtils.ts @@ -147,8 +147,8 @@ export const XMLResponseBackend = { xml.push( '', '', - `${errCode.message}`, - `${errCode.description}`, + `${error.message}`, + `${error.description}`, ); const invalidArguments = error.metadata.get('invalidArguments') || []; invalidArguments.forEach((invalidArgument, index) => { diff --git a/lib/storage/metadata/mongoclient/LogConsumer.js b/lib/storage/metadata/mongoclient/LogConsumer.js index a782f4d02..f95d0d795 100644 --- a/lib/storage/metadata/mongoclient/LogConsumer.js +++ b/lib/storage/metadata/mongoclient/LogConsumer.js @@ -39,7 +39,6 @@ class LogConsumer { const client = new MongoClient(this._mongoUrl, { replicaSet: this._replicaSet, useNewUrlParser: true, - useUnifiedTopology: true, readPreference: this._readPreference, }); diff --git a/package.json b/package.json index fd2b8cab8..b43c5216a 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "diskusage": "^1.2.0", "fcntl": "github:scality/node-fcntl#0.2.2", "hdclient": "scality/hdclient#1.1.7", - "httpagent": "scality/httpagent#1.0.6", + "httpagent": "scality/httpagent#1.1.0", "https-proxy-agent": "^7.0.5", "ioredis": "^5.4.1", "ipaddr.js": "^2.2.0", @@ -52,7 +52,7 @@ "sproxydclient": "github:scality/sproxydclient#8.1.0", "utf8": "^3.0.0", "uuid": "^10.0.0", - "werelogs": "scality/werelogs#8.2.0", + "werelogs": "scality/werelogs#8.2.2", "xml2js": "^0.6.2" }, "optionalDependencies": { @@ -85,11 +85,11 @@ "lint": "eslint $(git ls-files '*ts' ' *.js')", "lint_md": "mdlint $(git ls-files '*.md')", "lint_yml": "yamllint $(git ls-files '*.yml')", - "test": "jest tests/unit --detectOpenHandles", + "test": "export NODE_OPTIONS=\"--tls-max-v1.2\" && jest tests/unit --detectOpenHandles", "build": "tsc", "prepare": "yarn build", "ft_test": "jest tests/functional --testTimeout=120000 --forceExit", - "coverage": "nyc --clean jest tests --coverage --testTimeout=120000 --forceExit", + "coverage": "export NODE_OPTIONS=\"--tls-max-v1.2\" && nyc --clean jest tests --coverage --testTimeout=120000 --forceExit", "build_doc": "cd documentation/listingAlgos/pics; dot -Tsvg delimiterStateChart.dot > delimiterStateChart.svg; dot -Tsvg delimiterMasterV0StateChart.dot > delimiterMasterV0StateChart.svg; dot -Tsvg delimiterVersionsStateChart.dot > delimiterVersionsStateChart.svg" }, "private": true, diff --git a/tests/unit/policyEvaluator/RequestContext.spec.js b/tests/unit/policyEvaluator/RequestContext.spec.js index 0cc368484..12482091f 100644 --- a/tests/unit/policyEvaluator/RequestContext.spec.js +++ b/tests/unit/policyEvaluator/RequestContext.spec.js @@ -172,4 +172,4 @@ describe('RequestContext', () => { const ssoRC = new RequestContext(...ssoParams); assert.strictEqual(ssoRC.getResource(), 'arn:scality:sso:::general-resource/specific-resource'); }); -}); \ No newline at end of file +}); diff --git a/tsconfig.json b/tsconfig.json index 68a350171..75a021c5b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,8 +13,7 @@ "declaration": true, "noImplicitAny": false, "noEmitOnError": false, - "sourceMap": true, - "skipLibCheck": true, + "sourceMap": true }, "include": ["index.ts", "lib"], "exclude": ["node_modules/*"], diff --git a/yarn.lock b/yarn.lock index 8f859d46b..4e5d16475 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4519,13 +4519,13 @@ http-proxy-agent@^7.0.0: agent-base "^7.1.0" debug "^4.3.4" -"httpagent@github:scality/httpagent#1.0.6", httpagent@scality/httpagent#1.0.6: +"httpagent@github:scality/httpagent#1.0.6": version "1.0.6" resolved "https://codeload.github.com/scality/httpagent/tar.gz/66e97ab93532d79dbddcf6c4ea4df849b84c33c9" dependencies: agentkeepalive "^4.2.1" -"httpagent@github:scality/httpagent#1.1.0": +"httpagent@github:scality/httpagent#1.1.0", httpagent@scality/httpagent#1.1.0: version "1.1.0" resolved "https://codeload.github.com/scality/httpagent/tar.gz/8f9958eb9cde086db7819a86582fba640a5f8876" dependencies: @@ -7635,6 +7635,13 @@ werelogs@scality/werelogs#8.2.0: fast-safe-stringify "^2.1.1" safe-json-stringify "^1.2.0" +werelogs@scality/werelogs#8.2.2: + version "8.2.2" + resolved "https://codeload.github.com/scality/werelogs/tar.gz/e53bef5145697bf8af940dcbe59408988d64854f" + dependencies: + fast-safe-stringify "^2.1.1" + safe-json-stringify "^1.2.0" + whatwg-url@^11.0.0: version "11.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018"