diff --git a/package-lock.json b/package-lock.json index 64f3dab..b72ecb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@soos-io/soos-sast", - "version": "0.1.2", + "version": "0.1.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@soos-io/soos-sast", - "version": "0.1.2", + "version": "0.1.3", "license": "MIT", "dependencies": { - "@soos-io/api-client": "^0.2.7", + "@soos-io/api-client": "^0.2.12", "argparse": "^2.0.1", "tslib": "^2.6.2" }, @@ -18,19 +18,45 @@ }, "devDependencies": { "@types/argparse": "^2.0.14", - "@types/glob": "^8.1.0", "@types/node": "^20.10.4", "prettier": "^3.1.1", "typescript": "^5.3.3" } }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@soos-io/api-client": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/@soos-io/api-client/-/api-client-0.2.7.tgz", - "integrity": "sha512-OEG3FKJigDtejc43GdRCcdpq5zSSONcFOUi8flPyKG/rqdZtObedJJJM8sOYhTd1H/izgBZnULwv0J5UPsvLIA==", + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@soos-io/api-client/-/api-client-0.2.12.tgz", + "integrity": "sha512-7rCyosYsJSKK1DrEs74UMioqJ3brpYenKO8pI3UxMiIjKx+ezRaZVzGDuliX3FRg36dxiPcjJgZxWsi3jI8eYQ==", "dependencies": { + "argparse": "^2.0.1", "axios": "^1.6.2", "form-data": "^4.0.0", + "glob": "^10.3.10", "tslib": "^2.6.2" } }, @@ -40,22 +66,6 @@ "integrity": "sha512-jJ6NMs9rXQ0rsqNt3TL4Elcwhd6wygo3lJOVoiHzURD34vsCcAlw443uGu4PXTtEmMF7sYKoadTCLXNmuJuQGw==", "dev": true }, - "node_modules/@types/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==", - "dev": true, - "dependencies": { - "@types/minimatch": "^5.1.2", - "@types/node": "*" - } - }, - "node_modules/@types/minimatch": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", - "dev": true - }, "node_modules/@types/node": { "version": "20.10.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", @@ -65,6 +75,28 @@ "undici-types": "~5.26.4" } }, + "node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -85,6 +117,35 @@ "proxy-from-env": "^1.1.0" } }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -96,6 +157,19 @@ "node": ">= 0.8" } }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -104,6 +178,16 @@ "node": ">=0.4.0" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, "node_modules/follow-redirects": { "version": "1.15.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", @@ -123,6 +207,21 @@ } } }, + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -136,6 +235,65 @@ "node": ">= 6" } }, + "node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/jackspeak": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", + "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/lru-cache": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", + "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", + "engines": { + "node": "14 || >=16.14" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -155,6 +313,51 @@ "node": ">= 0.6" } }, + "node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/prettier": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", @@ -175,6 +378,124 @@ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -198,6 +519,104 @@ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } } } } diff --git a/package.json b/package.json index 363d87a..17a0c74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soos-io/soos-sast", - "version": "0.1.2", + "version": "0.1.3", "description": "SOOS Static Application Security Testing (SAST) scanning support.", "main": "bin/index.js", "scripts": { @@ -26,13 +26,12 @@ }, "homepage": "https://github.com/soos-io/soos-sast#readme", "dependencies": { - "@soos-io/api-client": "^0.2.7", + "@soos-io/api-client": "^0.2.12", "argparse": "^2.0.1", "tslib": "^2.6.2" }, "devDependencies": { "@types/argparse": "^2.0.14", - "@types/glob": "^8.1.0", "@types/node": "^20.10.4", "prettier": "^3.1.1", "typescript": "^5.3.3" diff --git a/src/constants.ts b/src/constants.ts index 13e8027..428c115 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,3 +1,4 @@ export const SOOS_SAST_CONSTANTS = { - FilePatternRegex: /\.sarif\.json$/, + FilePattern: "**/*.sarif.json", + MaxFiles: 50, }; diff --git a/src/index.ts b/src/index.ts index c85e738..3bd4fd1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,26 +3,16 @@ import { IntegrationName, IntegrationType, LogLevel, - SOOS_CONSTANTS, ScanStatus, ScanType, soosLogger, } from "@soos-io/api-client"; -import { - getEnvVariable, - obfuscateProperties, - ensureEnumValue, - ensureValue, - ensureNonEmptyValue, -} from "@soos-io/api-client/dist/utilities"; -import { ArgumentParser } from "argparse"; -import * as FileSystem from "fs"; -import * as Path from "path"; -import FormData from "form-data"; +import { obfuscateProperties, ensureNonEmptyValue } from "@soos-io/api-client/dist/utilities"; import { exit } from "process"; -import SOOSAnalysisApiClient from "@soos-io/api-client/dist/api/SOOSAnalysisApiClient"; -import { SOOS_SAST_CONSTANTS } from "./constants"; import { version } from "../package.json"; +import AnalysisService from "@soos-io/api-client/dist/services/AnalysisService"; +import AnalysisArgumentParser from "@soos-io/api-client/dist/services/AnalysisArgumentParser"; +import { SOOS_SAST_CONSTANTS } from "./constants"; interface SOOSSASTAnalysisArgs { apiKey: string; @@ -34,13 +24,18 @@ interface SOOSSASTAnalysisArgs { buildVersion: string; clientId: string; commitHash: string; + contributingDeveloperId: string; + contributingDeveloperSource: string; + contributingDeveloperSourceName: string; + directoriesToExclude: Array; + filesToExclude: Array; integrationName: IntegrationName; integrationType: IntegrationType; logLevel: LogLevel; operatingEnvironment: string; projectName: string; scriptVersion: string; - sastPath: string; + sourceCodePath: string; verbose: boolean; } @@ -48,133 +43,84 @@ class SOOSSASTAnalysis { constructor(private args: SOOSSASTAnalysisArgs) {} static parseArgs(): SOOSSASTAnalysisArgs { - const parser = new ArgumentParser({ description: "SOOS SAST" }); + const analysisArgumentParser = AnalysisArgumentParser.create(ScanType.SAST); - parser.add_argument("--apiKey", { - help: "SOOS API Key - get yours from https://app.soos.io/integrate/sast", - default: getEnvVariable(SOOS_CONSTANTS.EnvironmentVariables.ApiKey), - required: false, - }); + analysisArgumentParser.addBaseScanArguments( + IntegrationName.SoosSast, + IntegrationType.Script, + version, + ); - parser.add_argument("--apiURL", { - help: "SOOS API URL - Intended for internal use only, do not modify.", - default: "https://api.soos.io/api/", - required: false, + analysisArgumentParser.argumentParser.add_argument("--directoriesToExclude", { + help: "Listing of directories or patterns to exclude from the search for manifest files. eg: **bin/start/**, **/start/**", type: (value: string) => { - return ensureNonEmptyValue(value, "apiURL"); + return value.split(",").map((pattern) => pattern.trim()); }, - }); - - parser.add_argument("--appVersion", { - help: "App Version - Intended for internal use only.", - required: false, - }); - - parser.add_argument("--branchName", { - help: "The name of the branch from the SCM System.", - required: false, - }); - - parser.add_argument("--branchURI", { - help: "The URI to the branch from the SCM System.", - required: false, - }); - - parser.add_argument("--buildURI", { - help: "URI to CI build info.", - required: false, - }); - - parser.add_argument("--buildVersion", { - help: "Version of application build artifacts.", - required: false, - }); - - parser.add_argument("--clientId", { - help: "SOOS Client ID - get yours from https://app.soos.io/integrate/sast", - default: getEnvVariable(SOOS_CONSTANTS.EnvironmentVariables.ClientId), - required: false, - }); - - parser.add_argument("--commitHash", { - help: "The commit hash value from the SCM System.", - required: false, - }); - - parser.add_argument("--integrationName", { - help: "Integration Name - Intended for internal use only.", required: false, - type: (value: string) => { - return ensureEnumValue(IntegrationName, value); - }, - default: IntegrationName.SoosSast, }); - parser.add_argument("--integrationType", { - help: "Integration Type - Intended for internal use only.", - required: false, + analysisArgumentParser.argumentParser.add_argument("--filesToExclude", { + help: "Listing of files or patterns patterns to exclude from the search for manifest files. eg: **/sa**.sarif.json/, **/sast.sarif.json", type: (value: string) => { - return ensureEnumValue(IntegrationType, value); + return value.split(",").map((pattern) => pattern.trim()); }, - default: IntegrationType.Script, - }); - - parser.add_argument("--logLevel", { - help: "Minimum level to show logs: PASS, IGNORE, INFO, WARN or FAIL.", - default: LogLevel.INFO, required: false, - type: (value: string) => { - return ensureEnumValue(LogLevel, value); - }, }); - parser.add_argument("--operatingEnvironment", { - help: "Set Operating environment for information purposes only.", + analysisArgumentParser.argumentParser.add_argument("--sourceCodePath", { + help: "The path to start searching for SAST files.", required: false, - }); - - parser.add_argument("--projectName", { - help: "Project Name - this is what will be displayed in the SOOS app.", - required: true, - }); - - parser.add_argument("--scriptVersion", { - help: "Script Version - Intended for internal use only.", - required: false, - default: version, - }); - - parser.add_argument("--verbose", { - help: "Enable verbose logging.", - action: "store_true", - default: false, - required: false, - }); - - parser.add_argument("sastPath", { - help: "The SAST File to scan (*.sarif.json), it could be the location of the file or the file itself. When location is specified only the first file found will be scanned.", + default: process.cwd(), }); soosLogger.info("Parsing arguments"); - return parser.parse_args(); + return analysisArgumentParser.parseArguments(); } async runAnalysis(): Promise { + const scanType = ScanType.SAST; + const soosAnalysisService = AnalysisService.create(this.args.apiKey, this.args.apiURL); + let projectHash: string | undefined; let branchHash: string | undefined; let analysisId: string | undefined; - const filePath = await this.findSASTFilePath(); - const soosAnalysisApiClient = new SOOSAnalysisApiClient(this.args.apiKey, this.args.apiURL); + let scanStatusUrl: string | undefined; + try { + const { filePaths, hasMoreThanMaximumFiles } = await soosAnalysisService.findAnalysisFiles( + scanType, + this.args.sourceCodePath, + SOOS_SAST_CONSTANTS.FilePattern, + this.args.filesToExclude, + this.args.directoriesToExclude, + SOOS_SAST_CONSTANTS.MaxFiles, + ); + + if (filePaths.length === 0) { + throw new Error("No SAST files found."); + } + soosLogger.info("Starting SOOS SAST Analysis"); soosLogger.info(`Creating scan for project '${this.args.projectName}'...`); soosLogger.info(`Branch Name: ${this.args.branchName}`); - const result = await soosAnalysisApiClient.createScan({ + const result = await soosAnalysisService.setupScan({ clientId: this.args.clientId, projectName: this.args.projectName, commitHash: this.args.commitHash, - branch: this.args.branchName, + contributingDeveloperAudit: + !this.args.contributingDeveloperId || + !this.args.contributingDeveloperSource || + !this.args.contributingDeveloperSourceName + ? [] + : [ + { + contributingDeveloperId: this.args.contributingDeveloperId, + source: this.args.contributingDeveloperSource, + sourceName: this.args.contributingDeveloperSourceName, + }, + ], + branchName: this.args.branchName, buildVersion: this.args.buildVersion, buildUri: this.args.buildUri, branchUri: this.args.branchUri, @@ -182,16 +128,16 @@ class SOOSSASTAnalysis { operatingEnvironment: this.args.operatingEnvironment, integrationName: this.args.integrationName, appVersion: this.args.appVersion, - scriptVersion: null, - contributingDeveloperAudit: undefined, - scanType: ScanType.SAST, - toolName: null, - toolVersion: null, + scanType, + scriptVersion: this.args.scriptVersion, + toolName: undefined, + toolVersion: undefined, }); projectHash = result.projectHash; branchHash = result.branchHash; analysisId = result.analysisId; + scanStatusUrl = result.scanStatusUrl; soosLogger.info(`Project Hash: ${projectHash}`); soosLogger.info(`Branch Hash: ${branchHash}`); @@ -199,77 +145,44 @@ class SOOSSASTAnalysis { soosLogger.info("Scan created successfully."); soosLogger.logLineSeparator(); - soosLogger.info("Uploading SAST File"); + soosLogger.info("Uploading SAST Files"); - const formData = await this.getSastAsFormData(filePath); + const formData = await soosAnalysisService.getAnalysisFilesAsFormData( + filePaths, + this.args.sourceCodePath, + ); - await soosAnalysisApiClient.uploadScanToolResult({ + await soosAnalysisService.analysisApiClient.uploadScanToolResult({ clientId: this.args.clientId, projectHash, branchHash, - scanType: ScanType.SAST, + scanType, scanId: analysisId, resultFile: formData, + hasMoreThanMaximumFiles, }); - soosLogger.info(`Scan result uploaded successfully`); - soosLogger.logLineSeparator(); soosLogger.info( - `Analysis scan started successfully, to see the results visit: ${result.scanUrl}`, + `Scan results uploaded successfully. To see the results visit: ${result.scanUrl}`, ); } catch (error) { if (projectHash && branchHash && analysisId) - await soosAnalysisApiClient.updateScanStatus({ + await soosAnalysisService.updateScanStatus({ + analysisId, clientId: this.args.clientId, projectHash, branchHash, - scanType: ScanType.SAST, - scanId: analysisId, + scanType, status: ScanStatus.Error, message: `Error while performing scan.`, + scanStatusUrl, }); soosLogger.error(error); exit(1); } } - async getSastAsFormData(filePath: string): Promise { - try { - const fileReadStream = FileSystem.createReadStream(filePath, { - encoding: SOOS_CONSTANTS.FileUploads.Encoding, - }); - - const formData = new FormData(); - formData.append("file", fileReadStream); - return formData; - } catch (error) { - soosLogger.error(`Error on getSastAsFormData: ${error}`); - throw error; - } - } - - async findSASTFilePath(): Promise { - const sastPathStat = await FileSystem.statSync(this.args.sastPath); - - if (sastPathStat.isDirectory()) { - const files = await FileSystem.promises.readdir(this.args.sastPath); - const sastFile = files.find((file) => SOOS_SAST_CONSTANTS.FilePatternRegex.test(file)); - - if (!sastFile) { - throw new Error("No SAST file found in the directory."); - } - - return Path.join(this.args.sastPath, sastFile); - } - - if (!SOOS_SAST_CONSTANTS.FilePatternRegex.test(this.args.sastPath)) { - throw new Error("The file does not match the required SAST pattern."); - } - - return this.args.sastPath; - } - static async createAndRun(): Promise { soosLogger.info("Starting SOOS SAST Analysis"); soosLogger.logLineSeparator(); @@ -285,8 +198,8 @@ class SOOSSASTAnalysis { 2, ), ); - ensureValue(args.clientId, "clientId"); - ensureValue(args.apiKey, "apiKey"); + ensureNonEmptyValue(args.clientId, "clientId"); + ensureNonEmptyValue(args.apiKey, "apiKey"); soosLogger.logLineSeparator(); const soosSASTAnalysis = new SOOSSASTAnalysis(args); await soosSASTAnalysis.runAnalysis();