@brightsec/cli
Version:
Bright CLI is a CLI tool that can initialize, stop, poll and maintain scans in Bright solutions.
2 lines • 296 kB
JavaScript
#!/usr/bin/env node
(()=>{"use strict";var e={0(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultProxyFactory=void 0;const r=i(8398),o=i(1973),s=i(2216);t.DefaultProxyFactory=class DefaultProxyFactory{createProxy({proxyUrl:e,rejectUnauthorized:t=!1}){let i;try{({protocol:i}=new URL(e))}catch(t){throw new Error(`Invalid Proxy URL: '${e}'. Please provide a valid URL.`)}switch(i){case"http:":case"https:":return this.createHttpProxy(e,t);case"socks:":case"socks4:":case"socks4a:":case"socks5:":case"socks5h:":return this.createSocksProxy(e);default:throw new Error(`Unsupported proxy protocol: '${i.replace(":","")}'. Please use a supported protocol (HTTP(S), SOCKS4, or SOCKS5).`)}}createProxyForClient({targetUrl:e,...t}){const i=this.createProxy(t);let r;try{({protocol:r}=new URL(e))}catch(t){throw new Error(`Invalid Target URL: '${e}'. Please contact support at support@brightsec.com`)}switch(r){case"http:":case"ws:":return i.httpAgent;case"https:":case"wss:":return i.httpsAgent;default:throw new Error(`Proxy not supported for protocol '${r}'. Please contact support at support@brightsec.com`)}}createHttpProxy(e,t){return{httpsAgent:new r.PatchedHttpsProxyAgent(e,{rejectUnauthorized:t}),httpAgent:new o.HttpProxyAgent(e,{rejectUnauthorized:t})}}createSocksProxy(e){const t=new s.SocksProxyAgent(e);return{httpAgent:t,httpsAgent:t}}}},9(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.RestEntryPoints=t.RestProjectsOptions=void 0;const r=i(5584),o=i(1879),s=r.__importDefault(i(8938)),n=i(8641),a=r.__importDefault(i(7067)),c=r.__importDefault(i(4708));t.RestProjectsOptions=Symbol("RestProjectsOptions");let p=class RestEntryPoints{constructor(e,{baseURL:t,apiKey:i,insecure:r,proxyURL:o,timeout:n}){this.proxyFactory=e,this.entrypointsPaginationBatchSize=50;const{httpAgent:p=new a.default.Agent,httpsAgent:l=new c.default.Agent({rejectUnauthorized:!r})}=o?this.proxyFactory.createProxy({proxyUrl:o,rejectUnauthorized:!r}):{};this.client=s.default.create({baseURL:t,timeout:n,httpAgent:p,httpsAgent:l,responseType:"json",headers:{authorization:`Api-Key ${i}`}})}async entrypoints({limit:e=10,projectId:t,...i}){let r=e;const o=[];let s,n;for(;r>0;){const{data:{items:e=[]}}=await this.client.get(`/api/v2/projects/${t}/entry-points`,{params:{nextId:s,nextCreatedAt:n,...i,limit:Math.min(r,this.entrypointsPaginationBatchSize)}});if(!e.length)break;o.push(...e),({id:s,createdAt:n}=e[e.length-1]),r-=this.entrypointsPaginationBatchSize}return o}async updateHost(e){const{projectId:t,oldHostname:i,newHostname:r,entryPointIds:o}=e,{data:s}=await this.client.post(`/api/v2/projects/${t}/entry-points/update-host`,{oldHostname:i,newHostname:r,entryPointIds:o});return s}async getHostUpdateJobStatus(e){const{jobId:t,projectId:i}=e,{data:r}=await this.client.get(`/api/v2/projects/${i}/entry-points/update-host/${t}`);return r}};p=r.__decorate([(0,n.injectable)(),r.__param(0,(0,n.inject)(o.ProxyFactory)),r.__param(1,(0,n.inject)(t.RestProjectsOptions)),r.__metadata("design:paramtypes",[Object,Object])],p),t.RestEntryPoints=p},18(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.RequestExecutorOptions=void 0,t.RequestExecutorOptions=Symbol("RequestExecutorOptions")},35(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.RunDiscovery=void 0;const r=i(512),o=i(1879),s=i(6768),n=i(8641);t.RunDiscovery=class RunDiscovery{constructor(){this.command="discovery:run [options]",this.describe="Start a new discovery for the received configuration."}builder(e){return e.option("token",{alias:"t",describe:"Bright API-key",string:!0,requiresArg:!0,demandOption:!0}).option("project",{alias:"p",describe:"ID of the project",string:!0,requiresArg:!0,demandOption:!0}).option("name",{alias:"n",describe:"Name of the discovery.",string:!0,requiresArg:!0,demandOption:!0}).option("auth",{alias:"o",describe:"Auth object ID.",string:!0,requiresArg:!0}).option("repeater",{alias:"agent",requiresArg:!0,array:!0,describe:"ID of any repeaters connected with the discovery."}).option("archive",{alias:"a",normalize:!0,requiresArg:!0,describe:"A collection of your app's http/websockets logs into HAR file. Usually you can use browser dev tools or our browser web extension"}).option("crawler",{alias:"c",requiresArg:!0,array:!0,describe:"A list of specific urls that should be included into crawler."}).conflicts("archive","crawler").check((e=>{if(e.archive&&e.crawler)throw new Error("Arguments --archive and --crawler are mutually exclusive");if(!e.archive&&!e.crawler)throw new Error("Either --archive or --crawler must be specified");return!0})).option("host-filter",{alias:"F",requiresArg:!0,array:!0,describe:"A list of specific hosts that should be included into scan."}).option("header",{alias:"H",requiresArg:!0,array:!0,describe:"A list of specific headers that should be included into request."}).option("smart",{boolean:!0,describe:"Use automatic smart decisions such as: parameter skipping, detection phases, etc. to minimize scan time."}).option("crawl-parent-subdomains",{boolean:!0,describe:"Crawl parent path folders and subdomains",default:!1}).option("concurrency",{number:!0,default:10,describe:"Number of maximum concurrent requests allowed to be sent to the target, can range between 1 to 50 (default: 10).",requiresArg:!0}).option("interactions-depth",{number:!0,default:3,describe:"Number of maximum interactions with nested objects, can range between 1 to 5 (default: 3).",requiresArg:!0}).middleware((e=>{var t;return n.container.register(s.RestDiscoveryOptions,{useValue:{insecure:e.insecure,baseURL:e.api,apiKey:e.token,proxyURL:null!==(t=e.proxyBright)&&void 0!==t?t:e.proxy,timeout:e.timeout}})}))}async handler(e){try{const t=n.container.resolve(r.Discoveries),i=e.project,{id:s,warnings:a}=await t.create(i,{name:e.name,authObjectId:e.auth,hostsFilter:e.hostFilter,crawlerUrls:e.crawler,fileId:e.archive,repeaters:e.repeater,optimizedCrawler:e.smart,poolSize:e.concurrency,maxInteractionsChainLength:e.interactionsDepth,subdomainsCrawl:e.crawlParentSubdomains,headers:e.header});console.log(s),(null==a?void 0:a.length)&&o.logger.warn(`${a.map((e=>e.message)).join("\n")}\n`),process.exit(0)}catch(e){o.logger.error(o.ErrorMessageFactory.genericCommandError({error:e,command:"discovery:run"})),process.exit(1)}}}},207(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});const r=i(5584);r.__exportStar(i(8093),t),r.__exportStar(i(1825),t),r.__exportStar(i(6780),t),r.__exportStar(i(7511),t),r.__exportStar(i(6500),t)},360(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.OnSeverity=t.BreakpointException=void 0;var r=i(4264);Object.defineProperty(t,"BreakpointException",{enumerable:!0,get:function(){return r.BreakpointException}});var o=i(7352);Object.defineProperty(t,"OnSeverity",{enumerable:!0,get:function(){return o.OnSeverity}})},481(e){e.exports=require("node:readline")},512(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});const r=i(5584);r.__exportStar(i(1042),t),r.__exportStar(i(6768),t),r.__exportStar(i(2297),t),r.__exportStar(i(2264),t)},523(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});const r=i(5584);r.__exportStar(i(3120),t),r.__exportStar(i(7980),t),r.__exportStar(i(7032),t),r.__exportStar(i(2625),t),r.__exportStar(i(796),t),r.__exportStar(i(2217),t),r.__exportStar(i(1008),t),r.__exportStar(i(7496),t),r.__exportStar(i(360),t),r.__exportStar(i(6499),t),r.__exportStar(i(7024),t)},714(e){e.exports=require("node:vm")},756(e){e.exports=require("@neuralegion/os-service")},796(e,t){Object.defineProperty(t,"__esModule",{value:!0})},839(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.EntryPoints=t.JobStatus=void 0,function(e){e.PENDING="pending",e.PROCESSING="processing",e.COMPLETED="completed",e.FAILED="failed"}(t.JobStatus||(t.JobStatus={})),t.EntryPoints=Symbol("EntryPoints")},868(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkTestType=void 0,function(e){e.PING="ping",e.TRACEROUTE="traceroute"}(t.NetworkTestType||(t.NetworkTestType={}))},953(e){e.exports=require("win-ca")},993(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.VirtualScripts=void 0,t.VirtualScripts=Symbol("VirtualScripts")},1008(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BreakpointType=void 0,function(e){e.ANY="any",e.MEDIUM_ISSUE="medium_issue",e.HIGH_ISSUE="high_issue",e.CRITICAL_ISSUE="critical_issue"}(t.BreakpointType||(t.BreakpointType={}))},1033(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.RequestExecutorConstants=void 0;class RequestExecutorConstants{}t.RequestExecutorConstants=RequestExecutorConstants,RequestExecutorConstants.MAX_HEADERS_SIZE=32768},1042(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SourceType=t.DiscoveryType=t.Discoveries=void 0,t.Discoveries=Symbol("Discoveries"),function(e){e.CRAWLER="crawler",e.ARCHIVE="archive",e.OAS="oas"}(t.DiscoveryType||(t.DiscoveryType={})),function(e){e.OPEN_API="openapi",e.RAML="raml",e.POSTMAN="postman",e.HAR="har"}(t.SourceType||(t.SourceType={}))},1184(e){e.exports=require("arch")},1243(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultRepeaterCommandHub=void 0;const r=i(5584),o=i(7758),s=i(1879),n=i(5721),a=i(2046),c=i(8641),p=i(8161);let l=class DefaultRepeaterCommandHub{constructor(e,t){this.virtualScripts=e,this.requestExecutors=t}compileScripts(e){this.virtualScripts.clear(o.VirtualScriptType.REMOTE),this.virtualScripts.size?s.logger.warn("Error Loading Script: Cannot accept scripts from the cloud when a local script is already loaded"):"string"==typeof e?this.virtualScripts.set("*",o.VirtualScriptType.REMOTE,e):Object.entries(e).map((([e,t])=>this.virtualScripts.set(e,o.VirtualScriptType.REMOTE,t)))}sendRequest(e){const{protocol:t}=e,i=this.requestExecutors.find((e=>e.protocol===t));if(!i)throw new Error(`Unsupported protocol "${t}"`);return i.execute(e)}testNetwork(e,t){return new Promise(((i,r)=>{const o=["configure",`--${e}`];s.logger.debug('Launching "Network Diagnostic" process with cmd: %j',o);const a=s.Helpers.spawn({include:o,exclude:["repeater"]});a.unref();const c=[];a.stdout.on("data",(e=>{const i=e.toString(),r=i.split("\n").filter((e=>e.length>0));c.push(...r);const[o,...s]=[].concat(t);i.indexOf(n.ReadlinePlatform.URLS_QUESTION)>-1&&a.stdin.write(`${[o,...s].join(",")}${p.EOL}`),i.indexOf(n.ReadlinePlatform.HOST_OR_IP_QUESTION)>-1&&a.stdin.write(`${new URL(o).hostname}${p.EOL}`),i.indexOf(n.ReadlinePlatform.COMPELED_MESSAGE)>-1&&a.stdin.end()})),a.once("error",(e=>{s.logger.warn('Failed to start "Network Diagnostic" due to %s',e.message),r(e)})),a.on("close",(e=>{if(0!==e||0===c.length){const t=`"Network Diagnostic" did not start successfully. Process exited with code ${e}`;return s.logger.warn(t),r(new Error(t))}i(this.processOutput(c))}))}))}processOutput(e){return e.filter(((e,t,i)=>!(e.endsWith("[1G")||i[t+1]&&"[1G"===i[t+1]))).filter((e=>!e.startsWith(n.ReadlinePlatform.URLS_QUESTION))).join("\n")}};l=r.__decorate([(0,c.injectable)(),r.__param(0,(0,c.inject)(o.VirtualScripts)),r.__param(1,(0,c.injectAll)(a.RequestExecutor)),r.__metadata("design:paramtypes",[Object,Array])],l),t.DefaultRepeaterCommandHub=l},1289(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ProxyFactory=void 0,t.ProxyFactory=Symbol("ProxyFactory")},1294(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.StopDiscovery=void 0;const r=i(512),o=i(1879),s=i(8641);t.StopDiscovery=class StopDiscovery{constructor(){this.command="discovery:stop [options] <discoveryId>",this.describe="Stop discovery by id."}builder(e){return e.option("token",{alias:"t",describe:"Bright API-key",string:!0,requiresArg:!0,demandOption:!0}).option("project",{alias:"p",requiresArg:!0,string:!0,describe:"ID of the project",demandOption:!0}).positional("discoveryId",{describe:"ID of an existing discovery which you want to stop.",requiresArg:!0,demandOption:!0,type:"string"}).middleware((e=>{var t;return s.container.register(r.RestDiscoveryOptions,{useValue:{insecure:e.insecure,baseURL:e.api,apiKey:e.token,proxyURL:null!==(t=e.proxyBright)&&void 0!==t?t:e.proxy,timeout:e.timeout}})}))}async handler(e){try{const t=s.container.resolve(r.Discoveries);await t.stop(e.project,e.discoveryId),process.exit(0)}catch(e){o.logger.error(o.ErrorMessageFactory.genericCommandError({error:e,command:"discovery:stop"})),process.exit(1)}}}},1314(e){e.exports=require("node:dgram")},1321(e){e.exports=require("reflect-metadata")},1421(e){e.exports=require("node:child_process")},1455(e){e.exports=require("node:fs/promises")},1475(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.RepeaterServer=t.RepeaterErrorCodes=void 0,function(e){e.REPEATER_NOT_PERMITTED="repeater_not_permitted",e.REPEATER_ALREADY_STARTED="repeater_already_started",e.REPEATER_DEACTIVATED="repeater_deactivated",e.REPEATER_UNAUTHORIZED="repeater_unauthorized",e.REPEATER_NO_LONGER_SUPPORTED="repeater_no_longer_supported",e.UNKNOWN_ERROR="unknown_error",e.UNEXPECTED_ERROR="unexpected_error"}(t.RepeaterErrorCodes||(t.RepeaterErrorCodes={})),t.RepeaterServer=Symbol("RepeaterServer")},1553(e){e.exports=require("node:dns/promises")},1560(e,t,i){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.WsRequestExecutor=void 0;const o=i(5584),s=i(1795),n=i(5232),a=i(1879),c=i(18),p=i(3348),l=i(2514),d=i(1033),u=i(8641),h=o.__importDefault(i(5086)),f=i(8474),m=i(7975);let y=r=class WsRequestExecutor{constructor(e,t,i,r){this.proxyFactory=e,this.options=t,this.certificatesCache=i,this.certificatesResolver=r,this.options.proxyUrl&&({httpsAgent:this.httpsProxyAgent,httpAgent:this.httpProxyAgent}=this.proxyFactory.createProxy({proxyUrl:this.options.proxyUrl}))}get protocol(){return n.Protocol.WS}async execute(e){var t,i;try{const t=this.options.certs?this.certificatesResolver.resolve(e,this.options.certs):void 0;return void 0===t||0===t.length?(a.logger.debug("Executing WS request with following params: %j",e),await this.executeRequest(e)):await this.tryRequestWithCertificates(e,t)}catch(r){const o=null!==(t=r.info)&&void 0!==t?t:r.message,n=null!==(i=r.code)&&void 0!==i?i:r.syscall;return a.logger.error("Error executing request: %s",e.url),a.logger.error("Cause: %s",o),new s.Response({message:o,errorCode:n,protocol:this.protocol})}}setTimeout(e){const t=setTimeout((()=>e.emit("error",Object.assign(new Error("Waiting frame has timed out"),{code:"ETIMEDOUT"}))),this.options.timeout);return t.unref(),t}async consume(e,t){const i=await Promise.race([this.waitForResponse(e,t),(0,f.once)(e,"close")]);let r;if(i.length){const[e,t]=i;r={body:"string"==typeof e?e:t,code:"number"==typeof e?e:void 0}}return r}waitForResponse(e,t){return new Promise((i=>{e.on("message",(e=>{const r=String(e);(!t||t.test(r))&&i([r])}))}))}async connect(e){const[,t]=await Promise.all([(0,f.once)(e,"open"),(0,f.once)(e,"upgrade")]),[i]=t;return i}normalizeHeaders(e){return Object.entries(e).reduce(((e,[t,i])=>{const o=t.trim().toLowerCase();return r.FORBIDDEN_HEADERS.has(o)||(e[t]=i),e}),{})}async executeRequest(e){var t;let i,r;try{r=new h.default(e.url,{agent:e.secureEndpoint?this.httpsProxyAgent:this.httpProxyAgent,rejectUnauthorized:!1,handshakeTimeout:this.options.timeout,headers:this.normalizeHeaders(e.headers),ca:e.ca,pfx:e.pfx,passphrase:e.passphrase,maxHeaderSize:d.RequestExecutorConstants.MAX_HEADERS_SIZE});const o=await this.connect(r);await(0,m.promisify)(r.send.bind(r))(e.body),i=this.setTimeout(r);const n=await this.consume(r,e.correlationIdRegex);return new s.Response({protocol:this.protocol,statusCode:null!==(t=n.code)&&void 0!==t?t:o.statusCode,headers:o.headers,body:n.body})}finally{i&&clearTimeout(i),(null==r?void 0:r.readyState)===h.default.OPEN&&r.close(1e3)}}tryRequestWithCertificates(e,t){const i=t.map((async t=>{a.logger.debug("Executing HTTP request with following params: %j",e);try{await e.loadCert(t);const i=await this.executeRequest(e);return this.certificatesCache.add(e,t),i}catch(e){const i=a.Helpers.isTlsCertError(e)?`Failed to do successful request with certificate ${t.path}. It will be excluded from list of known certificates.`:`Unexpected error occured during request: ${e}`;throw a.logger.warn(i),e}}));return Promise.any(i)}};y.FORBIDDEN_HEADERS=new Set(["sec-websocket-version","sec-websocket-key"]),y=r=o.__decorate([(0,u.injectable)(),o.__param(0,(0,u.inject)(a.ProxyFactory)),o.__param(1,(0,u.inject)(c.RequestExecutorOptions)),o.__param(2,(0,u.inject)(p.CertificatesCache)),o.__param(3,(0,u.inject)(l.CertificatesResolver)),o.__metadata("design:paramtypes",[Object,Object,Object,Object])],y),t.WsRequestExecutor=y},1609(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultCertificatesCache=void 0;const r=i(5584),o=i(1879),s=i(8641);let n=class DefaultCertificatesCache{constructor(){this.cache=new Map}add(e,t){const i=this.certificateCacheKeyFromRequest(e);this.cache.has(i)||this.cache.set(i,t)}get(e){return this.cache.get(this.certificateCacheKeyFromRequest(e))}certificateCacheKeyFromRequest(e){const t=new URL(e.url);return`${t.hostname}_${o.Helpers.portFromURL(t)}`}};n=r.__decorate([(0,s.injectable)()],n),t.DefaultCertificatesCache=n},1667(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.CertificatesLoader=void 0;const r=i(5584),o=i(1879),s=r.__importDefault(i(953)),n=r.__importDefault(i(4708)),a=i(1455);t.CertificatesLoader=class CertificatesLoader{constructor(){this.CERT_FILES=["/etc/ssl/certs/ca-certificates.crt","/etc/pki/tls/certs/ca-bundle.crt","/etc/ssl/ca-bundle.pem","/etc/pki/tls/cacert.pem","/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem","/etc/ssl/cert.pem"]}async load(e){const t="win32"===process.platform;try{t?(0,s.default)():"string"==typeof e?await this.loadCertsFromFile(e):await this.discoveryDefaultLocations()}catch{o.logger.warn(`Error Loading Certificate: Cannot load certificates from ${t?"Trusted Root Certification Authorities Certificate Store":e}.`)}}async discoveryDefaultLocations(){for(const e of this.CERT_FILES)try{return void await this.loadCertsFromFile(e)}catch{}o.logger.warn("Error Loading Certificate: Cannot load certificates from the system root. Please use --cacert option to specify the accurate path to the file. https://docs.brightsec.com/docs/cli-initializing-the-repeater#options")}async loadCertsFromFile(e){const t=await(0,a.readFile)(e,"utf8");n.default.globalAgent.options.ca=t.split(/-----END CERTIFICATE-----\n?/).filter((e=>!!e)).map((e=>`${e}-----END CERTIFICATE-----\n`))}}},1692(e){e.exports=require("node:tls")},1708(e){e.exports=require("node:process")},1718(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.RerunDiscovery=void 0;const r=i(512),o=i(1879),s=i(8641);t.RerunDiscovery=class RerunDiscovery{constructor(){this.command="discovery:rerun [options] <discoveryId>",this.describe="Request to start a new discovery using the same configuration as an existing discovery, by discovery ID."}builder(e){return e.option("token",{alias:"t",describe:"Bright API-key",string:!0,requiresArg:!0,demandOption:!0}).positional("discoveryId",{describe:"ID of an existing discovery which you want to re-run.",requiresArg:!0,demandOption:!0,type:"string"}).option("project",{alias:"p",describe:"ID of the project",string:!0,requiresArg:!0,demandOption:!0}).middleware((e=>{var t;return s.container.register(r.RestDiscoveryOptions,{useValue:{insecure:e.insecure,baseURL:e.api,apiKey:e.token,proxyURL:null!==(t=e.proxyBright)&&void 0!==t?t:e.proxy,timeout:e.timeout}})}))}async handler(e){try{const t=s.container.resolve(r.Discoveries),i=e.project,o=e.discoveryId,n=await t.rerun(i,o);console.log(n),process.exit(0)}catch(e){o.logger.error(o.ErrorMessageFactory.genericCommandError({error:e,command:"discovery:rerun"})),process.exit(1)}}}},1795(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Response=void 0;t.Response=class Response{constructor({protocol:e,statusCode:t,headers:i,body:r,message:o,errorCode:s,encoding:n}){this.protocol=e,this.statusCode=t,this.headers=i,this.body=r,this.errorCode=s,this.message=o,this.encoding=n}}},1825(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BaseParser=void 0;const r=i(1455),o=i(2613),s=i(6928);t.BaseParser=class BaseParser{constructor(e){this.validator=e,this.FILE_SIZE_LIMIT=524288e3}async parse(e){await this.access(e);if((await(0,r.stat)(e)).size>this.FILE_SIZE_LIMIT)throw new Error("There is not enough storage space to save this file");const t=await(0,r.readFile)(e,"utf8"),i=(0,s.extname)(e);let o;try{o=await this.deserialize(t,{ext:i})}catch(e){throw new Error(`File is invalid. ${e.message}`)}return await this.validator.validate(o),{content:t,filename:(0,s.basename)(e),contentType:this.contentType(i)}}deserialize(e,t){return JSON.parse(e)}contentType(e){switch(e){case".yml":case".yaml":return"application/yaml";default:return"application/json"}}async access(e){(0,o.ok)(e,"The path is invalid.");try{await(0,r.access)(e,r.constants.F_OK)}catch(t){throw new Error(`${(0,s.basename)(e)} file doesn't found.`)}}}},1860(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});const r=i(5584);r.__exportStar(i(2675),t),r.__exportStar(i(2815),t),r.__exportStar(i(9750),t)},1879(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});const r=i(5584);r.__exportStar(i(5927),t),r.__exportStar(i(0),t),r.__exportStar(i(7918),t),r.__exportStar(i(8718),t),r.__exportStar(i(5599),t),r.__exportStar(i(1289),t),r.__exportStar(i(7565),t)},1973(e){e.exports=require("http-proxy-agent")},2046(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});const r=i(5584);r.__exportStar(i(9878),t),r.__exportStar(i(18),t),r.__exportStar(i(9846),t),r.__exportStar(i(1560),t),r.__exportStar(i(1795),t),r.__exportStar(i(4479),t),r.__exportStar(i(5232),t),r.__exportStar(i(7412),t),r.__exportStar(i(1667),t),r.__exportStar(i(3348),t),r.__exportStar(i(2514),t)},2149(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.StartupManager=void 0,t.StartupManager=Symbol("StartupManager")},2216(e){e.exports=require("socks-proxy-agent")},2217(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.Scans=t.SourceType=t.ScanStatus=t.Module=t.ATTACK_PARAM_LOCATIONS_DEFAULT=t.AttackParamLocation=t.Discovery=void 0,function(e){e.CRAWLER="crawler",e.ARCHIVE="archive",e.OAS="oas"}(t.Discovery||(t.Discovery={})),function(e){e.ARTIFICAL_FRAGMENT="artifical-fragment",e.ARTIFICAL_QUERY="artifical-query",e.ARTIFICIAL_FRAGMENT="artificial-fragment",e.ARTIFICIAL_QUERY="artificial-query",e.BODY="body",e.FRAGMENT="fragment",e.HEADER="header",e.PATH="path",e.QUERY="query"}(i=t.AttackParamLocation||(t.AttackParamLocation={})),t.ATTACK_PARAM_LOCATIONS_DEFAULT=[i.BODY,i.FRAGMENT,i.QUERY],function(e){e.DAST="dast",e.FUZZER="fuzzer"}(t.Module||(t.Module={})),function(e){e.RUNNING="running",e.PENDING="pending",e.STOPPED="stopped",e.FAILED="failed",e.DONE="done",e.DISRUPTED="disrupted",e.SCHEDULED="scheduled",e.QUEUED="queued"}(t.ScanStatus||(t.ScanStatus={})),function(e){e.OPEN_API="openapi",e.RAML="raml",e.POSTMAN="postman",e.HAR="har"}(t.SourceType||(t.SourceType={})),t.Scans=Symbol("Scans")},2264(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultDiscoveryPollingFactory=void 0;const r=i(5584),o=i(8799),s=i(1042),n=i(8641);let a=class DefaultDiscoveryPollingFactory{constructor(e){this.discoveries=e}create(e){return new o.DiscoveryPolling(e,this.discoveries)}};a=r.__decorate([(0,n.injectable)(),r.__param(0,(0,n.inject)(s.Discoveries)),r.__metadata("design:paramtypes",[Object])],a),t.DefaultDiscoveryPollingFactory=a},2297(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DiscoveryPollingFactory=void 0,t.DiscoveryPollingFactory=Symbol("DiscoveryPollingFactory")},2371(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AUTH_TOKEN_VALIDATION_REGEXP=void 0,t.AUTH_TOKEN_VALIDATION_REGEXP=/^[A-Za-z0-9+/=]{7}\.nex[ap]\.[A-Za-z0-9+/=]{32}$/},2514(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.CertificatesResolver=void 0,t.CertificatesResolver=Symbol("CertificatesResolver")},2536(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.RunScan=void 0;const r=i(523),o=i(1879),s=i(8641),n=i(8161);class RunScan{constructor(){this.command="scan:run [options]",this.describe="Start a new scan for the received configuration."}static excludeEntryPoint(e){return e.map((e=>JSON.parse(e))).map((({methods:e=[],patterns:t=[]})=>{const i=t.filter((e=>!!e));return i.length||(o.logger.error(o.ErrorMessageFactory.genericCommandError({command:"scan:run",error:"please make sure that patterns contain at least one regexp"})),process.exit(1)),{methods:[...new Set(e)],patterns:[...new Set(i)]}}))}builder(e){return e.option("token",{alias:"t",describe:"Bright API-key",requiresArg:!0,demandOption:!0}).option("name",{alias:"n",describe:"Name of the scan.",requiresArg:!0,demandOption:!0}).option("auth",{alias:"o",describe:"Auth object ID.",requiresArg:!0}).option("repeater",{alias:"agent",requiresArg:!0,array:!0,describe:"ID of any repeaters connected with the scan."}).option("archive",{alias:"a",normalize:!0,requiresArg:!0,describe:"A collection your app's http/websockets logs into HAR file. Usually you can use browser dev tools or our browser web extension"}).option("crawler",{alias:"c",requiresArg:!0,array:!0,describe:"A list of specific urls that should be included into crawler."}).option("test",{array:!0,describe:`A list of tests to run during a scan. If no tests are specified, the default tests will be run.${n.EOL}For more information about the available tests, please refer to the documentation: https://docs.brightsec.com/docs/vulnerabilities-index${n.EOL}`}).option("bucket",{array:!0,describe:"A list of test buckets which you want to run during a scan."}).option("project",{alias:"p",requiresArg:!0,string:!0,describe:"ID of the project"}).option("template",{alias:"tp",requiresArg:!1,string:!0,describe:"Scan template ID"}).option("module",{default:r.Module.DAST,requiresArg:!0,choices:o.Helpers.toArray(r.Module),describe:"The dast module tests for specific scenarios, mainly OWASP top 10 and other common scenarios. The fuzzer module generates various scenarios to test for unknown vulnerabilities, providing automated AI led fuzzing testing. This module can be coupled with the repeater to find additional vulnerabilities."}).option("host-filter",{alias:"F",requiresArg:!0,array:!0,describe:"A list of specific hosts that should be included into scan."}).option("header",{alias:"H",requiresArg:!0,array:!0,describe:"A list of specific headers that should be included into request."}).option("exclude-param",{requiresArg:!0,array:!0,string:!0,describe:'A list of regex patterns for parameter names you would like to ignore during the tests. Example: "Id$"'}).option("exclude-entry-point",{array:!0,describe:'A list of JSON strings that contain patterns for entry points you would like to ignore during the tests. Pass an empty string to remove default exclusions. To apply patterns for all HTTP methods, you can set an empty array to "methods". Example: \'{ "methods": [], "patterns": ["users\\/?$"] }\'',coerce:RunScan.excludeEntryPoint}).option("smart",{boolean:!0,describe:"Use automatic smart decisions such as: parameter skipping, detection phases, etc. to minimize scan time."}).option("concurrency",{number:!0,default:10,requiresArg:!0,describe:"Number of maximum concurrent requests allowed to be sent to the target, can range between 1 to 50 (default: 10)."}).option("param",{array:!0,defaultDescription:`[${r.ATTACK_PARAM_LOCATIONS_DEFAULT.map((e=>`"${e}"`)).join(",")}]`,requiresArg:!0,choices:o.Helpers.toArray(r.AttackParamLocation),describe:"Defines which part of the request to attack."}).option("entrypoint",{array:!0,alias:"e",describe:"List entrypoint IDs to scan specific entrypoints. If no IDs are provided, the scan will run on the first 2000 project-level entrypoints. This option requires to specify the project ID using the --project option."}).conflicts("entrypoint",["crawler","archive"]).check((e=>{if(e.entrypoint&&e.archive&&e.crawler)throw new Error("Arguments --entrypoint, --archive and --crawler are mutually exclusive");if(!e.entrypoint&&!e.archive&&!e.crawler)throw new Error("When --entrypoint is not provided, either --archive or --crawler must be specified");return!0})).group(["archive","crawler"],"Discovery Options").group(["host-filter","header","module","repeater","test","smart"],"Additional Options").middleware((e=>{var t;return s.container.register(r.RestScansOptions,{useValue:{insecure:e.insecure,baseURL:e.api,apiKey:e.token,proxyURL:null!==(t=e.proxyBright)&&void 0!==t?t:e.proxy,timeout:e.timeout}})}))}async handler(e){try{const t=s.container.resolve(r.Scans),{id:i,warnings:n=[]}=await t.create({tests:e.test,name:e.name,module:e.module,authObjectId:e.auth,projectId:e.project,templateId:e.template,buckets:e.bucket,hostsFilter:e.hostFilter,headers:o.Helpers.parseHeaders(e.header),crawlerUrls:e.crawler,fileId:e.archive,repeaters:e.repeater,smart:e.smart,attackParamLocations:e.param,poolSize:e.concurrency,exclusions:{requests:e.excludeEntryPoint,params:e.excludeParam},entryPointIds:e.entrypoint});console.log(i),n.length&&o.logger.warn(`${n.map((e=>e.message)).join("\n")}\n`),process.exit(0)}catch(e){o.logger.error(o.ErrorMessageFactory.genericCommandError({error:e,command:"scan:run"})),process.exit(1)}}}t.RunScan=RunScan},2613(e){e.exports=require("assert")},2625(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultPollingFactory=void 0;const r=i(5584),o=i(2217),s=i(7831),n=i(3120),a=i(8641);let c=class DefaultPollingFactory{constructor(e,t){this.scans=e,this.breakpointFactory=t}create(e){const t=this.breakpointFactory.create(e.breakpoint);return new s.BasePolling(e,this.scans,t)}};c=r.__decorate([(0,a.injectable)(),r.__param(0,(0,a.inject)(o.Scans)),r.__param(1,(0,a.inject)(n.BreakpointFactory)),r.__metadata("design:paramtypes",[Object,Object])],c),t.DefaultPollingFactory=c},2675(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.CliBuilder=void 0;const r=i(5584),o=i(1879),s=i(9654),n=i(6436),a=r.__importDefault(i(2736)),c=r.__importDefault(i(1708));t.CliBuilder=class CliBuilder{constructor(e){this._options=e}get options(){return this._options}build({commands:e}){const{configReader:t,info:r}=this.options,s=i(8314).option("config",{requiresArg:!0,describe:"Path to the file with configuration",config:!0,default:t.discovery(r.cwd),configParser:e=>t.load(e).toJSON()}).option("log-level",{requiresArg:!0,choices:Object.keys(o.LogLevel).map((e=>isNaN(+e)?e.toLowerCase():+e)),default:o.LogLevel.NOTICE,describe:"What level of logs to report. Any logs of a higher level than the setting are shown."}).option("log-file",{requiresArg:!0,type:"string",describe:"File path to write logs to. If specified, logs will be written to this file"}).implies({"log-max-size":"log-file","log-max-files":"log-file","log-rotate-interval":"log-file","log-compress":"log-file"}).group(["log-max-size","log-max-files","log-rotate-interval","log-compress"],"Log Rotation Options (requires --log-file):").option("log-max-size",{requiresArg:!0,type:"string",describe:'Maximum size of log file before rotation (e.g., "10MB", "1GB"). Default: 10MB'}).option("log-max-files",{requiresArg:!0,type:"number",describe:"Maximum number of rotated log files to keep. Default: 5"}).option("log-rotate-interval",{requiresArg:!0,type:"string",describe:'Time interval to rotate log files (e.g., "1d", "12h", "7d"). Default: 1d'}).option("log-compress",{type:"boolean",describe:"Compress rotated log files using gzip. Default: true"}).option("cluster",{deprecated:"Use --hostname instead",requiresArg:!0,describe:"Bright application name (domain name). [default: app.brightsec.com]"}).option("hostname",{requiresArg:!0,describe:"Bright application name (domain name). [default: app.brightsec.com]"}).option("insecure",{boolean:!0,default:!1,description:"Allows CLI to proceed and operate even for server connections otherwise considered insecure."}).option("proxy",{requiresArg:!0,default:c.default.env.PROXY,describe:"Specify a proxy URL to route all traffic through. This should be an HTTP(S), SOCKS4, or SOCKS5 URL. By default, if you specify SOCKS://<URL>, then SOCKS5h is applied."}).option("proxy-bright",{requiresArg:!0,describe:"Specify a proxy URL to route all outbound traffic through. For more information, see the --proxy option."}).option("proxy-target",{requiresArg:!0,describe:"Specify a proxy URL to route all inbound traffic through. For more information, see the --proxy option."}).option("timeout",{describe:"Request timeout in seconds or a duration string (e.g. 10s, 1m, 1h, 10h, 1y).",default:30,coerce:e=>isNaN(+e)?(0,a.default)(e):1e3*+e}).conflicts({proxy:["proxy-bright","proxy-target"],hostname:"cluster"}).middleware((e=>{const{api:t,repeaterServer:i}=o.Helpers.getClusterUrls(e);if(e.api=t,e.repeaterServer=i,e.logFile){const t={maxSize:e["log-max-size"],maxFiles:e["log-max-files"],interval:e["log-rotate-interval"],compress:!1===e["log-compress"]?void 0:"gzip"};o.Logger.configure(e.logLevel,e.logFile,t)}})).middleware((e=>(o.logger.logLevel=e["log-level"],e["log-file"]&&(o.logger.logFile=e["log-file"]),e))).middleware((e=>{var t;return o.logger.logLevel=isNaN(+e.logLevel)?o.LogLevel[null===(t=e.logLevel)||void 0===t?void 0:t.toString().toUpperCase()]:+e.logLevel})).usage("Usage: $0 <command> [options] [<file | scan>]").pkgConf("bright",r.cwd).example("$0 archive:generate --mockfile=.mockfile --name=archive.har","output har file on base your mock requests");return e.reduce(((e,t)=>e.command(this.wrapWithSentry(t))),s).recommendCommands().demandCommand(1).strict(!0).version(r.version).alias("v","version").help("help").alias("h","help").wrap(null)}wrapWithSentry(e){const t=e.handler.bind(e);return e.handler=async e=>{const i=new s.SystemConfigManager(e.api),r=await i.read();return(0,n.runWithAsyncContext)((()=>(this.initSentry(r.sentryDsn),(0,n.setContext)("args",e),i.enableBackgroundRotation((e=>{this.initSentry(e.sentryDsn)})),t(e))))},e}initSentry(e){(0,n.init)({dsn:e,attachStacktrace:!0,release:c.default.env.VERSION,beforeSend:e=>(e.contexts.args&&(e.contexts.args={...e.contexts.args,t:e.contexts.args.t&&"[Filtered]",token:e.contexts.args.token&&"[Filtered]"}),e)})}}},2736(e){e.exports=require("ms")},2815(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigReader=void 0,t.ConfigReader=Symbol("ConfigReader")},2887(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.VersionCommand=void 0;const r=i(1879),o=i(5317);class VersionCommand{constructor(){this.command="version",this.describe="Prints Bright CLI version this project uses."}static executeCommand(e){return new Promise(((t,i)=>{(0,o.exec)(e,((e,r,o)=>r?t(r):o?t(o):e?i(e):void t("")))}))}async handler(){const e=(await VersionCommand.executeCommand("npm list --depth=0")).match(/ @brightsec\/cli@(.*)\n/),t=(e&&e[1]?e[1]:"").replace(/"invalid"/gi,"").trim(),i=(await VersionCommand.executeCommand("npm list -g --depth=0")).match(/ @brightsec\/cli@(.*)\n/),o=(i&&i[1]?i[1]:"").replace(/"invalid"/gi,"").trim();t?r.logger.log("Local installed version:",t):r.logger.warn("No local installed Bright CLI was found."),o?r.logger.log("Global installed Bright CLI version:",o):r.logger.warn("No global installed was found."),t&&o&&t!==o&&r.logger.warn("To avoid issues with CLI please make sure your global and local Bright CLI versions match, or you are using locally installed Bright CLI instead of global one.")}}t.VersionCommand=VersionCommand},2916(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.FSTokens=void 0;const r=i(5584),o=i(1879),s=i(8641),n=i(8161),a=i(3024),c=i(6760);let p=class FSTokens{constructor(){this.baseDir=(0,n.homedir)()}writeTokens(e){o.logger.debug("Saving tokens to file %s",this.path),(0,a.writeFileSync)(this.path,JSON.stringify(e))}readTokens(){for(const e of[this.path,this.legacyPath])if(o.logger.debug("Reading saved tokens from file %s",e),(0,a.existsSync)(e)){o.logger.debug("File found. Return the tokens.");const t=(0,a.readFileSync)(e);return JSON.parse(t.toString("utf8"))}o.logger.debug("File doesn't exist.")}get path(){return(0,c.join)(this.baseDir,".bright-cli")}get legacyPath(){return(0,c.join)(this.baseDir,".nexploit-cli")}};p=r.__decorate([(0,s.injectable)()],p),t.FSTokens=p},3024(e){e.exports=require("node:fs")},3025(e){e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema#","id":"https://schema.getpostman.com/json/collection/v2.1.0/","type":"object","properties":{"info":{"$ref":"#/definitions/info"},"item":{"type":"array","description":"Items are the basic unit for a Postman collection. You can think of them as corresponding to a single API endpoint. Each Item has one request and may have multiple API responses associated with it.","items":{"title":"Items","oneOf":[{"$ref":"#/definitions/item"},{"$ref":"#/definitions/item-group"}]}},"event":{"$ref":"#/definitions/event-list"},"variable":{"$ref":"#/definitions/variable-list"},"auth":{"oneOf":[{"type":"null"},{"$ref":"#/definitions/auth"}]},"protocolProfileBehavior":{"$ref":"#/definitions/protocol-profile-behavior"}},"required":["info","item"],"definitions":{"auth-attribute":{"$schema":"http://json-schema.org/draft-04/schema#","type":"object","title":"Auth","id":"#/definitions/auth-attribute","description":"Represents an attribute for any authorization method provided by Postman. For example `username` and `password` are set as auth attributes for Basic Authentication method.","properties":{"key":{"type":"string"},"value":{},"type":{"type":"string"}},"required":["key"]},"auth":{"$schema":"http://json-schema.org/draft-04/schema#","type":"object","title":"Auth","id":"#/definitions/auth","description":"Represents authentication helpers provided by Postman","properties":{"type":{"type":"string","enum":["apikey","awsv4","basic","bearer","digest","edgegrid","hawk","noauth","oauth1","oauth2","ntlm"]},"noauth":{},"apikey":{"type":"array","title":"API Key Authentication","description":"The attributes for API Key Authentication.","items":{"$ref":"#/definitions/auth-attribute"}},"awsv4":{"type":"array","title":"AWS Signature v4","description":"The attributes for [AWS Auth](http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html).","items":{"$ref":"#/definitions/auth-attribute"}},"basic":{"type":"array","title":"Basic Authentication","description":"The attributes for [Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication).","items":{"$ref":"#/definitions/auth-attribute"}},"bearer":{"type":"array","title":"Bearer Token Authentication","description":"The helper attributes for [Bearer Token Authentication](https://tools.ietf.org/html/rfc6750)","items":{"$ref":"#/definitions/auth-attribute"}},"digest":{"type":"array","title":"Digest Authentication","description":"The attributes for [Digest Authentication](https://en.wikipedia.org/wiki/Digest_access_authentication).","items":{"$ref":"#/definitions/auth-attribute"}},"edgegrid":{"type":"array","title":"EdgeGrid Authentication","description":"The attributes for [Akamai EdgeGrid Authentication](https://developer.akamai.com/legacy/introduction/Client_Auth.html).","items":{"$ref":"#/definitions/auth-attribute"}},"hawk":{"type":"array","title":"Hawk Authentication","description":"The attributes for [Hawk Authentication](https://github.com/hueniverse/hawk)","items":{"$ref":"#/definitions/auth-attribute"}},"ntlm":{"type":"array","title":"NTLM Authentication","description":"The attributes for [NTLM Authentication](https://msdn.microsoft.com/en-us/library/cc237488.aspx)","items":{"$ref":"#/definitions/auth-attribute"}},"oauth1":{"type":"array","title":"OAuth1","description":"The attributes for [OAuth2](https://oauth.net/1/)","items":{"$ref":"#/definitions/auth-attribute"}},"oauth2":{"type":"array","title":"OAuth2","description":"Helper attributes for [OAuth2](https://oauth.net/2/)","items":{"$ref":"#/definitions/auth-attribute"}}},"required":["type"]},"certificate-list":{"$schema":"http://json-schema.org/draft-04/schema#","id":"#/definitions/certificate-list","title":"Certificate List","description":"A representation of a list of ssl certificates","type":"array","items":{"$ref":"#/definitions/certificate"}},"certificate":{"$schema":"http://json-schema.org/draft-04/schema#","id":"#/definitions/certificate","title":"Certificate","description":"A representation of an ssl certificate","type":"object","properties":{"name":{"description":"A name for the certificate for user reference","type":"string"},"matches":{"description":"A list of Url match pattern strings, to identify Urls this certificate can be used for.","type":"array","item":{"type":"string","description":"An Url match pattern string"}},"key":{"description":"An object containing path to file containing private key, on the file system","type":"object","properties":{"src":{"description":"The path to file containing key for certificate, on the file system"}}},"cert":{"description":"An object containing path to file certificate, on the file system","type":"object","properties":{"src":{"description":"The path to file containing key for certificate, on the file system"}}},"passphrase":{"description":"The passphrase for the certificate","type":"string"}}},"cookie-list":{"$schema":"http://json-schema.org/draft-04/schema#","id":"#/definitions/cookie-list","title":"Certificate List","description":"A representation of a list of cookies","type":"array","items":{"$ref":"#/definitions/cookie"}},"cookie":{"$schema":"http://json-schema.org/draft-04/schema#","type":"object","title":"Cookie","id":"#/definitions/cookie","description":"A Cookie, that follows the [Google Chrome format](https://developer.chrome.com/extensions/cookies)","properties":{"domain":{"type":"string","description":"The domain for which this cookie is valid."},"expires":{"oneOf":[{"type":"string"},{"type":"number"}],"description":"When the cookie expires."},"maxAge":{"type":"string"},"hostOnly":{"type":"boolean","description":"True if the cookie is a host-only cookie. (i.e. a request\'s URL domain must exactly match the domain of the cookie)."},"httpOnly":{"type":"boolean","description":"Indicates if this cookie is HTTP Only. (if True, the cookie is inaccessible to client-side scripts)"},"name":{"type":"string","description":"This is the name of the Cookie."},"path":{"type":"string","description":"The path associated with the Cookie."},"secure":{"type":"boolean","description":"Indicates if the \'secure\' flag is set on the Cookie, meaning that it is transmitted over secure connections only. (typically HTTPS)"},"session":{"type":"boolean","description":"True if the cookie is a session cookie."},"value":{"type":"string","description":"The value of the Cookie."},"extensions":{"type":"array","description":"Custom attributes for a cookie go here, such as the [Priority Field](https://code.google.com/p/chromium/issues/detail?id=232693)"}},"required":["domain","path"]},"description":{"$schema":"http://json-schema.org/draft-04/schema#","id":"#/definitions/description","description":"A Description can be a raw text, or be an object, which holds the description along with its format.","oneOf":[{"type":"object","title":"Description","properties":{"content":{"type":"string","description":"The content of the description goes here, as a raw string."},"type":{"type":"string","description":"Holds the mime type of the raw description content. E.g: \'text/markdown\' or \'text/html\'.\\nThe type is used to correctly render the description when generating documentation, or in the Postman app."},"version":{"description":"Description can have versions associated with it, which should be put in this property."}}},{"type":"string"},{"type":"null"}]},"event-list":{"$schema":"http://json-schema.org/draft-04/schema#","id":"#/definitions/event-list","title":"Event List","type":"array","description":"Postman allows you to configure scripts to run when specific events occur. These scripts are stored here, and can be referenced in the collection by their ID.","items":{"$ref":"#/definitions/event"}},"event":{"$schema":"http://json-schema.org/draft-04/schema#","id":"#/definitions/event","title":"Event","description":"Defines a script associated with an associated event name","type":"object","properties":{"id":{"type":"string","description":"A unique identifier for the enclosing event."},"listen":{"type":"string","description":"Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively."},"script":{"$ref":"#/definitions/script"},"disabled":{"type":"boolean","default":false,"description":"Indicates whether the event is disabled. If absent, the event is assumed to be enabled."}},"required":["listen"]},"header-list":{"$schema":"http://json-schema.org/draft-04/schema#","id":"#/definitions/header-list","title":"Header List","description":"A representation for a list of headers","type":"array","items":{"$ref":"#/definitions/header"}},"header":{"$schema":"http://json-schema.org/draft-04/schema#","type":"object","title":"Header","id":"#/definitions/header","description":"Represents a single HTTP Header","properties":{"key":{"description":"This holds the LHS of the HTTP Header, e.g ``Content-Type`` or ``X-Custom-Header``","type":"string"},"value":{"type":"string","description":"The value (or the RHS) of the Header is stored in this field."},"disabled":{"type":"boolean","default":false,"description":"If set to true, the current header will not be sent with requests."},"description":{"$ref":"#/definitions/description"}},"required":["key","value"]},"info":{"$schema":"http://json-schema.org/draft-04/schema#","id":"#/definitions/info","title":"Information","description":"Detailed description of the info block","type":"object","properties":{"name":{"type":"string","title":"Name of the collection","description":"A collection\'s friendly name is defined by this field. You would want to set this field to a value that would allow you to easily identify this collection among a bunch of other collections, as such outlining its usage or content."},"_postman_id":{"type":"string","description":"Every collection is identified by the unique value of this field. The value of this field is usually easiest to generate using a UID generator function. If you already have a collection, it is recommended that you maintain the same id since changing the id usually implies that is a different collection than it was originally.\\n *Note: This field exists for compatibility reasons with Collection Format V1.*"},"description":{"$ref":"#/definitions/description"},"version":{"$ref":"#/definitions/version"},"schema":{"description":"This should ideally hold a link to the Postman schema that is used to validate this collection. E.g: https://schema.getpostman.com/collection/v1","type":"string"}},"required":["name","schema"]},"item-group":{"$schema":"http://json-schema.org/draft-04/schema#","title":"Folder","id":"#/definitions/item-group","description":"One of the primary goals of Postman is to organize the development of APIs. To this end, it is necessary to be able to group requests together. This can be achived using \'Folders\'. A folder just is an ordered set of requests.","type":"object","properties":{"name":{"type":"string","description":"A folder\'s friendly name is defined by this field. You would want to set this field to a value that would allow you to easily identify this folder."},"description":{"$ref":"#/definitions/description"},"variable":{"$ref":"#/definitions/variable-list"},"item":{"description":"Items are entities which contain an actual HTTP request, and sample responses attached to it. Folders may contain many items.","type":"array","items":{"title":"Items","anyOf":[{"$ref":"#/definitions/item"},{"$ref":"#/definitions/item-group"}]}},"event":{"$ref":"#/definitions/event-list"},"auth":{"oneOf":[{"type":"null"},{"$ref":"#/definitions/auth"}]},"protocolProfileBehavior":{"$ref":"#/definitions/protocol-profile-behavior"}},"required":["item"]},"item":{"$schema":"http://json-schema.org/draft-04/schema#","type":"object","title":"Item","id":"#/definitions/item","description":"Items are entities which contain an actual HTTP request, and sample responses attached to it.","properties":{"id":{"type":"string","description":"A unique ID that is used to identify collections internally"},"name":{"type":"string","description":"A human readable identifier for the current item."},"description":{"$ref":"#/definitions/description"},"variable":{"$ref":"#/definitions/variable-list"},"event":{"$ref":"#/definitions/event-list"},"request":{"$ref":"#/definitions/request"},"response":{"type":"array","title":"Responses","items":{"$ref":"#/definitions/response"}},"protocolProfileBehavior":{"$ref":"#/definitions/protocol-profile-behavior"}},"required":["request"]},"protocol-profile-behavior":{"$schema":"http://json-schema.org/draft-04/schema#","type":"object","title":"Protocol Profile Behavior","id":"#/definitions/protocol-profile-behavior","description":"Set of configurations used to alter the usual behavior of sending the request"},"proxy-config":{"$schema":"http://json-schema.org/draft-04/schema#","id":"#/definitions/proxy-config","title":"Proxy Config","description":"Using the Proxy, you can configure your custom proxy into the postman for particular url match","type":"object","properties":{"match":{"default":"http+https://*/*","description":"The Url match for which the proxy config is defined","type":"string"},"host":{"type":"string","description":"The proxy server host"},"port":{"type":"integer","minimum":0,"default":8080,"description":"The proxy server port"},"tunnel":{"description":"The tunneling details for the proxy config","default":false,"type":"boolean"},"disabled":{"type":"boolean","default":false,"description":"When set to true, ignores this proxy configuration entity"}}},"request":{"$schema":"http://json-schema.org/draft-04/schema#","id":"#/definitions/request","title":"Request","description":"A request represents an HTTP request. If a string, the string is assumed to be the request URL and the method is assumed to be \'GET\'.","oneOf":[{"type":"object","title":"Reques