Skip to content

Commit

Permalink
sec: remove automation of credential injection
Browse files Browse the repository at this point in the history
  • Loading branch information
jlp-craigmorten committed Jul 25, 2024
1 parent 902a716 commit 6535af6
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 610 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ If you are using GitHub Actions, check out the dedicated [`guidepup/setup-action
### MacOS
If you are running this command locally, you might find it prompts you to pass in credentials so that it can using UI automation to change a checkbox value which enables the automation of VoiceOver. If you are uncomfortable with providing your credentials you can manually achieve these steps by following the [manual VoiceOver setup documentation](https://www.guidepup.dev/docs/guides/manual-voiceover-setup).
If you are running this command locally you may need to take some manual steps to complete setup by following the [manual VoiceOver setup documentation](https://www.guidepup.dev/docs/guides/manual-voiceover-setup).
#### CI
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"@guidepup/guidepup": "^0.22.0",
"chalk": "^4.0.0",
"decompress": "^4.2.1",
"inquirer": "^8.2.0",
"regedit": "5.0.1",
"semver": "^7.5.4"
},
Expand Down
11 changes: 6 additions & 5 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export const ERR_MACOS_UNABLE_TO_WRITE_DATABASE_FILE =
"Unable to write to the VoiceOver database file - SIP might not be disabled";
export const ERR_MACOS_UNABLE_TO_WRITE_USER_TCC_DB =
"Unable to write to the user TCC.db - SIP might not be disabled";
export const ERR_MACOS_UNABLE_TO_UPDATE_UI_PREFERENCES =
"Unable to enable VoiceOver control via UI preferences";
export const ERR_MACOS_UI_PROMPT_FAILURE =
"Unable to retrieve user input from prompt";
export const ERR_MACOS_UI_CONTROL_NOT_CONSENTED =
Expand All @@ -24,7 +22,10 @@ export const ERR_MACOS_REQUIRES_MANUAL_USER_INTERACTION =
export const ERR_MACOS_FAILED_TO_ENABLE_DO_NOT_DISTURB =
'Failed to enable "Do not disturb" mode';

export const ERR_WINDOWS_UNABLE_TO_ACCESS_REGISTRY = "Unable to access Windows registry";
export const ERR_WINDOWS_UNABLE_TO_UPDATE_REGISTRY = "Unable to update Windows registry";
export const ERR_WINDOWS_UNABLE_TO_ACCESS_REGISTRY =
"Unable to access Windows registry";
export const ERR_WINDOWS_UNABLE_TO_UPDATE_REGISTRY =
"Unable to update Windows registry";
export const ERR_WINDOWS_FAILED_TO_INSTALL_NVDA = "Unable to install NVDA";
export const ERR_WINDOWS_FAILED_TO_RESTART_EXPLORER = "Unable to restart explorer.exe";
export const ERR_WINDOWS_FAILED_TO_RESTART_EXPLORER =
"Unable to restart explorer.exe";
4 changes: 0 additions & 4 deletions src/macOS/Credentials.ts

This file was deleted.

47 changes: 0 additions & 47 deletions src/macOS/askUserToControlUi.ts

This file was deleted.

104 changes: 0 additions & 104 deletions src/macOS/setVoiceOverEnabledViaUi.ts

This file was deleted.

18 changes: 9 additions & 9 deletions src/macOS/setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { platform, release } from "os";
import { macOSRecord } from "@guidepup/guidepup";
import chalk from "chalk";
import { checkVersion } from "./checkVersion";
import { enableAppleScriptControlSystemDefaults } from "./enableAppleScriptControlSystemDefaults";
import { disableSplashScreenSystemDefaults } from "./disableSplashScreenSystemDefaults";
Expand All @@ -8,8 +9,6 @@ import { isSipEnabled } from "./isSipEnabled";
import { writeDatabaseFile } from "./writeDatabaseFile";
import { SYSTEM_PATH, USER_PATH, updateTccDb } from "./updateTccDb";
import { isAppleScriptControlEnabled } from "./isAppleScriptControlEnabled";
import { askUserToControlUi } from "./askUserToControlUi";
import { setVoiceOverEnabledViaUi } from "./setVoiceOverEnabledViaUi";
import { handleWarning, logInfo } from "../logging";
import { ERR_MACOS_REQUIRES_MANUAL_USER_INTERACTION } from "../errors";
import { enableDoNotDisturb } from "./enableDoNotDisturb";
Expand Down Expand Up @@ -74,13 +73,14 @@ export async function setup(): Promise<void> {
throw new Error(ERR_MACOS_REQUIRES_MANUAL_USER_INTERACTION);
}

const credentials = await askUserToControlUi();

logInfo("");
logInfo("Starting UI control...");
logInfo("Please refrain from interaction until the script has completed");

await setVoiceOverEnabledViaUi(credentials);
logInfo(
"Please complete remaining setup by following this guide:\n\n--> " +
chalk.underline(
chalk.bold(
"https://www.guidepup.dev/docs/guides/manual-voiceover-setup"
)
)
);
} finally {
stopRecording();
}
Expand Down
Loading

0 comments on commit 6535af6

Please sign in to comment.