diff --git a/README.md b/README.md index c48cfb6..62a4595 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Zscaler Infrastructure as Code (IaC) Scan action detects security violations in the IaC deployment files that are placed within your GitHub repositories. -To start using the Zscaler IaC Scan action as part of your workflows, complete the following steps: +To start using the Zscaler IaC Scan action as part of your workflows, complete the following steps: 1. Log into the Zscaler Workload Posture (ZWP) Admin Portal. 2. Within the ZWP Admin Portal, start the GitHub Actions onboarding process. Make sure you create a unique identifier and note the generated client ID and client secret key. @@ -43,16 +43,20 @@ jobs: sarif_file: ${{ steps.zscaler-iac-scan.outputs.sarif_file_path }} ``` -Setup Guidance : +Setup Guidelines: -1. Setup repo secrets : [Github secrets](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets) -2. Setup github workflows : [Github Actions](https://docs.github.com/en/actions/learn-github-actions/) +1. Set up repository secrets: [GitHub secrets](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets) +2. Set up GitHub workflows: [GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/) -Configuration Parameters : +Configuration Parameters: 1. client_id and client_secret: Generated from the ZWP Admin Portal as mentioned in step 2 above. 2. region: The region (e.g., US) you use for ZWP. 3. iac_dir: Directory path from root on which you want to trigger the IaC scan. 4. iac_file: File path from root where you want to trigger the IaC scan. This path is not required when iac_dir is present. 5. output_format: The Zscaler IaC Scan results/output is written to the desired file formats as specified in the YAML script and placed in the workspace where the code is checked out during a job trigger. -6. fail_build: Set this value to true or false. If you don't want the Zscaler IaC Scan app to fail the workflow build when severe violations are found post the scan process, set the value to false. \ No newline at end of file +6. fail_build: Set this value to true or false. If you don't want the Zscaler IaC Scan app to fail the workflow build when severe violations are found post the scan process, set the value to false. + +Action Outputs : +1.sarif_file_path : The path to the generated sarif file in the workspace. +2.scan_status : The final status of the IaC scan. It is either passed/failed. \ No newline at end of file diff --git a/action.yml b/action.yml index 2eaf177..6a96b3c 100644 --- a/action.yml +++ b/action.yml @@ -1,10 +1,10 @@ name : 'Zscaler IaC Scan' description: 'Zscaler scanner to identify the vulnerabilities and violations within deployment IAC files' - +author : 'Zscaler CWP' +branding: + icon: 'shield' + color: 'blue' inputs: # user can input the name inside the name of user variable , descriptions etc - GITHUB_TOKEN: - description: 'GitHub token' - required: true client_id : description : 'Zscanner ClientID' required: true @@ -13,7 +13,7 @@ inputs: # user can input the name inside the name of user variable , description required : true region: description: 'Zscanner Login Region' - required : false + required : true iac_dir : description: 'The IAC folder which needs scan' required : false @@ -28,6 +28,11 @@ inputs: # user can input the name inside the name of user variable , description required : false log_level : description : 'This is to run the scanner in a specific log mode. Accepted Levels are debug/info/warn/error/panic/fatal' +outputs: + sarif_file_path: + description: 'Path for the sarif file generated on IaC scan' + scan_status: + description: 'Final status of IaC scan. Can be passed/failed/aborted' runs: using: 'node16' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index dbbf7f4..a7dbd1e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,7 +1,7 @@ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ 7351: +/***/ 2690: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -28,7 +28,7 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issue = exports.issueCommand = void 0; const os = __importStar(__nccwpck_require__(2037)); -const utils_1 = __nccwpck_require__(5278); +const utils_1 = __nccwpck_require__(353); /** * Commands * @@ -100,7 +100,7 @@ function escapeProperty(s) { /***/ }), -/***/ 2186: +/***/ 9935: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -135,12 +135,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(7351); -const file_command_1 = __nccwpck_require__(717); -const utils_1 = __nccwpck_require__(5278); +const command_1 = __nccwpck_require__(2690); +const file_command_1 = __nccwpck_require__(5898); +const utils_1 = __nccwpck_require__(353); const os = __importStar(__nccwpck_require__(2037)); const path = __importStar(__nccwpck_require__(1017)); -const oidc_utils_1 = __nccwpck_require__(8041); +const oidc_utils_1 = __nccwpck_require__(7901); /** * The code to exit an action */ @@ -419,7 +419,7 @@ exports.getIDToken = getIDToken; /***/ }), -/***/ 717: +/***/ 5898: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -450,7 +450,7 @@ exports.issueCommand = void 0; /* eslint-disable @typescript-eslint/no-explicit-any */ const fs = __importStar(__nccwpck_require__(7147)); const os = __importStar(__nccwpck_require__(2037)); -const utils_1 = __nccwpck_require__(5278); +const utils_1 = __nccwpck_require__(353); function issueCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { @@ -468,7 +468,7 @@ exports.issueCommand = issueCommand; /***/ }), -/***/ 8041: +/***/ 7901: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -484,9 +484,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(9925); -const auth_1 = __nccwpck_require__(3702); -const core_1 = __nccwpck_require__(2186); +const http_client_1 = __nccwpck_require__(2659); +const auth_1 = __nccwpck_require__(2136); +const core_1 = __nccwpck_require__(9935); class OidcClient { static createHttpClient(allowRetry = true, maxRetry = 10) { const requestOptions = { @@ -552,7 +552,7 @@ exports.OidcClient = OidcClient; /***/ }), -/***/ 5278: +/***/ 353: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -599,7 +599,7 @@ exports.toCommandProperties = toCommandProperties; /***/ }), -/***/ 4087: +/***/ 3870: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -660,7 +660,7 @@ exports.Context = Context; /***/ }), -/***/ 5438: +/***/ 2835: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -686,8 +686,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOctokit = exports.context = void 0; -const Context = __importStar(__nccwpck_require__(4087)); -const utils_1 = __nccwpck_require__(3030); +const Context = __importStar(__nccwpck_require__(3870)); +const utils_1 = __nccwpck_require__(8997); exports.context = new Context.Context(); /** * Returns a hydrated octokit ready to use for GitHub Actions @@ -703,7 +703,7 @@ exports.getOctokit = getOctokit; /***/ }), -/***/ 7914: +/***/ 4818: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -729,7 +729,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0; -const httpClient = __importStar(__nccwpck_require__(9925)); +const httpClient = __importStar(__nccwpck_require__(2659)); function getAuthString(token, options) { if (!token && !options.auth) { throw new Error('Parameter token or opts.auth is required'); @@ -753,7 +753,7 @@ exports.getApiBaseUrl = getApiBaseUrl; /***/ }), -/***/ 3030: +/***/ 8997: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -779,12 +779,12 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOctokitOptions = exports.GitHub = exports.context = void 0; -const Context = __importStar(__nccwpck_require__(4087)); -const Utils = __importStar(__nccwpck_require__(7914)); +const Context = __importStar(__nccwpck_require__(3870)); +const Utils = __importStar(__nccwpck_require__(4818)); // octokit + plugins -const core_1 = __nccwpck_require__(6762); -const plugin_rest_endpoint_methods_1 = __nccwpck_require__(3044); -const plugin_paginate_rest_1 = __nccwpck_require__(4193); +const core_1 = __nccwpck_require__(3056); +const plugin_rest_endpoint_methods_1 = __nccwpck_require__(8683); +const plugin_paginate_rest_1 = __nccwpck_require__(843); exports.context = new Context.Context(); const baseUrl = Utils.getApiBaseUrl(); const defaults = { @@ -814,7 +814,7 @@ exports.getOctokitOptions = getOctokitOptions; /***/ }), -/***/ 3702: +/***/ 2136: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -880,7 +880,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 9925: +/***/ 2659: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -888,7 +888,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand Object.defineProperty(exports, "__esModule", ({ value: true })); const http = __nccwpck_require__(3685); const https = __nccwpck_require__(5687); -const pm = __nccwpck_require__(6443); +const pm = __nccwpck_require__(7142); let tunnel; var HttpCodes; (function (HttpCodes) { @@ -1307,7 +1307,7 @@ class HttpClient { if (useProxy) { // If using proxy, need tunnel if (!tunnel) { - tunnel = __nccwpck_require__(4294); + tunnel = __nccwpck_require__(7477); } const agentOptions = { maxSockets: maxSockets, @@ -1425,7 +1425,7 @@ exports.HttpClient = HttpClient; /***/ }), -/***/ 6443: +/***/ 7142: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1490,7 +1490,7 @@ exports.checkBypass = checkBypass; /***/ }), -/***/ 334: +/***/ 635: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1553,7 +1553,7 @@ exports.createTokenAuth = createTokenAuth; /***/ }), -/***/ 6762: +/***/ 3056: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1561,11 +1561,11 @@ exports.createTokenAuth = createTokenAuth; Object.defineProperty(exports, "__esModule", ({ value: true })); -var universalUserAgent = __nccwpck_require__(5030); -var beforeAfterHook = __nccwpck_require__(3682); -var request = __nccwpck_require__(6234); -var graphql = __nccwpck_require__(8467); -var authToken = __nccwpck_require__(334); +var universalUserAgent = __nccwpck_require__(5489); +var beforeAfterHook = __nccwpck_require__(5514); +var request = __nccwpck_require__(6302); +var graphql = __nccwpck_require__(2555); +var authToken = __nccwpck_require__(635); function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; @@ -1737,7 +1737,7 @@ exports.Octokit = Octokit; /***/ }), -/***/ 9440: +/***/ 7588: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1745,8 +1745,8 @@ exports.Octokit = Octokit; Object.defineProperty(exports, "__esModule", ({ value: true })); -var isPlainObject = __nccwpck_require__(3287); -var universalUserAgent = __nccwpck_require__(5030); +var isPlainObject = __nccwpck_require__(6765); +var universalUserAgent = __nccwpck_require__(5489); function lowercaseKeys(object) { if (!object) { @@ -2135,7 +2135,7 @@ exports.endpoint = endpoint; /***/ }), -/***/ 8467: +/***/ 2555: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -2143,8 +2143,8 @@ exports.endpoint = endpoint; Object.defineProperty(exports, "__esModule", ({ value: true })); -var request = __nccwpck_require__(6234); -var universalUserAgent = __nccwpck_require__(5030); +var request = __nccwpck_require__(6302); +var universalUserAgent = __nccwpck_require__(5489); const VERSION = "4.8.0"; @@ -2261,7 +2261,7 @@ exports.withCustomRequest = withCustomRequest; /***/ }), -/***/ 4193: +/***/ 843: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -2486,7 +2486,7 @@ exports.paginatingEndpoints = paginatingEndpoints; /***/ }), -/***/ 3044: +/***/ 8683: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -3519,7 +3519,7 @@ exports.restEndpointMethods = restEndpointMethods; /***/ }), -/***/ 537: +/***/ 9475: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -3529,8 +3529,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var deprecation = __nccwpck_require__(8932); -var once = _interopDefault(__nccwpck_require__(1223)); +var deprecation = __nccwpck_require__(239); +var once = _interopDefault(__nccwpck_require__(8059)); const logOnceCode = once(deprecation => console.warn(deprecation)); const logOnceHeaders = once(deprecation => console.warn(deprecation)); @@ -3601,7 +3601,7 @@ exports.RequestError = RequestError; /***/ }), -/***/ 6234: +/***/ 6302: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -3611,11 +3611,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var endpoint = __nccwpck_require__(9440); -var universalUserAgent = __nccwpck_require__(5030); -var isPlainObject = __nccwpck_require__(3287); -var nodeFetch = _interopDefault(__nccwpck_require__(467)); -var requestError = __nccwpck_require__(537); +var endpoint = __nccwpck_require__(7588); +var universalUserAgent = __nccwpck_require__(5489); +var isPlainObject = __nccwpck_require__(6765); +var nodeFetch = _interopDefault(__nccwpck_require__(4060)); +var requestError = __nccwpck_require__(9475); const VERSION = "5.6.3"; @@ -3786,34 +3786,34 @@ exports.request = request; /***/ }), -/***/ 6545: +/***/ 6605: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(2618); +module.exports = __nccwpck_require__(3384); /***/ }), -/***/ 8104: +/***/ 2787: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); -var settle = __nccwpck_require__(3211); -var buildFullPath = __nccwpck_require__(1934); -var buildURL = __nccwpck_require__(646); +var utils = __nccwpck_require__(6218); +var settle = __nccwpck_require__(7084); +var buildFullPath = __nccwpck_require__(9263); +var buildURL = __nccwpck_require__(9185); var http = __nccwpck_require__(3685); var https = __nccwpck_require__(5687); -var httpFollow = (__nccwpck_require__(7707).http); -var httpsFollow = (__nccwpck_require__(7707).https); +var httpFollow = (__nccwpck_require__(4214).http); +var httpsFollow = (__nccwpck_require__(4214).https); var url = __nccwpck_require__(7310); var zlib = __nccwpck_require__(9796); -var VERSION = (__nccwpck_require__(4322).version); -var createError = __nccwpck_require__(5226); -var enhanceError = __nccwpck_require__(1516); -var defaults = __nccwpck_require__(8190); -var Cancel = __nccwpck_require__(8875); +var VERSION = (__nccwpck_require__(415).version); +var createError = __nccwpck_require__(5414); +var enhanceError = __nccwpck_require__(5299); +var defaults = __nccwpck_require__(4589); +var Cancel = __nccwpck_require__(2792); var isHttps = /https:?/; @@ -3859,10 +3859,8 @@ module.exports = function httpAdapter(config) { done(); resolvePromise(value); }; - var rejected = false; var reject = function reject(value) { done(); - rejected = true; rejectPromise(value); }; var data = config.data; @@ -3900,10 +3898,6 @@ module.exports = function httpAdapter(config) { )); } - if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) { - return reject(createError('Request body larger than maxBodyLength limit', config)); - } - // Add Content-Length header if data exists if (!headerNames['content-length']) { headers['Content-Length'] = data.length; @@ -3937,16 +3931,6 @@ module.exports = function httpAdapter(config) { var isHttpsRequest = isHttps.test(protocol); var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; - try { - buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''); - } catch (err) { - var customErr = new Error(err.message); - customErr.config = config; - customErr.url = config.url; - customErr.exists = true; - reject(customErr); - } - var options = { path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), method: config.method.toUpperCase(), @@ -4084,40 +4068,27 @@ module.exports = function httpAdapter(config) { // make sure the content length is not over the maxContentLength if specified if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) { - // stream.destoy() emit aborted event before calling reject() on Node.js v16 - rejected = true; stream.destroy(); reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded', config, null, lastRequest)); } }); - stream.on('aborted', function handlerStreamAborted() { - if (rejected) { - return; - } - stream.destroy(); - reject(createError('error request aborted', config, 'ERR_REQUEST_ABORTED', lastRequest)); - }); - stream.on('error', function handleStreamError(err) { if (req.aborted) return; reject(enhanceError(err, config, null, lastRequest)); }); stream.on('end', function handleStreamEnd() { - try { - var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer); - if (config.responseType !== 'arraybuffer') { - responseData = responseData.toString(config.responseEncoding); - if (!config.responseEncoding || config.responseEncoding === 'utf8') { - responseData = utils.stripBOM(responseData); - } + var responseData = Buffer.concat(responseBuffer); + if (config.responseType !== 'arraybuffer') { + responseData = responseData.toString(config.responseEncoding); + if (!config.responseEncoding || config.responseEncoding === 'utf8') { + responseData = utils.stripBOM(responseData); } - response.data = responseData; - } catch (err) { - reject(enhanceError(err, config, err.code, response.request, response)); } + + response.data = responseData; settle(resolve, reject, response); }); } @@ -4129,12 +4100,6 @@ module.exports = function httpAdapter(config) { reject(enhanceError(err, config, null, req)); }); - // set tcp keep alive to prevent drop connection by peer - req.on('socket', function handleRequestSocket(socket) { - // default interval of sending ack packet is 1 minute - socket.setKeepAlive(true, 1000 * 60); - }); - // Handle request timeout if (config.timeout) { // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types. @@ -4158,15 +4123,9 @@ module.exports = function httpAdapter(config) { // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. req.setTimeout(timeout, function handleRequestTimeout() { req.abort(); - var timeoutErrorMessage = ''; - if (config.timeoutErrorMessage) { - timeoutErrorMessage = config.timeoutErrorMessage; - } else { - timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; - } var transitional = config.transitional || defaults.transitional; reject(createError( - timeoutErrorMessage, + 'timeout of ' + timeout + 'ms exceeded', config, transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED', req @@ -4205,22 +4164,22 @@ module.exports = function httpAdapter(config) { /***/ }), -/***/ 3454: +/***/ 5005: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); -var settle = __nccwpck_require__(3211); -var cookies = __nccwpck_require__(1545); -var buildURL = __nccwpck_require__(646); -var buildFullPath = __nccwpck_require__(1934); -var parseHeaders = __nccwpck_require__(6455); -var isURLSameOrigin = __nccwpck_require__(3608); -var createError = __nccwpck_require__(5226); -var defaults = __nccwpck_require__(8190); -var Cancel = __nccwpck_require__(8875); +var utils = __nccwpck_require__(6218); +var settle = __nccwpck_require__(7084); +var cookies = __nccwpck_require__(4914); +var buildURL = __nccwpck_require__(9185); +var buildFullPath = __nccwpck_require__(9263); +var parseHeaders = __nccwpck_require__(8216); +var isURLSameOrigin = __nccwpck_require__(6281); +var createError = __nccwpck_require__(5414); +var defaults = __nccwpck_require__(4589); +var Cancel = __nccwpck_require__(2792); module.exports = function xhrAdapter(config) { return new Promise(function dispatchXhrRequest(resolve, reject) { @@ -4425,17 +4384,17 @@ module.exports = function xhrAdapter(config) { /***/ }), -/***/ 2618: +/***/ 3384: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); -var bind = __nccwpck_require__(7065); -var Axios = __nccwpck_require__(8178); -var mergeConfig = __nccwpck_require__(4831); -var defaults = __nccwpck_require__(8190); +var utils = __nccwpck_require__(6218); +var bind = __nccwpck_require__(7759); +var Axios = __nccwpck_require__(3737); +var mergeConfig = __nccwpck_require__(3776); +var defaults = __nccwpck_require__(4589); /** * Create an instance of Axios @@ -4468,19 +4427,19 @@ var axios = createInstance(defaults); axios.Axios = Axios; // Expose Cancel & CancelToken -axios.Cancel = __nccwpck_require__(8875); -axios.CancelToken = __nccwpck_require__(1587); -axios.isCancel = __nccwpck_require__(4057); -axios.VERSION = (__nccwpck_require__(4322).version); +axios.Cancel = __nccwpck_require__(2792); +axios.CancelToken = __nccwpck_require__(21); +axios.isCancel = __nccwpck_require__(2501); +axios.VERSION = (__nccwpck_require__(415).version); // Expose all/spread axios.all = function all(promises) { return Promise.all(promises); }; -axios.spread = __nccwpck_require__(4850); +axios.spread = __nccwpck_require__(3861); // Expose isAxiosError -axios.isAxiosError = __nccwpck_require__(650); +axios.isAxiosError = __nccwpck_require__(3932); module.exports = axios; @@ -4490,7 +4449,7 @@ module.exports["default"] = axios; /***/ }), -/***/ 8875: +/***/ 2792: /***/ ((module) => { "use strict"; @@ -4517,13 +4476,13 @@ module.exports = Cancel; /***/ }), -/***/ 1587: +/***/ 21: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var Cancel = __nccwpck_require__(8875); +var Cancel = __nccwpck_require__(2792); /** * A `CancelToken` is an object that can be used to request cancellation of an operation. @@ -4644,7 +4603,7 @@ module.exports = CancelToken; /***/ }), -/***/ 4057: +/***/ 2501: /***/ ((module) => { "use strict"; @@ -4657,18 +4616,18 @@ module.exports = function isCancel(value) { /***/ }), -/***/ 8178: +/***/ 3737: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); -var buildURL = __nccwpck_require__(646); -var InterceptorManager = __nccwpck_require__(3214); -var dispatchRequest = __nccwpck_require__(5062); -var mergeConfig = __nccwpck_require__(4831); -var validator = __nccwpck_require__(1632); +var utils = __nccwpck_require__(6218); +var buildURL = __nccwpck_require__(9185); +var InterceptorManager = __nccwpck_require__(7119); +var dispatchRequest = __nccwpck_require__(7987); +var mergeConfig = __nccwpck_require__(3776); +var validator = __nccwpck_require__(9047); var validators = validator.validators; /** @@ -4689,14 +4648,14 @@ function Axios(instanceConfig) { * * @param {Object} config The config specific for this request (merged with this.defaults) */ -Axios.prototype.request = function request(configOrUrl, config) { +Axios.prototype.request = function request(config) { /*eslint no-param-reassign:0*/ // Allow for axios('example/url'[, config]) a la fetch API - if (typeof configOrUrl === 'string') { - config = config || {}; - config.url = configOrUrl; + if (typeof config === 'string') { + config = arguments[1] || {}; + config.url = arguments[0]; } else { - config = configOrUrl || {}; + config = config || {}; } config = mergeConfig(this.defaults, config); @@ -4813,13 +4772,13 @@ module.exports = Axios; /***/ }), -/***/ 3214: +/***/ 7119: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); +var utils = __nccwpck_require__(6218); function InterceptorManager() { this.handlers = []; @@ -4875,14 +4834,14 @@ module.exports = InterceptorManager; /***/ }), -/***/ 1934: +/***/ 9263: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var isAbsoluteURL = __nccwpck_require__(1301); -var combineURLs = __nccwpck_require__(7189); +var isAbsoluteURL = __nccwpck_require__(7462); +var combineURLs = __nccwpck_require__(2796); /** * Creates a new URL by combining the baseURL with the requestedURL, @@ -4903,13 +4862,13 @@ module.exports = function buildFullPath(baseURL, requestedURL) { /***/ }), -/***/ 5226: +/***/ 5414: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var enhanceError = __nccwpck_require__(1516); +var enhanceError = __nccwpck_require__(5299); /** * Create an Error with the specified message, config, error code, request and response. @@ -4929,17 +4888,17 @@ module.exports = function createError(message, config, code, request, response) /***/ }), -/***/ 5062: +/***/ 7987: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); -var transformData = __nccwpck_require__(9812); -var isCancel = __nccwpck_require__(4057); -var defaults = __nccwpck_require__(8190); -var Cancel = __nccwpck_require__(8875); +var utils = __nccwpck_require__(6218); +var transformData = __nccwpck_require__(3783); +var isCancel = __nccwpck_require__(2501); +var defaults = __nccwpck_require__(4589); +var Cancel = __nccwpck_require__(2792); /** * Throws a `Cancel` if cancellation has been requested. @@ -5024,7 +4983,7 @@ module.exports = function dispatchRequest(config) { /***/ }), -/***/ 1516: +/***/ 5299: /***/ ((module) => { "use strict"; @@ -5075,13 +5034,13 @@ module.exports = function enhanceError(error, config, code, request, response) { /***/ }), -/***/ 4831: +/***/ 3776: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); +var utils = __nccwpck_require__(6218); /** * Config-specific merge-function which creates a new config-object @@ -5182,13 +5141,13 @@ module.exports = function mergeConfig(config1, config2) { /***/ }), -/***/ 3211: +/***/ 7084: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var createError = __nccwpck_require__(5226); +var createError = __nccwpck_require__(5414); /** * Resolve or reject a Promise based on response status. @@ -5215,14 +5174,14 @@ module.exports = function settle(resolve, reject, response) { /***/ }), -/***/ 9812: +/***/ 3783: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); -var defaults = __nccwpck_require__(8190); +var utils = __nccwpck_require__(6218); +var defaults = __nccwpck_require__(4589); /** * Transform the data for a request or a response @@ -5245,15 +5204,15 @@ module.exports = function transformData(data, headers, fns) { /***/ }), -/***/ 8190: +/***/ 4589: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); -var normalizeHeaderName = __nccwpck_require__(6240); -var enhanceError = __nccwpck_require__(1516); +var utils = __nccwpck_require__(6218); +var normalizeHeaderName = __nccwpck_require__(2480); +var enhanceError = __nccwpck_require__(5299); var DEFAULT_CONTENT_TYPE = { 'Content-Type': 'application/x-www-form-urlencoded' @@ -5269,10 +5228,10 @@ function getDefaultAdapter() { var adapter; if (typeof XMLHttpRequest !== 'undefined') { // For browsers use XHR adapter - adapter = __nccwpck_require__(3454); + adapter = __nccwpck_require__(5005); } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { // For node use HTTP adapter - adapter = __nccwpck_require__(8104); + adapter = __nccwpck_require__(2787); } return adapter; } @@ -5387,16 +5346,16 @@ module.exports = defaults; /***/ }), -/***/ 4322: +/***/ 415: /***/ ((module) => { module.exports = { - "version": "0.26.0" + "version": "0.24.0" }; /***/ }), -/***/ 7065: +/***/ 7759: /***/ ((module) => { "use strict"; @@ -5415,13 +5374,13 @@ module.exports = function bind(fn, thisArg) { /***/ }), -/***/ 646: +/***/ 9185: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); +var utils = __nccwpck_require__(6218); function encode(val) { return encodeURIComponent(val). @@ -5493,7 +5452,7 @@ module.exports = function buildURL(url, params, paramsSerializer) { /***/ }), -/***/ 7189: +/***/ 2796: /***/ ((module) => { "use strict"; @@ -5515,13 +5474,13 @@ module.exports = function combineURLs(baseURL, relativeURL) { /***/ }), -/***/ 1545: +/***/ 4914: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); +var utils = __nccwpck_require__(6218); module.exports = ( utils.isStandardBrowserEnv() ? @@ -5576,7 +5535,7 @@ module.exports = ( /***/ }), -/***/ 1301: +/***/ 7462: /***/ ((module) => { "use strict"; @@ -5592,20 +5551,18 @@ module.exports = function isAbsoluteURL(url) { // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed // by any combination of letters, digits, plus, period, or hyphen. - return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); }; /***/ }), -/***/ 650: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 3932: +/***/ ((module) => { "use strict"; -var utils = __nccwpck_require__(328); - /** * Determines whether the payload is an error thrown by Axios * @@ -5613,19 +5570,19 @@ var utils = __nccwpck_require__(328); * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false */ module.exports = function isAxiosError(payload) { - return utils.isObject(payload) && (payload.isAxiosError === true); + return (typeof payload === 'object') && (payload.isAxiosError === true); }; /***/ }), -/***/ 3608: +/***/ 6281: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); +var utils = __nccwpck_require__(6218); module.exports = ( utils.isStandardBrowserEnv() ? @@ -5695,13 +5652,13 @@ module.exports = ( /***/ }), -/***/ 6240: +/***/ 2480: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); +var utils = __nccwpck_require__(6218); module.exports = function normalizeHeaderName(headers, normalizedName) { utils.forEach(headers, function processHeader(value, name) { @@ -5715,13 +5672,13 @@ module.exports = function normalizeHeaderName(headers, normalizedName) { /***/ }), -/***/ 6455: +/***/ 8216: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __nccwpck_require__(328); +var utils = __nccwpck_require__(6218); // Headers whose duplicates are ignored by node // c.f. https://nodejs.org/api/http.html#http_message_headers @@ -5776,7 +5733,7 @@ module.exports = function parseHeaders(headers) { /***/ }), -/***/ 4850: +/***/ 3861: /***/ ((module) => { "use strict"; @@ -5811,13 +5768,13 @@ module.exports = function spread(callback) { /***/ }), -/***/ 1632: +/***/ 9047: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var VERSION = (__nccwpck_require__(4322).version); +var VERSION = (__nccwpck_require__(415).version); var validators = {}; @@ -5901,13 +5858,13 @@ module.exports = { /***/ }), -/***/ 328: +/***/ 6218: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var bind = __nccwpck_require__(7065); +var bind = __nccwpck_require__(7759); // utils is a library of generic helper functions non-specific to axios @@ -5920,7 +5877,7 @@ var toString = Object.prototype.toString; * @returns {boolean} True if value is an Array, otherwise false */ function isArray(val) { - return Array.isArray(val); + return toString.call(val) === '[object Array]'; } /** @@ -5961,7 +5918,7 @@ function isArrayBuffer(val) { * @returns {boolean} True if value is an FormData, otherwise false */ function isFormData(val) { - return toString.call(val) === '[object FormData]'; + return (typeof FormData !== 'undefined') && (val instanceof FormData); } /** @@ -5975,7 +5932,7 @@ function isArrayBufferView(val) { if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { result = ArrayBuffer.isView(val); } else { - result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); } return result; } @@ -6082,7 +6039,7 @@ function isStream(val) { * @returns {boolean} True if value is a URLSearchParams object, otherwise false */ function isURLSearchParams(val) { - return toString.call(val) === '[object URLSearchParams]'; + return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; } /** @@ -6258,12 +6215,12 @@ module.exports = { /***/ }), -/***/ 3682: +/***/ 5514: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var register = __nccwpck_require__(4670) -var addHook = __nccwpck_require__(5549) -var removeHook = __nccwpck_require__(6819) +var register = __nccwpck_require__(924) +var addHook = __nccwpck_require__(7686) +var removeHook = __nccwpck_require__(5720) // bind with array of arguments: https://stackoverflow.com/a/21792913 var bind = Function.bind @@ -6322,7 +6279,7 @@ module.exports.Collection = Hook.Collection /***/ }), -/***/ 5549: +/***/ 7686: /***/ ((module) => { module.exports = addHook; @@ -6375,7 +6332,7 @@ function addHook(state, kind, name, hook) { /***/ }), -/***/ 4670: +/***/ 924: /***/ ((module) => { module.exports = register; @@ -6409,7 +6366,7 @@ function register(state, name, method, options) { /***/ }), -/***/ 6819: +/***/ 5720: /***/ ((module) => { module.exports = removeHook; @@ -6435,12 +6392,12 @@ function removeHook(state, name, method) { /***/ }), -/***/ 336: +/***/ 9017: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var DuplexStream = __nccwpck_require__(3874) +var DuplexStream = __nccwpck_require__(1152) , util = __nccwpck_require__(3837) - , Buffer = (__nccwpck_require__(1867).Buffer) + , Buffer = (__nccwpck_require__(4078).Buffer) function BufferList (callback) { @@ -6732,7 +6689,7 @@ module.exports = BufferList /***/ }), -/***/ 6726: +/***/ 9973: /***/ ((module) => { function allocUnsafe (size) { @@ -6756,11 +6713,11 @@ module.exports = allocUnsafe /***/ }), -/***/ 6615: +/***/ 6066: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var bufferFill = __nccwpck_require__(2852) -var allocUnsafe = __nccwpck_require__(6726) +var bufferFill = __nccwpck_require__(2734) +var allocUnsafe = __nccwpck_require__(9973) module.exports = function alloc (size, fill, encoding) { if (typeof size !== 'number') { @@ -6795,7 +6752,7 @@ module.exports = function alloc (size, fill, encoding) { /***/ }), -/***/ 2852: +/***/ 2734: /***/ ((module) => { /* Node.js 6.4.0 and up has full support */ @@ -6915,7 +6872,7 @@ module.exports = fill /***/ }), -/***/ 9051: +/***/ 7601: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -7090,7 +7047,7 @@ chownr.sync = chownrSync /***/ }), -/***/ 5898: +/***/ 8751: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { // Copyright Joyent, Inc. and other Node contributors. @@ -7204,7 +7161,7 @@ function objectToString(o) { /***/ }), -/***/ 3186: +/***/ 1484: /***/ ((module) => { "use strict"; @@ -7306,7 +7263,7 @@ module.exports = function (encodedURI) { /***/ }), -/***/ 8932: +/***/ 239: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -7334,10 +7291,10 @@ exports.Deprecation = Deprecation; /***/ }), -/***/ 1205: +/***/ 9220: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var once = __nccwpck_require__(1223); +var once = __nccwpck_require__(8059); var noop = function() {}; @@ -7435,7 +7392,7 @@ module.exports = eos; /***/ }), -/***/ 4940: +/***/ 1231: /***/ ((module) => { "use strict"; @@ -7460,7 +7417,7 @@ module.exports = function (obj, predicate) { /***/ }), -/***/ 1133: +/***/ 8367: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { var debug; @@ -7469,7 +7426,7 @@ module.exports = function () { if (!debug) { try { /* eslint global-require: off */ - debug = __nccwpck_require__(9975)("follow-redirects"); + debug = __nccwpck_require__(96)("follow-redirects"); } catch (error) { /* */ } if (typeof debug !== "function") { @@ -7482,16 +7439,16 @@ module.exports = function () { /***/ }), -/***/ 7707: +/***/ 4214: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { var url = __nccwpck_require__(7310); var URL = url.URL; var http = __nccwpck_require__(3685); var https = __nccwpck_require__(5687); -var Writable = (__nccwpck_require__(2781).Writable); +var Writable = (__nccwpck_require__(9955).Writable); var assert = __nccwpck_require__(9491); -var debug = __nccwpck_require__(1133); +var debug = __nccwpck_require__(8367); // Create handlers that pass events from native requests var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; @@ -7879,9 +7836,8 @@ RedirectableRequest.prototype._processResponse = function (response) { var redirectUrlParts = url.parse(redirectUrl); Object.assign(this._options, redirectUrlParts); - // Drop confidential headers when redirecting to another scheme:domain - if (redirectUrlParts.protocol !== currentUrlParts.protocol || - !isSameOrSubdomain(redirectUrlParts.host, currentHost)) { + // Drop the confidential headers when redirecting to another domain + if (!(redirectUrlParts.host === currentHost || isSubdomainOf(redirectUrlParts.host, currentHost))) { removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers); } @@ -8047,10 +8003,7 @@ function abortRequest(request) { request.abort(); } -function isSameOrSubdomain(subdomain, domain) { - if (subdomain === domain) { - return true; - } +function isSubdomainOf(subdomain, domain) { const dot = subdomain.length - domain.length - 1; return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); } @@ -8062,7 +8015,7 @@ module.exports.wrap = wrap; /***/ }), -/***/ 4903: +/***/ 7707: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { module.exports = (__nccwpck_require__(7147).constants) || __nccwpck_require__(2057) @@ -8070,7 +8023,7 @@ module.exports = (__nccwpck_require__(7147).constants) || __nccwpck_require__(20 /***/ }), -/***/ 4124: +/***/ 4870: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { try { @@ -8080,13 +8033,13 @@ try { module.exports = util.inherits; } catch (e) { /* istanbul ignore next */ - module.exports = __nccwpck_require__(8544); + module.exports = __nccwpck_require__(961); } /***/ }), -/***/ 8544: +/***/ 961: /***/ ((module) => { if (typeof Object.create === 'function') { @@ -8120,7 +8073,7 @@ if (typeof Object.create === 'function') { /***/ }), -/***/ 3287: +/***/ 6765: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -8166,7 +8119,7 @@ exports.isPlainObject = isPlainObject; /***/ }), -/***/ 893: +/***/ 8858: /***/ ((module) => { var toString = {}.toString; @@ -8178,7 +8131,7 @@ module.exports = Array.isArray || function (arr) { /***/ }), -/***/ 6186: +/***/ 779: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { var path = __nccwpck_require__(1017); @@ -8284,7 +8237,7 @@ mkdirP.sync = function sync (p, opts, made) { /***/ }), -/***/ 467: +/***/ 4060: /***/ ((module, exports, __nccwpck_require__) => { "use strict"; @@ -8294,10 +8247,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var Stream = _interopDefault(__nccwpck_require__(2781)); +var Stream = _interopDefault(__nccwpck_require__(9955)); var http = _interopDefault(__nccwpck_require__(3685)); var Url = _interopDefault(__nccwpck_require__(7310)); -var whatwgUrl = _interopDefault(__nccwpck_require__(8665)); +var whatwgUrl = _interopDefault(__nccwpck_require__(7011)); var https = _interopDefault(__nccwpck_require__(5687)); var zlib = _interopDefault(__nccwpck_require__(9796)); @@ -8450,7 +8403,7 @@ FetchError.prototype.name = 'FetchError'; let convert; try { - convert = (__nccwpck_require__(2877).convert); + convert = (__nccwpck_require__(5924).convert); } catch (e) {} const INTERNALS = Symbol('Body internals'); @@ -9989,10 +9942,10 @@ exports.FetchError = FetchError; /***/ }), -/***/ 1223: +/***/ 8059: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var wrappy = __nccwpck_require__(2940) +var wrappy = __nccwpck_require__(8652) module.exports = wrappy(once) module.exports.strict = wrappy(onceStrict) @@ -10038,7 +9991,7 @@ function onceStrict (fn) { /***/ }), -/***/ 7810: +/***/ 6471: /***/ ((module) => { "use strict"; @@ -10091,11 +10044,11 @@ function nextTick(fn, arg1, arg2, arg3) { /***/ }), -/***/ 8341: +/***/ 1344: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var once = __nccwpck_require__(1223) -var eos = __nccwpck_require__(1205) +var once = __nccwpck_require__(8059) +var eos = __nccwpck_require__(9220) var fs = __nccwpck_require__(7147) // we only need fs to get the ReadStream and WriteStream prototypes var noop = function () {} @@ -10178,15 +10131,15 @@ module.exports = pump /***/ }), -/***/ 293: +/***/ 2820: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -const strictUriEncode = __nccwpck_require__(3605); -const decodeComponent = __nccwpck_require__(3186); -const splitOnFirst = __nccwpck_require__(4878); -const filterObject = __nccwpck_require__(4940); +const strictUriEncode = __nccwpck_require__(7340); +const decodeComponent = __nccwpck_require__(1484); +const splitOnFirst = __nccwpck_require__(2682); +const filterObject = __nccwpck_require__(1231); const isNullOrUndefined = value => value === null || value === undefined; @@ -10668,15 +10621,15 @@ exports.exclude = (input, filter, options) => { /***/ }), -/***/ 3874: +/***/ 1152: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(1642).Duplex +module.exports = __nccwpck_require__(1771).Duplex /***/ }), -/***/ 1359: +/***/ 1798: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -10710,7 +10663,7 @@ module.exports = __nccwpck_require__(1642).Duplex /**/ -var pna = __nccwpck_require__(7810); +var pna = __nccwpck_require__(6471); /**/ /**/ @@ -10725,12 +10678,12 @@ var objectKeys = Object.keys || function (obj) { module.exports = Duplex; /**/ -var util = Object.create(__nccwpck_require__(5898)); -util.inherits = __nccwpck_require__(4124); +var util = Object.create(__nccwpck_require__(8751)); +util.inherits = __nccwpck_require__(4870); /**/ -var Readable = __nccwpck_require__(1433); -var Writable = __nccwpck_require__(6993); +var Readable = __nccwpck_require__(1235); +var Writable = __nccwpck_require__(4783); util.inherits(Duplex, Readable); @@ -10814,7 +10767,7 @@ Duplex.prototype._destroy = function (err, cb) { /***/ }), -/***/ 1542: +/***/ 582: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -10847,11 +10800,11 @@ Duplex.prototype._destroy = function (err, cb) { module.exports = PassThrough; -var Transform = __nccwpck_require__(4415); +var Transform = __nccwpck_require__(3869); /**/ -var util = Object.create(__nccwpck_require__(5898)); -util.inherits = __nccwpck_require__(4124); +var util = Object.create(__nccwpck_require__(8751)); +util.inherits = __nccwpck_require__(4870); /**/ util.inherits(PassThrough, Transform); @@ -10868,7 +10821,7 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { /***/ }), -/***/ 1433: +/***/ 1235: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -10897,13 +10850,13 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { /**/ -var pna = __nccwpck_require__(7810); +var pna = __nccwpck_require__(6471); /**/ module.exports = Readable; /**/ -var isArray = __nccwpck_require__(893); +var isArray = __nccwpck_require__(8858); /**/ /**/ @@ -10921,12 +10874,12 @@ var EElistenerCount = function (emitter, type) { /**/ /**/ -var Stream = __nccwpck_require__(2387); +var Stream = __nccwpck_require__(7514); /**/ /**/ -var Buffer = (__nccwpck_require__(110).Buffer); +var Buffer = (__nccwpck_require__(7250).Buffer); var OurUint8Array = global.Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); @@ -10938,8 +10891,8 @@ function _isUint8Array(obj) { /**/ /**/ -var util = Object.create(__nccwpck_require__(5898)); -util.inherits = __nccwpck_require__(4124); +var util = Object.create(__nccwpck_require__(8751)); +util.inherits = __nccwpck_require__(4870); /**/ /**/ @@ -10952,8 +10905,8 @@ if (debugUtil && debugUtil.debuglog) { } /**/ -var BufferList = __nccwpck_require__(7053); -var destroyImpl = __nccwpck_require__(7049); +var BufferList = __nccwpck_require__(5676); +var destroyImpl = __nccwpck_require__(4215); var StringDecoder; util.inherits(Readable, Stream); @@ -10973,7 +10926,7 @@ function prependListener(emitter, event, fn) { } function ReadableState(options, stream) { - Duplex = Duplex || __nccwpck_require__(1359); + Duplex = Duplex || __nccwpck_require__(1798); options = options || {}; @@ -11043,14 +10996,14 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) StringDecoder = (__nccwpck_require__(4841)/* .StringDecoder */ .s); + if (!StringDecoder) StringDecoder = (__nccwpck_require__(9828)/* .StringDecoder */ .s); this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } } function Readable(options) { - Duplex = Duplex || __nccwpck_require__(1359); + Duplex = Duplex || __nccwpck_require__(1798); if (!(this instanceof Readable)) return new Readable(options); @@ -11199,7 +11152,7 @@ Readable.prototype.isPaused = function () { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = (__nccwpck_require__(4841)/* .StringDecoder */ .s); + if (!StringDecoder) StringDecoder = (__nccwpck_require__(9828)/* .StringDecoder */ .s); this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -11894,7 +11847,7 @@ function indexOf(xs, x) { /***/ }), -/***/ 4415: +/***/ 3869: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -11965,11 +11918,11 @@ function indexOf(xs, x) { module.exports = Transform; -var Duplex = __nccwpck_require__(1359); +var Duplex = __nccwpck_require__(1798); /**/ -var util = Object.create(__nccwpck_require__(5898)); -util.inherits = __nccwpck_require__(4124); +var util = Object.create(__nccwpck_require__(8751)); +util.inherits = __nccwpck_require__(4870); /**/ util.inherits(Transform, Duplex); @@ -12115,7 +12068,7 @@ function done(stream, er, data) { /***/ }), -/***/ 6993: +/***/ 4783: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -12148,7 +12101,7 @@ function done(stream, er, data) { /**/ -var pna = __nccwpck_require__(7810); +var pna = __nccwpck_require__(6471); /**/ module.exports = Writable; @@ -12185,23 +12138,23 @@ var Duplex; Writable.WritableState = WritableState; /**/ -var util = Object.create(__nccwpck_require__(5898)); -util.inherits = __nccwpck_require__(4124); +var util = Object.create(__nccwpck_require__(8751)); +util.inherits = __nccwpck_require__(4870); /**/ /**/ var internalUtil = { - deprecate: __nccwpck_require__(7127) + deprecate: __nccwpck_require__(2577) }; /**/ /**/ -var Stream = __nccwpck_require__(2387); +var Stream = __nccwpck_require__(7514); /**/ /**/ -var Buffer = (__nccwpck_require__(110).Buffer); +var Buffer = (__nccwpck_require__(7250).Buffer); var OurUint8Array = global.Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); @@ -12212,14 +12165,14 @@ function _isUint8Array(obj) { /**/ -var destroyImpl = __nccwpck_require__(7049); +var destroyImpl = __nccwpck_require__(4215); util.inherits(Writable, Stream); function nop() {} function WritableState(options, stream) { - Duplex = Duplex || __nccwpck_require__(1359); + Duplex = Duplex || __nccwpck_require__(1798); options = options || {}; @@ -12369,7 +12322,7 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot } function Writable(options) { - Duplex = Duplex || __nccwpck_require__(1359); + Duplex = Duplex || __nccwpck_require__(1798); // Writable ctor is applied to Duplexes, too. // `realHasInstance` is necessary because using plain `instanceof` @@ -12809,7 +12762,7 @@ Writable.prototype._destroy = function (err, cb) { /***/ }), -/***/ 7053: +/***/ 5676: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -12817,7 +12770,7 @@ Writable.prototype._destroy = function (err, cb) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var Buffer = (__nccwpck_require__(110).Buffer); +var Buffer = (__nccwpck_require__(7250).Buffer); var util = __nccwpck_require__(3837); function copyBuffer(src, target, offset) { @@ -12895,7 +12848,7 @@ if (util && util.inspect && util.inspect.custom) { /***/ }), -/***/ 7049: +/***/ 4215: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -12903,7 +12856,7 @@ if (util && util.inspect && util.inspect.custom) { /**/ -var pna = __nccwpck_require__(7810); +var pna = __nccwpck_require__(6471); /**/ // undocumented cb() API, needed for core, not for public API @@ -12976,15 +12929,15 @@ module.exports = { /***/ }), -/***/ 2387: +/***/ 7514: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(2781); +module.exports = __nccwpck_require__(9955); /***/ }), -/***/ 110: +/***/ 7250: /***/ ((module, exports, __nccwpck_require__) => { /* eslint-disable node/no-deprecated-api */ @@ -13053,10 +13006,10 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ }), -/***/ 1642: +/***/ 1771: /***/ ((module, exports, __nccwpck_require__) => { -var Stream = __nccwpck_require__(2781); +var Stream = __nccwpck_require__(9955); if (process.env.READABLE_STREAM === 'disable' && Stream) { module.exports = Stream; exports = module.exports = Stream.Readable; @@ -13067,19 +13020,19 @@ if (process.env.READABLE_STREAM === 'disable' && Stream) { exports.PassThrough = Stream.PassThrough; exports.Stream = Stream; } else { - exports = module.exports = __nccwpck_require__(1433); + exports = module.exports = __nccwpck_require__(1235); exports.Stream = Stream || exports; exports.Readable = exports; - exports.Writable = __nccwpck_require__(6993); - exports.Duplex = __nccwpck_require__(1359); - exports.Transform = __nccwpck_require__(4415); - exports.PassThrough = __nccwpck_require__(1542); + exports.Writable = __nccwpck_require__(4783); + exports.Duplex = __nccwpck_require__(1798); + exports.Transform = __nccwpck_require__(3869); + exports.PassThrough = __nccwpck_require__(582); } /***/ }), -/***/ 1867: +/***/ 4078: /***/ ((module, exports, __nccwpck_require__) => { /*! safe-buffer. MIT License. Feross Aboukhadijeh */ @@ -13151,7 +13104,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ }), -/***/ 4878: +/***/ 2682: /***/ ((module) => { "use strict"; @@ -13181,7 +13134,7 @@ module.exports = (string, separator) => { /***/ }), -/***/ 3605: +/***/ 7340: /***/ ((module) => { "use strict"; @@ -13191,7 +13144,7 @@ module.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.c /***/ }), -/***/ 4841: +/***/ 9828: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -13220,7 +13173,7 @@ module.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.c /**/ -var Buffer = (__nccwpck_require__(2279).Buffer); +var Buffer = (__nccwpck_require__(3334).Buffer); /**/ var isEncoding = Buffer.isEncoding || function (encoding) { @@ -13494,7 +13447,7 @@ function simpleEnd(buf) { /***/ }), -/***/ 2279: +/***/ 3334: /***/ ((module, exports, __nccwpck_require__) => { /* eslint-disable node/no-deprecated-api */ @@ -13563,13 +13516,13 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ }), -/***/ 366: +/***/ 3007: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var chownr = __nccwpck_require__(9051) -var tar = __nccwpck_require__(2283) -var pump = __nccwpck_require__(8341) -var mkdirp = __nccwpck_require__(6186) +var chownr = __nccwpck_require__(7601) +var tar = __nccwpck_require__(7422) +var pump = __nccwpck_require__(1344) +var mkdirp = __nccwpck_require__(779) var fs = __nccwpck_require__(7147) var path = __nccwpck_require__(1017) var os = __nccwpck_require__(2037) @@ -13915,16 +13868,16 @@ function mkdirfix (name, opts, cb) { /***/ }), -/***/ 7882: +/***/ 8830: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { var util = __nccwpck_require__(3837) -var bl = __nccwpck_require__(336) -var xtend = __nccwpck_require__(1208) -var headers = __nccwpck_require__(8860) +var bl = __nccwpck_require__(9017) +var xtend = __nccwpck_require__(5600) +var headers = __nccwpck_require__(5757) -var Writable = (__nccwpck_require__(1642).Writable) -var PassThrough = (__nccwpck_require__(1642).PassThrough) +var Writable = (__nccwpck_require__(1771).Writable) +var PassThrough = (__nccwpck_require__(1771).PassThrough) var noop = function () {} @@ -14180,11 +14133,11 @@ module.exports = Extract /***/ }), -/***/ 8860: +/***/ 5757: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var toBuffer = __nccwpck_require__(1259) -var alloc = __nccwpck_require__(6615) +var toBuffer = __nccwpck_require__(3726) +var alloc = __nccwpck_require__(6066) var ZEROS = '0000000000000000000' var SEVENS = '7777777777777777777' @@ -14470,29 +14423,29 @@ exports.decode = function (buf, filenameEncoding) { /***/ }), -/***/ 2283: +/***/ 7422: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -exports.extract = __nccwpck_require__(7882) -exports.pack = __nccwpck_require__(4930) +exports.extract = __nccwpck_require__(8830) +exports.pack = __nccwpck_require__(8927) /***/ }), -/***/ 4930: +/***/ 8927: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var constants = __nccwpck_require__(4903) -var eos = __nccwpck_require__(1205) +var constants = __nccwpck_require__(7707) +var eos = __nccwpck_require__(9220) var util = __nccwpck_require__(3837) -var alloc = __nccwpck_require__(6615) -var toBuffer = __nccwpck_require__(1259) +var alloc = __nccwpck_require__(6066) +var toBuffer = __nccwpck_require__(3726) -var Readable = (__nccwpck_require__(1642).Readable) -var Writable = (__nccwpck_require__(1642).Writable) +var Readable = (__nccwpck_require__(1771).Readable) +var Writable = (__nccwpck_require__(1771).Writable) var StringDecoder = (__nccwpck_require__(1576).StringDecoder) -var headers = __nccwpck_require__(8860) +var headers = __nccwpck_require__(5757) var DMODE = parseInt('755', 8) var FMODE = parseInt('644', 8) @@ -14741,14 +14694,14 @@ module.exports = Pack /***/ }), -/***/ 4130: +/***/ 9646: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(8948); +module.exports = __nccwpck_require__(3458); /***/ }), -/***/ 8948: +/***/ 3458: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // targz - Simple tar.gz compression and decompression for NodeJS. @@ -14757,7 +14710,7 @@ module.exports = __nccwpck_require__(8948); // MIT license var fs = __nccwpck_require__(7147); -var tar = __nccwpck_require__(366); +var tar = __nccwpck_require__(3007); var zlib = __nccwpck_require__(9796); module.exports = { @@ -14832,7 +14785,7 @@ module.exports = { /***/ }), -/***/ 1259: +/***/ 3726: /***/ ((module) => { module.exports = toBuffer @@ -14853,7 +14806,7 @@ function toBuffer (buf, enc) { /***/ }), -/***/ 4256: +/***/ 5902: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -15054,15 +15007,15 @@ module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS; /***/ }), -/***/ 4294: +/***/ 7477: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(4219); +module.exports = __nccwpck_require__(8162); /***/ }), -/***/ 4219: +/***/ 8162: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -15334,7 +15287,7 @@ exports.debug = debug; // for test /***/ }), -/***/ 5030: +/***/ 5489: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -15360,7 +15313,7 @@ exports.getUserAgent = getUserAgent; /***/ }), -/***/ 7127: +/***/ 2577: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -15373,7 +15326,7 @@ module.exports = __nccwpck_require__(3837).deprecate; /***/ }), -/***/ 4886: +/***/ 5343: /***/ ((module) => { "use strict"; @@ -15570,12 +15523,12 @@ conversions["RegExp"] = function (V, opts) { /***/ }), -/***/ 7537: +/***/ 8411: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -const usm = __nccwpck_require__(2158); +const usm = __nccwpck_require__(1933); exports.implementation = class URLImpl { constructor(constructorArgs) { @@ -15778,15 +15731,15 @@ exports.implementation = class URLImpl { /***/ }), -/***/ 3394: +/***/ 3215: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const conversions = __nccwpck_require__(4886); -const utils = __nccwpck_require__(3185); -const Impl = __nccwpck_require__(7537); +const conversions = __nccwpck_require__(5343); +const utils = __nccwpck_require__(2772); +const Impl = __nccwpck_require__(8411); const impl = utils.implSymbol; @@ -15982,32 +15935,32 @@ module.exports = { /***/ }), -/***/ 8665: +/***/ 7011: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -exports.URL = __nccwpck_require__(3394)["interface"]; -exports.serializeURL = __nccwpck_require__(2158).serializeURL; -exports.serializeURLOrigin = __nccwpck_require__(2158).serializeURLOrigin; -exports.basicURLParse = __nccwpck_require__(2158).basicURLParse; -exports.setTheUsername = __nccwpck_require__(2158).setTheUsername; -exports.setThePassword = __nccwpck_require__(2158).setThePassword; -exports.serializeHost = __nccwpck_require__(2158).serializeHost; -exports.serializeInteger = __nccwpck_require__(2158).serializeInteger; -exports.parseURL = __nccwpck_require__(2158).parseURL; +exports.URL = __nccwpck_require__(3215)["interface"]; +exports.serializeURL = __nccwpck_require__(1933).serializeURL; +exports.serializeURLOrigin = __nccwpck_require__(1933).serializeURLOrigin; +exports.basicURLParse = __nccwpck_require__(1933).basicURLParse; +exports.setTheUsername = __nccwpck_require__(1933).setTheUsername; +exports.setThePassword = __nccwpck_require__(1933).setThePassword; +exports.serializeHost = __nccwpck_require__(1933).serializeHost; +exports.serializeInteger = __nccwpck_require__(1933).serializeInteger; +exports.parseURL = __nccwpck_require__(1933).parseURL; /***/ }), -/***/ 2158: +/***/ 1933: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; const punycode = __nccwpck_require__(5477); -const tr46 = __nccwpck_require__(4256); +const tr46 = __nccwpck_require__(5902); const specialSchemes = { ftp: 21, @@ -17306,7 +17259,7 @@ module.exports.parseURL = function (input, options) { /***/ }), -/***/ 3185: +/***/ 2772: /***/ ((module) => { "use strict"; @@ -17334,7 +17287,7 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 2940: +/***/ 8652: /***/ ((module) => { // Returns a wrapper function that returns a wrapped callback @@ -17374,7 +17327,7 @@ function wrappy (fn, cb) { /***/ }), -/***/ 1208: +/***/ 5600: /***/ ((module) => { module.exports = extend @@ -17400,10 +17353,10 @@ function extend() { /***/ }), -/***/ 5: +/***/ 4675: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const axios = __nccwpck_require__(6545) +const axios = __nccwpck_require__(6605) module.exports = async (value) => { return await new Promise((resolve,reject) => { @@ -17418,7 +17371,7 @@ module.exports = async (value) => { /***/ }), -/***/ 5512: +/***/ 8932: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const exec = (__nccwpck_require__(2081).exec); @@ -17441,19 +17394,20 @@ module.exports = { /***/ }), -/***/ 5203: +/***/ 2781: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const axios = __nccwpck_require__(5) -const qse = __nccwpck_require__(293); -const constants = __nccwpck_require__(9623); -const core = __nccwpck_require__(2186); +const axios = __nccwpck_require__(4675) +const qse = __nccwpck_require__(2820); +const constants = __nccwpck_require__(1986); +const region = __nccwpck_require__(4966) +const core = __nccwpck_require__(9935); function getAccessToken(clientId,clientSecretKey){ return new Promise((resolve,reject) => { try { - const inputUrl = process.env.AUTH_URL; - const oAuthUrl = (inputUrl && inputUrl !== "") ? inputUrl : 'https://auth.us.zcpcloud.net'; + const inputRegion = core.getInput('region'); + const oAuthUrl = region[inputRegion].auth_url const options = { url: oAuthUrl + '/oauth/token', data: qse.stringify({ @@ -17485,7 +17439,7 @@ module.exports = { /***/ }), -/***/ 9623: +/***/ 1986: /***/ ((module) => { let constants = { @@ -17517,15 +17471,16 @@ module.exports = Object.freeze(constants); /***/ }), -/***/ 8637: +/***/ 4756: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const fs = __nccwpck_require__(7147); -const request = __nccwpck_require__(5); -const stream = __nccwpck_require__(2781); +const request = __nccwpck_require__(4675); +const stream = __nccwpck_require__(9955); const os = __nccwpck_require__(2037); -const constants = __nccwpck_require__(9623); -const core = __nccwpck_require__(2186); +const constants = __nccwpck_require__(1986); +const core = __nccwpck_require__(9935); +const region = __nccwpck_require__(4966) function downloadZscannerBinary(accessToken){ return new Promise((resolve,reject) => { @@ -17535,8 +17490,8 @@ function downloadZscannerBinary(accessToken){ const filePath = constants.DOWNLOAD_CONSTANTS.DOWNLOAD_DIR + constants.DOWNLOAD_CONSTANTS.DOWNLOAD_SUBDIR + fileName; if(!fs.existsSync(filePath)){ - const inputApiUrl = process.env.API_URL; - const apiUrl = (inputApiUrl && inputApiUrl !== "") ? inputApiUrl : 'https://api.zcpcloud.net'; + const inputRegion = core.getInput('region'); + const apiUrl = region[inputRegion].api_url; const binaryUrl = apiUrl + '/iac/onboarding/v1/cli/download'; downloadFile(accessToken, binaryUrl, filePath).then((result) => { resolve(result); @@ -17629,13 +17584,13 @@ module.exports = { /***/ }), -/***/ 817: +/***/ 3346: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const fs = __nccwpck_require__(7147); -const cmd = __nccwpck_require__(5512); -const targz = __nccwpck_require__(4130); -const constants = __nccwpck_require__(9623); +const cmd = __nccwpck_require__(8932); +const targz = __nccwpck_require__(9646); +const constants = __nccwpck_require__(1986); async function extractAndInstallBinary(){ return new Promise((resolve,reject) => { @@ -17695,13 +17650,31 @@ module.exports = { /***/ }), -/***/ 2258: +/***/ 4966: +/***/ ((module) => { + +var region = { + 'US' : { + 'auth_url' : 'https://auth.us.zcpcloud.net', + 'api_url' : 'https://api.zcpcloud.net' + }, + 'CUSTOM' : { + 'auth_url' : process.env.AUTH_URL, + 'api_url' : process.env.API_URL + } +} + +module.exports = region + +/***/ }), + +/***/ 5116: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const cmd = __nccwpck_require__(5512); -const constants = __nccwpck_require__(9623); -const core = __nccwpck_require__(2186); -const github = __nccwpck_require__(5438); +const cmd = __nccwpck_require__(8932); +const constants = __nccwpck_require__(1986); +const core = __nccwpck_require__(9935); +const github = __nccwpck_require__(2835); const util = __nccwpck_require__(3837); const exec = (__nccwpck_require__(2081).exec); @@ -17736,14 +17709,10 @@ const configCheck = function (clientId) { return new Promise((resolve, reject) => { const region = core.getInput('region'); if (region === 'CUSTOM') { - const inputApiUrl = process.env.API_URL; - const apiUrl = (inputApiUrl && inputApiUrl !== "") ? inputApiUrl : 'https://api.zcpcloud.net'; - const inputUrl = process.env.AUTH_URL; - const oAuthUrl = (inputUrl && inputUrl !== "") ? inputUrl : 'https://auth.us.zcpcloud.net'; const custom_config = { - 'host': apiUrl, + 'host': process.env.API_URL, 'auth': { - 'host': oAuthUrl, + 'host': process.env.AUTH_URL, 'clientId': clientId, 'scope': 'offline_access_profile', 'audience': constants.AUTH_CONSTANTS.AUDIENCE @@ -17803,19 +17772,26 @@ const executeScan = function () { exec(scanCommand, (error, stdout, stderr) => { try { const fail_build = core.getInput('fail_build') == 'true'; + var scan_status = 'passed'; if (stderr) { console.log(stderr); + scan_status = 'failed'; core.setFailed("Issue in running IaC scan"); } if(error && error.code === 0){ + scan_status = 'failed'; core.setFailed("Errors Observed within IaC files from repository"); } else if(error && error.code === 2 && fail_build){ + scan_status = 'failed'; core.setFailed("Violations Observed within IaC files from repository"); + } else { + scan_status = 'passed'; } if (outputFormat.startsWith("sarif") || outputFormat.endsWith("sarif") || outputFormat.startsWith("github_sarif") || outputFormat.endsWith("github_sarif")) { core.setOutput('sarif_file_path', process.cwd() + '/result.sarif') } + core.setOutput('scan_status',scan_status); if (outputFormat.startsWith("json")) { const output = JSON.parse(stdout); resolve(output); @@ -17834,7 +17810,7 @@ module.exports = { /***/ }), -/***/ 9975: +/***/ 96: /***/ ((module) => { module.exports = eval("require")("debug"); @@ -17842,7 +17818,7 @@ module.exports = eval("require")("debug"); /***/ }), -/***/ 2877: +/***/ 5924: /***/ ((module) => { module.exports = eval("require")("encoding"); @@ -17946,7 +17922,7 @@ module.exports = require("punycode"); /***/ }), -/***/ 2781: +/***/ 9955: /***/ ((module) => { "use strict"; @@ -18043,14 +18019,25 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { -const core = __nccwpck_require__(2186); -const auth = __nccwpck_require__(5203); -const downloader = __nccwpck_require__(8637); -const installer = __nccwpck_require__(817); -const scanner = __nccwpck_require__(2258); +const core = __nccwpck_require__(9935); +const auth = __nccwpck_require__(2781); +const downloader = __nccwpck_require__(4756); +const installer = __nccwpck_require__(3346); +const scanner = __nccwpck_require__(5116); const clientId = core.getInput('client_id'); const clientSecret = core.getInput('client_secret'); +const region = core.getInput('region'); + +if(typeof clientId === 'undefined' || clientId == null|| clientId.length<1 ){ + core.setFailed('client_id input is required and not supplied.'); +} +if(typeof clientSecret === 'undefined' || clientSecret == null|| clientSecret.length<1 ){ + core.setFailed('client_secret input is required and not supplied.'); +} +if(typeof region === 'undefined' || region == null|| region.length<1 ){ + core.setFailed('region input is required and not supplied.'); +} auth.getAccessToken(clientId, clientSecret).then((response) => { const accessToken = response.access_token; if (accessToken) { diff --git a/src/action.js b/src/action.js index 1de38b1..3a611e2 100644 --- a/src/action.js +++ b/src/action.js @@ -6,6 +6,17 @@ const scanner = require('./zscanner/scanner.js'); const clientId = core.getInput('client_id'); const clientSecret = core.getInput('client_secret'); +const region = core.getInput('region'); + +if(typeof clientId === 'undefined' || clientId == null|| clientId.length<1 ){ + core.setFailed('client_id input is required and not supplied.'); +} +if(typeof clientSecret === 'undefined' || clientSecret == null|| clientSecret.length<1 ){ + core.setFailed('client_secret input is required and not supplied.'); +} +if(typeof region === 'undefined' || region == null|| region.length<1 ){ + core.setFailed('region input is required and not supplied.'); +} auth.getAccessToken(clientId, clientSecret).then((response) => { const accessToken = response.access_token; if (accessToken) { diff --git a/src/zscanner/auth.js b/src/zscanner/auth.js index 637d38e..f077c72 100644 --- a/src/zscanner/auth.js +++ b/src/zscanner/auth.js @@ -1,13 +1,14 @@ const axios = require('../utils/await_request.js') const qse = require('query-string'); const constants = require('./constants'); +const region = require('./region') const core = require("@actions/core"); function getAccessToken(clientId,clientSecretKey){ return new Promise((resolve,reject) => { try { - const inputUrl = process.env.AUTH_URL; - const oAuthUrl = (inputUrl && inputUrl !== "") ? inputUrl : 'https://auth.us.zcpcloud.net'; + const inputRegion = core.getInput('region'); + const oAuthUrl = region[inputRegion].auth_url const options = { url: oAuthUrl + '/oauth/token', data: qse.stringify({ diff --git a/src/zscanner/downloader.js b/src/zscanner/downloader.js index 0454b47..d1b358a 100644 --- a/src/zscanner/downloader.js +++ b/src/zscanner/downloader.js @@ -4,6 +4,7 @@ const stream = require('stream'); const os = require('os'); const constants = require('./constants'); const core = require("@actions/core"); +const region = require('./region') function downloadZscannerBinary(accessToken){ return new Promise((resolve,reject) => { @@ -13,8 +14,8 @@ function downloadZscannerBinary(accessToken){ const filePath = constants.DOWNLOAD_CONSTANTS.DOWNLOAD_DIR + constants.DOWNLOAD_CONSTANTS.DOWNLOAD_SUBDIR + fileName; if(!fs.existsSync(filePath)){ - const inputApiUrl = process.env.API_URL; - const apiUrl = (inputApiUrl && inputApiUrl !== "") ? inputApiUrl : 'https://api.zcpcloud.net'; + const inputRegion = core.getInput('region'); + const apiUrl = region[inputRegion].api_url; const binaryUrl = apiUrl + '/iac/onboarding/v1/cli/download'; downloadFile(accessToken, binaryUrl, filePath).then((result) => { resolve(result); diff --git a/src/zscanner/region.js b/src/zscanner/region.js new file mode 100644 index 0000000..56bb257 --- /dev/null +++ b/src/zscanner/region.js @@ -0,0 +1,12 @@ +var region = { + 'US' : { + 'auth_url' : 'https://auth.us.zcpcloud.net', + 'api_url' : 'https://api.zcpcloud.net' + }, + 'CUSTOM' : { + 'auth_url' : process.env.AUTH_URL, + 'api_url' : process.env.API_URL + } +} + +module.exports = region \ No newline at end of file diff --git a/src/zscanner/scanner.js b/src/zscanner/scanner.js index b791397..d92f969 100644 --- a/src/zscanner/scanner.js +++ b/src/zscanner/scanner.js @@ -36,14 +36,10 @@ const configCheck = function (clientId) { return new Promise((resolve, reject) => { const region = core.getInput('region'); if (region === 'CUSTOM') { - const inputApiUrl = process.env.API_URL; - const apiUrl = (inputApiUrl && inputApiUrl !== "") ? inputApiUrl : 'https://api.zcpcloud.net'; - const inputUrl = process.env.AUTH_URL; - const oAuthUrl = (inputUrl && inputUrl !== "") ? inputUrl : 'https://auth.us.zcpcloud.net'; const custom_config = { - 'host': apiUrl, + 'host': process.env.API_URL, 'auth': { - 'host': oAuthUrl, + 'host': process.env.AUTH_URL, 'clientId': clientId, 'scope': 'offline_access_profile', 'audience': constants.AUTH_CONSTANTS.AUDIENCE @@ -103,19 +99,26 @@ const executeScan = function () { exec(scanCommand, (error, stdout, stderr) => { try { const fail_build = core.getInput('fail_build') == 'true'; + var scan_status = 'passed'; if (stderr) { console.log(stderr); + scan_status = 'failed'; core.setFailed("Issue in running IaC scan"); } if(error && error.code === 0){ + scan_status = 'failed'; core.setFailed("Errors Observed within IaC files from repository"); } else if(error && error.code === 2 && fail_build){ + scan_status = 'failed'; core.setFailed("Violations Observed within IaC files from repository"); + } else { + scan_status = 'passed'; } if (outputFormat.startsWith("sarif") || outputFormat.endsWith("sarif") || outputFormat.startsWith("github_sarif") || outputFormat.endsWith("github_sarif")) { core.setOutput('sarif_file_path', process.cwd() + '/result.sarif') } + core.setOutput('scan_status',scan_status); if (outputFormat.startsWith("json")) { const output = JSON.parse(stdout); resolve(output);