[Pipeline] { (Snyk) [Pipeline] snykSecurity Testing project... > /home/someuser/jenkins/tools/io.snyk.jenkins.tools.SnykInstallation/Snyk/snyk-linux test --json --severity-threshold=low --debug 2022-08-29T23:36:12.414Z snyk test { _: [ [Circular *1] ], json: true, debug: true, severityThreshold: 'low' } 2022-08-29T23:36:13.536Z snyk-test Analyzing npm dependencies for /home/someuser/jenkins/workspace/Customer Portal/package-lock.json 2022-08-29T23:36:14.314Z snyk Potential policy locations found: [ '/home/someuser/jenkins/workspace/Customer Portal' ] 2022-08-29T23:36:14.425Z snyk:find-files Encountered multiple node lockfiles files, defaulting to /home/someuser/jenkins/workspace/Customer Portal/package-lock.json 2022-08-29T23:36:14.426Z snyk:run-test converting dep-tree to dep-graph { name: 'customer-portal', targetFile: 'package-lock.json' } 2022-08-29T23:36:14.793Z snyk:run-test done converting dep-tree to dep-graph { uniquePkgsCount: 1170 } 2022-08-29T23:36:14.800Z snyk:prune rootPkg { name: 'customer-portal', version: '0.1.0' } 2022-08-29T23:36:14.800Z snyk:prune prePrunePathsCount: 119726 2022-08-29T23:36:14.801Z snyk:prune isDenseGraph true 2022-08-29T23:36:14.801Z snyk:prune Trying to prune the graph 2022-08-29T23:36:15.217Z snyk:prune postPrunePathsCount2523 2022-08-29T23:36:15.252Z snyk sending request to: https://api.snyk.io/v1/test-dep-graph 2022-08-29T23:36:15.252Z snyk request body size: 359847 2022-08-29T23:36:15.252Z snyk gzipped request body size: 45556 2022-08-29T23:36:15.284Z snyk not using proxy 2022-08-29T23:36:20.210Z snyk analytics { "args": [ { "json": true, "debug": true, "severityThreshold": "low" } ], "command": "test", "metadata": { "upgradable-snyk-protect-paths": 0, "local": [ true, true ], "generating-node-dependency-tree": { "lockFile": true, "targetFile": "package-lock.json" }, "lockfileVersion": 2, "pluginName": "snyk-nodejs-lockfile-parser", "policies": 1, "policyLocations": [ "/home/someuser/jenkins/workspace/Customer Portal" ], "packageManager": "npm", "packageName": "customer-portal", "packageVersion": "0.1.0", "package": "customer-portal@0.1.0", "prePrunedPathsCount": 119726, "prune.graphToTreeDuration": 26, "prune.treeToGraphDuration": 383, "postPrunedPathsCount": 2523, "depGraph": true, "isDocker": false, "vulns-pre-policy": 1, "vulns": 1, "error-message": "Vulnerabilities found", "error": { "ok": false, "dependencyCount": 1169, "org": "Test", "policy": "# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.\nversion: v1.25.0\nignore: {}\npatch: {}\n", "isPrivate": true, "licensesPolicy": { "severities": {}, "orgLicenseRules": { "AGPL-1.0": { "licenseType": "AGPL-1.0", "severity": "high", "instructions": "" }, "AGPL-3.0": { "licenseType": "AGPL-3.0", "severity": "high", "instructions": "" }, "Artistic-1.0": { "licenseType": "Artistic-1.0", "severity": "medium", "instructions": "" }, "Artistic-2.0": { "licenseType": "Artistic-2.0", "severity": "medium", "instructions": "" }, "CDDL-1.0": { "licenseType": "CDDL-1.0", "severity": "medium", "instructions": "" }, "CPOL-1.02": { "licenseType": "CPOL-1.02", "severity": "high", "instructions": "" }, "EPL-1.0": { "licenseType": "EPL-1.0", "severity": "medium", "instructions": "" }, "GPL-2.0": { "licenseType": "GPL-2.0", "severity": "high", "instructions": "" }, "GPL-3.0": { "licenseType": "GPL-3.0", "severity": "high", "instructions": "" }, "LGPL-2.0": { "licenseType": "LGPL-2.0", "severity": "medium", "instructions": "" }, "LGPL-2.1": { "licenseType": "LGPL-2.1", "severity": "medium", "instructions": "" }, "LGPL-3.0": { "licenseType": "LGPL-3.0", "severity": "medium", "instructions": "" }, "MPL-1.1": { "licenseType": "MPL-1.1", "severity": "medium", "instructions": "" }, "MPL-2.0": { "licenseType": "MPL-2.0", "severity": "medium", "instructions": "" }, "MS-RL": { "licenseType": "MS-RL", "severity": "medium", "instructions": "" }, "SimPL-2.0": { "licenseType": "SimPL-2.0", "severity": "high", "instructions": "" } } }, "packageManager": "npm", "projectId": "f69036a2-ef29-43a0-ab85-c11ddd1a61a1", "ignoreSettings": { "adminOnly": false, "reasonRequired": false, "disregardFilesystemIgnores": false }, "summary": "1 vulnerable dependency path", "remediation": { "unresolved": [ { "CVSSv3": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H/E:P", "alternativeIds": [], "creationTime": "2021-09-17T14:35:00.993728Z", "credit": [ "Yeting Li" ], "cvssScore": 7.5, "description": "## Overview\n\nAffected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when parsing crafted invalid CSS nth-checks, due to the sub-pattern `\\s*(?:([+-]?)\\s*(\\d+))?` in `RE_NTH_ELEMENT` with quantified overlapping adjacency.\n\n## Details\n\nDenial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.\n\nThe Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.\n\nLet’s take the following regular expression as an example:\n```js\nregex = /A(B|C+)+D/\n```\n\nThis regular expression accomplishes the following:\n- `A` The string must start with the letter 'A'\n- `(B|C+)+` The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the `+` matches one or more times). The `+` at the end of this section states that we can look for one or more matches of this section.\n- `D` Finally, we ensure this section of the string ends with a 'D'\n\nThe expression would match inputs such as `ABBD`, `ABCCCCD`, `ABCBCCCD` and `ACCCCCD`\n\nIt most cases, it doesn't take very long for a regex engine to find a match:\n\n```bash\n$ time node -e '/A(B|C+)+D/.test(\"ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD\")'\n0.04s user 0.01s system 95% cpu 0.052 total\n\n$ time node -e '/A(B|C+)+D/.test(\"ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX\")'\n1.79s user 0.02s system 99% cpu 1.812 total\n```\n\nThe entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.\n\nMost Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as _catastrophic backtracking_.\n\nLet's look at how our expression runs into this problem, using a shorter string: \"ACCCX\". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:\n1. CCC\n2. CC+C\n3. C+CC\n4. C+C+C.\n\nThe engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use [RegEx 101 debugger](https://regex101.com/debugger) to see the engine has to take a total of 38 steps before it can determine the string doesn't match.\n\nFrom there, the number of steps the engine must use to validate a string just continues to grow.\n\n| String | Number of C's | Number of steps |\n| -------|-------------:| -----:|\n| ACCCX | 3 | 38\n| ACCCCX | 4 | 71\n| ACCCCCX | 5 | 136\n| ACCCCCCCCCCCCCCX | 14 | 65,553\n\n\nBy the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.\n\n## Remediation\nUpgrade `nth-check` to version 2.0.1 or higher.\n## References\n- [GitHub Commit](https://github.com/fb55/nth-check/commit/9894c1d2010870c351f66c6f6efcf656e26bb726)\n", "disclosureTime": "2021-09-17T14:32:39Z", "exploit": "Proof of Concept", "functions": [], "fixedIn": [ "2.0.1" ], "id": "SNYK-JS-NTHCHECK-1586032", "identifiers": { "CWE": [ "CWE-1333" ], "CVE": [ "CVE-2021-3803" ] }, "language": "js", "malicious": false, "modificationTime": "2022-04-13T10:42:22.281450Z", "moduleName": "nth-check", "packageManager": "npm", "packageName": "nth-check", "patches": [], "proprietary": false, "publicationTime": "2021-09-17T15:20:51Z", "references": [ { "title": "GitHub Commit", "url": "https://github.com/fb55/nth-check/commit/9894c1d2010870c351f66c6f6efcf656e26bb726" } ], "severity": "high", "socialTrendAlert": false, "title": "Regular Expression Denial of Service (ReDoS)", "insights": { "triageAdvice": null }, "cvssDetails": [ { "assigner": "NVD", "cvssV3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "cvssV3BaseScore": 7.5, "severity": "high", "modificationTime": "2022-07-30T01:10:54.517007Z" } ], "functions_new": [], "semver": { "vulnerable": [ "<2.0.1" ] }, "from": [ "customer-portal@0.1.0", "react-scripts@5.0.1", "@svgr/webpack@5.5.0", "@svgr/plugin-svgo@5.5.0", "svgo@1.3.2", "css-select@2.1.0", "nth-check@1.0.2" ], "upgradePath": [], "isUpgradable": false, "isPatchable": false, "isPinnable": false, "isRuntime": false, "name": "nth-check", "version": "1.0.2", "severityWithCritical": "high" } ], "upgrade": {}, "patch": {}, "ignore": {}, "pin": {} }, "filesystemPolicy": false, "filtered": { "ignore": [], "patch": [] }, "uniqueCount": 1, "projectName": "customer-portal", "displayTargetFile": "package-lock.json", "path": "/home/someuser/jenkins/workspace/Customer Portal" }, "error-code": "VULNS", "command": "test" }, "os": "Linux 5.13", "osPlatform": "linux", "osRelease": "5.13.0-1022-aws", "osArch": "x64", "version": "1.993.0", "nodeVersion": "v16.14.2", "standalone": true, "integrationName": "JENKINS", "integrationVersion": "3.2.6", "integrationEnvironment": "", "integrationEnvironmentVersion": "", "id": "01ceefed668cf85b42fb688086416b90ba564a96", "ci": true, "durationMs": 7777, "metrics": { "network_time": { "type": "timer", "values": [ 4063 ], "total": 4063 }, "cpu_time": { "type": "synthetic", "values": [ 3714 ], "total": 3714 } } } 2022-08-29T23:36:20.212Z snyk sending request to: https://api.snyk.io/v1/analytics/cli 2022-08-29T23:36:20.212Z snyk request body size: 8874 2022-08-29T23:36:20.212Z snyk gzipped request body size: 3753 2022-08-29T23:36:20.213Z snyk not using proxy 2022-08-29T23:36:20.214Z snyk Exit code: 1 FATAL: Snyk Security scan failed. java.nio.charset.MalformedInputException: Input length = 1 at java.base/java.lang.StringCoding.throwMalformed(StringCoding.java:707) at java.base/java.lang.StringCoding.throwMalformed(StringCoding.java:713) at java.base/java.lang.StringCoding.newStringNoRepl1(StringCoding.java:1040) at java.base/java.lang.StringCoding.newStringNoRepl(StringCoding.java:1015) at java.base/java.lang.System$2.newStringNoRepl(System.java:2197) at java.base/java.nio.file.Files.readString(Files.java:3287) at hudson.FilePath$ReadToString.invoke(FilePath.java:2377) at hudson.FilePath$ReadToString.invoke(FilePath.java:2372) at hudson.FilePath.act(FilePath.java:1192) at hudson.FilePath.act(FilePath.java:1175) at hudson.FilePath.readToString(FilePath.java:2369) at io.snyk.jenkins.SnykTest.testProject(SnykTest.java:65) at io.snyk.jenkins.SnykStepFlow.testProject(SnykStepFlow.java:62) at io.snyk.jenkins.SnykStepFlow.perform(SnykStepFlow.java:36) at io.snyk.jenkins.workflow.SnykSecurityStep$Execution.run(SnykSecurityStep.java:172) at io.snyk.jenkins.workflow.SnykSecurityStep$Execution.run(SnykSecurityStep.java:159) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) [Pipeline] } [Pipeline] // stage