CVE-2024-34714 (JSON, published 2024-05-14T16:17Z)
Description: value: The Hoppscotch Browser Extension is a browser extension for Hoppscotch, a community-driven end-to-end open-source API development ecosystem. Due to an oversight during a change made to the extension in the commit d4e8e4830326f46ba17acd1307977ecd32a85b58, a critical check for the origin list was missed and allowed for messages to be sent to the extension which the extension gladly processed and responded back with the results of, while this wasn't supposed to happen and be blocked by the origin not being present in the origin list.

This vulnerability exposes Hoppscotch Extension users to sites which call into Hoppscotch Extension APIs internally. This fundamentally allows any site running on the browser with the extension installed to bypass CORS restrictions if the user is running extensions with the given version. This security hole was patched in the commit 7e364b928ab722dc682d0fcad713a96cc38477d6 which was released along with the extension version `0.35`. As a workaround, Chrome users can use the Extensions Settings to disable the extension access to only the origins that you want. Firefox doesn't have an alternative to upgrading to a fixed version.
Severity: nan (CVSS v3 base score: )
Weakness: NVD-CWE-noinfo \u2014 Insufficient Information
There is insufficient information about the issue to classify it; details are unkown or unspecified.
Repository: https://github.com/hoppscotch/hoppscotch-extension
Files changed:
.parcelrc
manifest.chrome.json
manifest.common.json
manifest.firefox.json
mergeManifest.js
package.json
pnpm-lock.yaml
src/contentScript.ts
src/hookContent.js
Commit message: chore: firefox manifest v3 support (#232)

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>

Vulnerable code:
    "*.ttf": ["@parcel/transformer-raw"]
  }
}
  "version": "0.26",
  "background": {
    "service_worker": "index.js"
  },
  "applications": {
    "gecko": {
      "id": "postwoman-firefox@postwoman.io"
    }
  },
  "browser_specific_settings": {
    "gecko": {
      "id": "postwoman-firefox@postwoman.io"
    }
  },
  "version": "0.26.0",
    "clean": "rimraf dist",
    "build": "pnpm exec parcel build src/* --dist-dir dist/ && pnpm exec copyfiles manifest.json dist && pnpm exec copyfiles icons/* dist"
  chrome.runtime.sendMessage(<HOOK_MESSAGE>{
    type: "execute_hook",
    origin_type: originList.includes(url.origin)
      ? "VALID_ORIGIN"
      : "UNKNOWN_ORIGIN",
  })
const VERSION = { major: 0, minor: 26 }
    getVersion: () => ({ major: 0, minor: 26 }),

Fixed code:
    "*.ttf": [
      "@parcel/transformer-raw"
    ]
  },
  "reporters": [
    "./mergeManifest.js"
  ]
}
{
  "background": {
    "service_worker": "index.js"
  }
}
  "version": "0.27",
{
  "background": {
    "scripts": ["index.js"]
  },
  "browser_specific_settings": {
    "gecko": {
      "id": "postwoman-firefox@postwoman.io"
    }
  }
}
const { Reporter } = require("@parcel/plugin")
const fs = require("fs").promises

module.exports = new Reporter({
  async report({ event }) {
    const target = process.env.HOPP_EXTENSION_TARGET

    if (!target) {
      return
    }

    if (event.type == "buildSuccess") {
      const manifestCommon = (
        await fs.readFile("./manifest.common.json")
      ).toString()

      let targetManifestFilePath

      if (target == "CHROME") {
        targetManifestFilePath = "./manifest.chrome.json"
      } else if (target == "FIREFOX") {
        targetManifestFilePath = "./manifest.firefox.json"
      } else {
        return
      }

      const targetSpecificManifest = (
        await fs.readFile(targetManifestFilePath)
      ).toString()

      const manifestFinal = JSON.stringify(
        {
          ...JSON.parse(manifestCommon),
          ...JSON.parse(targetSpecificManifest),
        },
        null,
        2
      )

      // make sure the ./dist folder exists
      await fs.mkdir("./dist").catch(() => {})

      await fs.writeFile("./dist/manifest.json", manifestFinal, {
        flag: "w",
      })

      process.stdout.write("💚 Manifest File Written Successfully")
    }
  },
})
  "version": "0.27.0",
    "clean": "rimraf dist .parcel-cache",
    "build:chrome": "HOPP_EXTENSION_TARGET=CHROME parcel build src/* --dist-dir dist/ && copyfiles icons/* dist",
    "build:firefox": "HOPP_EXTENSION_TARGET=FIREFOX parcel build src/* --dist-dir dist/ && copyfiles icons/* dist"
    "@parcel/plugin": "^2.10.0",
  '@parcel/plugin':
    specifier: ^2.10.0
    version: 2.10.0(@parcel/core@2.10.0)
const fs = require("fs")

const hookContent = fs.readFileSync(__dirname + "/hookContent.js", {
  encoding: "utf-8",
})

const hookContentInvalidOrigin = fs.readFileSync(
  __dirname + "/hookContentInvalidOrigin.js",
  {
    encoding: "utf-8",
  }
)

  const originType = originList.includes(url.origin)
    ? "VALID_ORIGIN"
    : "UNKNOWN_ORIGIN"

  if (process.env.HOPP_EXTENSION_TARGET === "FIREFOX") {
    const script = document.createElement("script")
    script.textContent = originList.includes(url.origin)
      ? hookContent
      : hookContentInvalidOrigin
    document.documentElement.appendChild(script)
    script.parentNode.removeChild(script)
  } else {
    chrome.runtime.sendMessage(<HOOK_MESSAGE>{
      type: "execute_hook",
      origin_type: originType,
    })
  }
const VERSION = { major: 0, minor: 27 }
    getVersion: () => ({ major: 0, minor: 27 }),