Closed cvgs closed 5 months ago
Would love to see this integrated into the main app. I'm no dev but I've been looking for this functionality for a while.
bump. it would be great to see this merged.
This will be implemented in Privileges 2.0.0, which will be available later this year.
This pull request addresses issue #40.
Privileges are automatically removed after the configured timeout regardless how they have been acquired, either by
Privileges are automatically removed after the timeout, even it the computer has been asleep or switched off. This is done by creating a LaunchAgent for the user after privileges have been elevated, which will be triggered in the following circumstances:
The LaunchAgent calls PrivilegesCLI with a new command line parameter called "expire". This will demote the user only if the timer has elapsed, otherwise do nothing. After demotion the LaunchAgent file will be removed so that it is not executed again.
This is a drop-in replacement for older installations and should even coexist with other methods for demotion, as it simply uses a triggered call to PrivilegesCLI. There are no attempts to detect or prevent "sneaky" behavior , it's simply an extension of the current behaviour.
However, to be able to create and remove the LaunchAgent in ~/Library/LaunchAgents, the sandboxing entitlement for this app needed to be disabled. As the app itself is designed to elevate privileges this probably can be considered acceptable, but needs discussion.