Skip to content

Commit

Permalink
🔒️ Utilize electron fuses
Browse files Browse the repository at this point in the history
Encrypt cookies by changing the fuse for it
  • Loading branch information
NovusTheory committed Oct 28, 2023
1 parent 3b7acad commit 39bbf9f
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 2 deletions.
17 changes: 17 additions & 0 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ import { MakerZIP } from "@electron-forge/maker-zip";
import { MakerDeb } from "@electron-forge/maker-deb";
import { MakerRpm } from "@electron-forge/maker-rpm";
import { WebpackPlugin } from "@electron-forge/plugin-webpack";
import { FusesPlugin } from "@electron-forge/plugin-fuses";

import { FuseV1Options, FuseVersion } from "@electron/fuses/dist/index";

import { mainConfig } from "./webpack.main.config";
import { rendererConfig } from "./webpack.renderer.config";

// There is probably a better way to do this, such as fetching it directly from forge
let makerArch = null;
for (let i = 0; i < process.argv.length; i++) {
const arg = process.argv[i];
if (arg === "--arch") {
makerArch = process.argv[i + 1];
}
}

const config: ForgeConfig = {
packagerConfig: {
executableName: "youtube-music-desktop-app",
Expand Down Expand Up @@ -103,6 +115,11 @@ const config: ForgeConfig = {
}
]
}
}),
new FusesPlugin({
version: FuseVersion.V1,
resetAdHocDarwinSignature: process.platform === "darwin" && makerArch == "arm64",
[FuseV1Options.EnableCookieEncryption]: true
})
]
};
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
"@electron-forge/maker-squirrel": "^6.3.0",
"@electron-forge/maker-zip": "^6.3.0",
"@electron-forge/plugin-auto-unpack-natives": "^6.3.0",
"@electron-forge/plugin-fuses": "^6.3.0",
"@electron-forge/plugin-webpack": "^6.3.0",
"@electron-forge/publisher-github": "^6.3.0",
"@electron/fuses": "^1.6.2",
"@types/node": "^18.18.7",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
Expand Down
129 changes: 127 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,27 @@ __metadata:
languageName: node
linkType: hard

"@electron-forge/plugin-base@npm:6.4.2":
version: 6.4.2
resolution: "@electron-forge/plugin-base@npm:6.4.2"
dependencies:
"@electron-forge/shared-types": "npm:6.4.2"
checksum: 3ee417c0b589a8e27433a3fb770e473650b4a26abcd3ddbd8bfa47c85839d9cd022b862a1d0d0a614c0c2c8dd54163e0b21c302bf2b483dabc4093d5415d422c
languageName: node
linkType: hard

"@electron-forge/plugin-fuses@npm:^6.3.0":
version: 6.4.2
resolution: "@electron-forge/plugin-fuses@npm:6.4.2"
dependencies:
"@electron-forge/plugin-base": "npm:6.4.2"
"@electron-forge/shared-types": "npm:6.4.2"
peerDependencies:
"@electron/fuses": ">=1.0.0"
checksum: 09dda04324dca9ce348b28cbaf4989508234010ed336ce2e8c78c2a747cd4a781cae73e0df81f7f14cc2f5621a0d4dfe82e4e73a7aceaf349b36f9dcc8846a8a
languageName: node
linkType: hard

"@electron-forge/plugin-webpack@npm:^6.3.0":
version: 6.3.0
resolution: "@electron-forge/plugin-webpack@npm:6.3.0"
Expand Down Expand Up @@ -298,6 +319,17 @@ __metadata:
languageName: node
linkType: hard

"@electron-forge/shared-types@npm:6.4.2":
version: 6.4.2
resolution: "@electron-forge/shared-types@npm:6.4.2"
dependencies:
"@electron/rebuild": "npm:^3.2.10"
electron-packager: "npm:^17.1.2"
listr2: "npm:^5.0.3"
checksum: 06bb07ea8e0b3945fe51c89dfc8a29c99736f54c7d01d5d579939b0be310b3f9eccbf0c36c0ea16df8f017d98ee1c1da736adf3946eca1db3335b3944163a57d
languageName: node
linkType: hard

"@electron-forge/template-base@npm:6.3.0":
version: 6.3.0
resolution: "@electron-forge/template-base@npm:6.3.0"
Expand Down Expand Up @@ -371,6 +403,19 @@ __metadata:
languageName: node
linkType: hard

"@electron/fuses@npm:^1.6.2":
version: 1.6.2
resolution: "@electron/fuses@npm:1.6.2"
dependencies:
chalk: "npm:^4.1.1"
fs-extra: "npm:^9.0.1"
minimist: "npm:^1.2.5"
bin:
electron-fuses: dist/bin.js
checksum: a33d20e43f232e2e2179d51e976bac92ed7421b13fb1ca13be6b7feb1b7423ae22a425a81a6d65b8042b70bd2a45353452d92a9fa9064d479bc5c417263f3422
languageName: node
linkType: hard

"@electron/get@npm:^2.0.0":
version: 2.0.2
resolution: "@electron/get@npm:2.0.2"
Expand Down Expand Up @@ -417,6 +462,23 @@ __metadata:
languageName: node
linkType: hard

"@electron/osx-sign@npm:^1.0.5":
version: 1.0.5
resolution: "@electron/osx-sign@npm:1.0.5"
dependencies:
compare-version: "npm:^0.1.2"
debug: "npm:^4.3.4"
fs-extra: "npm:^10.0.0"
isbinaryfile: "npm:^4.0.8"
minimist: "npm:^1.2.6"
plist: "npm:^3.0.5"
bin:
electron-osx-flat: bin/electron-osx-flat.js
electron-osx-sign: bin/electron-osx-sign.js
checksum: 9b1099858cfe32c2d9329c16e832c003e246cf14356e541342e91876dcbb7a9bab27c89d1f521c3192d1a1d0fd06a186fa101b45341608c434fe850a3053bfb0
languageName: node
linkType: hard

"@electron/rebuild@npm:^3.2.10":
version: 3.2.13
resolution: "@electron/rebuild@npm:3.2.13"
Expand Down Expand Up @@ -2444,7 +2506,7 @@ __metadata:
languageName: node
linkType: hard

"chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.2":
"chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.1, chalk@npm:^4.1.2":
version: 4.1.2
resolution: "chalk@npm:4.1.2"
dependencies:
Expand Down Expand Up @@ -3359,6 +3421,35 @@ __metadata:
languageName: node
linkType: hard

"electron-packager@npm:^17.1.2":
version: 17.1.2
resolution: "electron-packager@npm:17.1.2"
dependencies:
"@electron/asar": "npm:^3.2.1"
"@electron/get": "npm:^2.0.0"
"@electron/notarize": "npm:^1.2.3"
"@electron/osx-sign": "npm:^1.0.5"
"@electron/universal": "npm:^1.3.2"
cross-spawn-windows-exe: "npm:^1.2.0"
debug: "npm:^4.0.1"
extract-zip: "npm:^2.0.0"
filenamify: "npm:^4.1.0"
fs-extra: "npm:^11.1.0"
galactus: "npm:^1.0.0"
get-package-info: "npm:^1.0.0"
junk: "npm:^3.1.0"
parse-author: "npm:^2.0.0"
plist: "npm:^3.0.0"
rcedit: "npm:^3.0.1"
resolve: "npm:^1.1.6"
semver: "npm:^7.1.3"
yargs-parser: "npm:^21.1.1"
bin:
electron-packager: bin/electron-packager.js
checksum: afcb7520f35267ea69af187c93bc0d4f9a0cad95e588b37c593d6d0a01faa188d6f3b6e9398f602c978499c48f312fe318b0585ed61b58ecb4a30a3ca4998809
languageName: node
linkType: hard

"electron-squirrel-startup@npm:^1.0.0":
version: 1.0.0
resolution: "electron-squirrel-startup@npm:1.0.0"
Expand Down Expand Up @@ -4319,6 +4410,16 @@ __metadata:
languageName: node
linkType: hard

"flora-colossus@npm:^2.0.0":
version: 2.0.0
resolution: "flora-colossus@npm:2.0.0"
dependencies:
debug: "npm:^4.3.4"
fs-extra: "npm:^10.1.0"
checksum: ea50e6ff38fd089f536cbec57da9a3a311efe5a97c21a2c0ae8cc1a85a71c9301b10168693b6389e257c7dbccc3723cc4f0d98377e29b6b65e6f45a929fe5d54
languageName: node
linkType: hard

"follow-redirects@npm:^1.0.0":
version: 1.15.2
resolution: "follow-redirects@npm:1.15.2"
Expand Down Expand Up @@ -4396,6 +4497,17 @@ __metadata:
languageName: node
linkType: hard

"fs-extra@npm:^11.1.0":
version: 11.1.1
resolution: "fs-extra@npm:11.1.1"
dependencies:
graceful-fs: "npm:^4.2.0"
jsonfile: "npm:^6.0.1"
universalify: "npm:^2.0.0"
checksum: a2480243d7dcfa7d723c5f5b24cf4eba02a6ccece208f1524a2fbde1c629492cfb9a59e4b6d04faff6fbdf71db9fdc8ef7f396417a02884195a625f5d8dc9427
languageName: node
linkType: hard

"fs-extra@npm:^4.0.0":
version: 4.0.3
resolution: "fs-extra@npm:4.0.3"
Expand Down Expand Up @@ -4536,6 +4648,17 @@ __metadata:
languageName: node
linkType: hard

"galactus@npm:^1.0.0":
version: 1.0.0
resolution: "galactus@npm:1.0.0"
dependencies:
debug: "npm:^4.3.4"
flora-colossus: "npm:^2.0.0"
fs-extra: "npm:^10.1.0"
checksum: 8422109720515f71b40c60275e05f0a65957bdf15498775ac610df9a254ffe36b10e31d239d88d60c2b348b86d213170d3cfa46562e89c8d860067a80b20ad46
languageName: node
linkType: hard

"gar@npm:^1.0.4":
version: 1.0.4
resolution: "gar@npm:1.0.4"
Expand Down Expand Up @@ -6279,7 +6402,7 @@ __metadata:
languageName: node
linkType: hard

"minimist@npm:^1.2.0, minimist@npm:^1.2.6":
"minimist@npm:^1.2.0, minimist@npm:^1.2.5, minimist@npm:^1.2.6":
version: 1.2.8
resolution: "minimist@npm:1.2.8"
checksum: 19d3fcdca050087b84c2029841a093691a91259a47def2f18222f41e7645a0b7c44ef4b40e88a1e58a40c84d2ef0ee6047c55594d298146d0eb3f6b737c20ce6
Expand Down Expand Up @@ -9751,8 +9874,10 @@ __metadata:
"@electron-forge/maker-squirrel": "npm:^6.3.0"
"@electron-forge/maker-zip": "npm:^6.3.0"
"@electron-forge/plugin-auto-unpack-natives": "npm:^6.3.0"
"@electron-forge/plugin-fuses": "npm:^6.3.0"
"@electron-forge/plugin-webpack": "npm:^6.3.0"
"@electron-forge/publisher-github": "npm:^6.3.0"
"@electron/fuses": "npm:^1.6.2"
"@fastify/cors": "npm:^8.4.0"
"@fastify/error": "npm:^3.4.0"
"@fastify/rate-limit": "npm:^8.0.3"
Expand Down

0 comments on commit 39bbf9f

Please sign in to comment.