Program: CWE-416
Project: CVE-2022-23597
Buggy source:
{
  "name": "element-desktop",
  "productName": "Element",
  "main": "lib/electron-main.js",
  "version": "1.9.6",
  "description": "A feature-rich client for Matrix.org",
  "author": "Element",
  "repository": {
    "type": "git",
    "url": "https://github.com/vector-im/element-desktop"
  },
  "license": "Apache-2.0",
  "files": [],
  "scripts": {
    "i18n": "matrix-gen-i18n",
    "prunei18n": "matrix-prune-i18n",
    "diff-i18n": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && matrix-gen-i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
    "mkdirs": "mkdirp packages deploys",
    "fetch": "yarn run mkdirs && node scripts/fetch-package.js",
    "asar-webapp": "asar p webapp webapp.asar",
    "start": "yarn run build:ts && yarn run build:res && electron .",
    "lint": "yarn lint:types && yarn lint:js",
    "lint:js": "eslint --max-warnings 0 src scripts hak",
    "lint:js-fix": "eslint --fix src scripts hak",
    "lint:types": "tsc --noEmit",
    "build:native": "yarn run hak",
    "build:native:universal": "yarn run hak --target x86_64-apple-darwin fetchandbuild && yarn run hak --target aarch64-apple-darwin fetchandbuild && yarn run hak --target x86_64-apple-darwin --target aarch64-apple-darwin copyandlink",
    "build:32": "yarn run build:ts && yarn run build:res && electron-builder --ia32",
    "build:64": "yarn run build:ts && yarn run build:res && electron-builder --x64",
    "build:universal": "yarn run build:ts && yarn run build:res && electron-builder --universal",
    "build": "yarn run build:ts && yarn run build:res && electron-builder",
    "build:ts": "tsc",
    "build:res": "node scripts/copy-res.js",
    "docker:setup": "docker build -t element-desktop-dockerbuild dockerbuild",
    "docker:build:native": "scripts/in-docker.sh yarn run hak",
    "docker:build": "scripts/in-docker.sh yarn run build",
    "docker:install": "scripts/in-docker.sh yarn install",
    "debrepo": "scripts/mkrepo.sh",
    "clean": "rimraf webapp.asar dist packages deploys lib",
    "hak": "node scripts/hak/index.js"
  },
  "dependencies": {
    "auto-launch": "^5.0.5",
    "counterpart": "^0.18.6",
    "electron-store": "^6.0.1",
    "electron-window-state": "^5.0.3",
    "minimist": "^1.2.3",
    "png-to-ico": "^2.1.1",
    "request": "^2.88.2"
  },
  "devDependencies": {
    "@types/auto-launch": "^5.0.1",
    "@types/counterpart": "^0.18.1",
    "@types/minimist": "^1.2.1",
    "@typescript-eslint/eslint-plugin": "^4.17.0",
    "@typescript-eslint/parser": "^4.17.0",
    "allchange": "^1.0.6",
    "asar": "^2.0.1",
    "chokidar": "^3.5.2",
    "electron": "13.5",
    "electron-builder": "22.11.4",
    "electron-builder-squirrel-windows": "22.11.4",
    "electron-devtools-installer": "^3.1.1",
    "electron-notarize": "^1.0.0",
    "eslint": "7.18.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-matrix-org": "github:matrix-org/eslint-plugin-matrix-org#2306b3d4da4eba908b256014b979f1d3d43d2945",
    "find-npm-prefix": "^1.0.2",
    "fs-extra": "^8.1.0",
    "glob": "^7.1.6",
    "matrix-web-i18n": "github:matrix-org/matrix-web-i18n",
    "mkdirp": "^1.0.3",
    "needle": "^2.5.0",
    "node-pre-gyp": "^0.15.0",
    "pacote": "^11.3.5",
    "rimraf": "^3.0.2",
    "tar": "^6.1.2",
    "typescript": "^4.1.3"
  },
  "hakDependencies": {
    "matrix-seshat": "^2.3.0",
    "keytar": "^5.6.0"
  },
  "build": {
    "appId": "im.riot.app",
    "electronVersion": "13.5.1",
    "files": [
      "package.json",
      {
        "from": ".hak/hakModules",
        "to": "node_modules"
      },
      "lib/**"
    ],
    "extraResources": [
      {
        "from": "res/img",
        "to": "img"
      },
      "webapp.asar"
    ],
    "linux": {
      "target": "deb",
      "category": "Network;InstantMessaging;Chat",
      "maintainer": "support@element.io",
      "desktop": {
        "StartupWMClass": "element"
      }
    },
    "mac": {
      "category": "public.app-category.social-networking",
      "darkModeSupport": true
    },
    "win": {
      "target": {
        "target": "squirrel"
      },
      "sign": "scripts/electron_winSign"
    },
    "directories": {
      "output": "dist"
    },
    "afterPack": "scripts/electron_afterPack",
    "afterSign": "scripts/electron_afterSign",
    "protocols": [
      {
        "name": "element",
        "schemes": [
          "element"
        ]
      }
    ]
  }
}


Fixed version (ground truth):
{
  "name": "element-desktop",
  "productName": "Element",
  "main": "lib/electron-main.js",
  "version": "1.9.6",
  "description": "A feature-rich client for Matrix.org",
  "author": "Element",
  "repository": {
    "type": "git",
    "url": "https://github.com/vector-im/element-desktop"
  },
  "license": "Apache-2.0",
  "files": [],
  "scripts": {
    "i18n": "matrix-gen-i18n",
    "prunei18n": "matrix-prune-i18n",
    "diff-i18n": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && matrix-gen-i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
    "mkdirs": "mkdirp packages deploys",
    "fetch": "yarn run mkdirs && node scripts/fetch-package.js",
    "asar-webapp": "asar p webapp webapp.asar",
    "start": "yarn run build:ts && yarn run build:res && electron .",
    "lint": "yarn lint:types && yarn lint:js",
    "lint:js": "eslint --max-warnings 0 src scripts hak",
    "lint:js-fix": "eslint --fix src scripts hak",
    "lint:types": "tsc --noEmit",
    "build:native": "yarn run hak",
    "build:native:universal": "yarn run hak --target x86_64-apple-darwin fetchandbuild && yarn run hak --target aarch64-apple-darwin fetchandbuild && yarn run hak --target x86_64-apple-darwin --target aarch64-apple-darwin copyandlink",
    "build:32": "yarn run build:ts && yarn run build:res && electron-builder --ia32",
    "build:64": "yarn run build:ts && yarn run build:res && electron-builder --x64",
    "build:universal": "yarn run build:ts && yarn run build:res && electron-builder --universal",
    "build": "yarn run build:ts && yarn run build:res && electron-builder",
    "build:ts": "tsc",
    "build:res": "node scripts/copy-res.js",
    "docker:setup": "docker build -t element-desktop-dockerbuild dockerbuild",
    "docker:build:native": "scripts/in-docker.sh yarn run hak",
    "docker:build": "scripts/in-docker.sh yarn run build",
    "docker:install": "scripts/in-docker.sh yarn install",
    "debrepo": "scripts/mkrepo.sh",
    "clean": "rimraf webapp.asar dist packages deploys lib",
    "hak": "node scripts/hak/index.js"
  },
  "dependencies": {
    "auto-launch": "^5.0.5",
    "counterpart": "^0.18.6",
    "electron-store": "^6.0.1",
    "electron-window-state": "^5.0.3",
    "minimist": "^1.2.3",
    "png-to-ico": "^2.1.1",
    "request": "^2.88.2"
  },
  "devDependencies": {
    "@types/auto-launch": "^5.0.1",
    "@types/counterpart": "^0.18.1",
    "@types/minimist": "^1.2.1",
    "@typescript-eslint/eslint-plugin": "^4.17.0",
    "@typescript-eslint/parser": "^4.17.0",
    "allchange": "^1.0.6",
    "asar": "^2.0.1",
    "chokidar": "^3.5.2",
    "electron": "13.5",
    "electron-builder": "22.11.4",
    "electron-builder-squirrel-windows": "22.11.4",
    "electron-devtools-installer": "^3.1.1",
    "electron-notarize": "^1.0.0",
    "eslint": "7.18.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-matrix-org": "github:matrix-org/eslint-plugin-matrix-org#2306b3d4da4eba908b256014b979f1d3d43d2945",
    "find-npm-prefix": "^1.0.2",
    "fs-extra": "^8.1.0",
    "glob": "^7.1.6",
    "matrix-web-i18n": "github:matrix-org/matrix-web-i18n",
    "mkdirp": "^1.0.3",
    "needle": "^2.5.0",
    "node-pre-gyp": "^0.15.0",
    "pacote": "^11.3.5",
    "rimraf": "^3.0.2",
    "tar": "^6.1.2",
    "typescript": "^4.1.3"
  },
  "hakDependencies": {
    "matrix-seshat": "^2.3.0",
    "keytar": "^5.6.0"
  },
  "build": {
    "appId": "im.riot.app",
    "files": [
      "package.json",
      {
        "from": ".hak/hakModules",
        "to": "node_modules"
      },
      "lib/**"
    ],
    "extraResources": [
      {
        "from": "res/img",
        "to": "img"
      },
      "webapp.asar"
    ],
    "linux": {
      "target": "deb",
      "category": "Network;InstantMessaging;Chat",
      "maintainer": "support@element.io",
      "desktop": {
        "StartupWMClass": "element"
      }
    },
    "mac": {
      "category": "public.app-category.social-networking",
      "darkModeSupport": true
    },
    "win": {
      "target": {
        "target": "squirrel"
      },
      "sign": "scripts/electron_winSign"
    },
    "directories": {
      "output": "dist"
    },
    "afterPack": "scripts/electron_afterPack",
    "afterSign": "scripts/electron_afterSign",
    "protocols": [
      {
        "name": "element",
        "schemes": [
          "element"
        ]
      }
    ]
  }
}