This commit addresses an issue in the privacy.sexy desktop application
where scripts executed as administrator on Windows were running in the
background. This was observed in environments like Windows Pro VMs on
Azure, where operations typically run with administrative privileges.
Previously, the application used the `"$path"` shell command to execute
scripts. This mechanism failed to activate the logic for requesting
admin privileges if the app itself was running as an administrator.
To resolve this, the script execution process has been modified to
explicitly ask for administrator privileges using the `VerbAs` method.
This ensures that the script always runs in a new `cmd.exe` window,
enhancing visibility and user interaction.
Other supporting changes:
- Rename the generated script file from `run-{timestamp}-{extension}` er
to `{timestamp}-privacy-script-{extension}` for clearer identification
and better file sorting.
- Refactor `ScriptFileCreator` to parameterize file extension and
script name.
- Rename `OsTimestampedFilenameGenerator` to
`TimestampedFilenameGenerator` to better reflect its new and more
scoped functionality after refactoring mentioned abvoe.
- Remove `setAppName()` due to ineffective behavior in Windows.
- Update `SECURITY.md` to highlight that the app doesn't require admin
rights for standard operations.
- Add `.editorconfig` settings for PowerShell scripts.
- Add a integration test for script execution logic. Improve environment
detection for more reliable test execution.
- Disable application logging during unit/integration tests to keep test
outputs clean and focused.
37 lines
1001 B
TypeScript
37 lines
1001 B
TypeScript
import { OperatingSystem } from '@/domain/OperatingSystem';
|
|
import { Logger } from '@/application/Common/Log/Logger';
|
|
import { WindowVariables } from '@/infrastructure/WindowVariables/WindowVariables';
|
|
import { CodeRunner } from '@/application/CodeRunner/CodeRunner';
|
|
import { LoggerStub } from './LoggerStub';
|
|
import { CodeRunnerStub } from './CodeRunnerStub';
|
|
|
|
export class WindowVariablesStub implements WindowVariables {
|
|
public codeRunner?: CodeRunner = new CodeRunnerStub();
|
|
|
|
public isDesktop = false;
|
|
|
|
public os?: OperatingSystem = OperatingSystem.BlackBerryOS;
|
|
|
|
public log: Logger = new LoggerStub();
|
|
|
|
public withLog(log: Logger): this {
|
|
this.log = log;
|
|
return this;
|
|
}
|
|
|
|
public withIsDesktop(value: boolean): this {
|
|
this.isDesktop = value;
|
|
return this;
|
|
}
|
|
|
|
public withOs(value: OperatingSystem | undefined): this {
|
|
this.os = value;
|
|
return this;
|
|
}
|
|
|
|
public withCodeRunner(value?: CodeRunner): this {
|
|
this.codeRunner = value;
|
|
return this;
|
|
}
|
|
}
|