mobbdev 1.0.64 → 1.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +18 -4
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -7860,14 +7860,26 @@ var GetVulByNodesMetadataZ = z27.object({
7860
7860
  var debug11 = Debug11("mobbdev:gql");
7861
7861
  var API_KEY_HEADER_NAME = "x-mobb-key";
7862
7862
  var REPORT_STATE_CHECK_DELAY = 5 * 1e3;
7863
- var fetchWithProxy = (url, options = {}) => {
7863
+ function getProxyAgent(url) {
7864
7864
  try {
7865
- const parsedUrl = new URL(url.toString());
7865
+ const parsedUrl = new URL(url);
7866
7866
  const isHttp = parsedUrl.protocol === "http:";
7867
7867
  const isHttps = parsedUrl.protocol === "https:";
7868
7868
  const proxy = isHttps ? HTTPS_PROXY : isHttp ? HTTP_PROXY : null;
7869
7869
  if (proxy) {
7870
- const agent = isHttps ? new HttpsProxyAgent2(proxy) : new HttpProxyAgent2(proxy);
7870
+ debug11("Using proxy %s", proxy);
7871
+ debug11("Proxy agent %o", proxy);
7872
+ return isHttps ? new HttpsProxyAgent2(proxy) : new HttpProxyAgent2(proxy);
7873
+ }
7874
+ } catch (err) {
7875
+ debug11(`Skipping proxy for ${url}. Reason: ${err.message}`);
7876
+ }
7877
+ return void 0;
7878
+ }
7879
+ var fetchWithProxy = (url, options = {}) => {
7880
+ try {
7881
+ const agent = getProxyAgent(url.toString());
7882
+ if (agent) {
7871
7883
  return fetchOrig(url, {
7872
7884
  ...options,
7873
7885
  // @ts-expect-error Node-fetch doesn't type 'agent', but it's valid
@@ -8611,9 +8623,11 @@ async function uploadFile({
8611
8623
  debug15("upload file from buffer");
8612
8624
  form.append("file", new File([file], "file"));
8613
8625
  }
8626
+ const agent = getProxyAgent(url);
8614
8627
  const response = await fetch3(url, {
8615
8628
  method: "POST",
8616
- body: form
8629
+ body: form,
8630
+ agent
8617
8631
  });
8618
8632
  if (!response.ok) {
8619
8633
  debug15("error from S3 %s %s", response.body, response.status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.0.64",
3
+ "version": "1.0.65",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "git+https://github.com/mobb-dev/bugsy.git",
6
6
  "main": "dist/index.js",