Add native per-program hook exclusions
Parse --exclude-hook-program in the helper, gate foreground hooks and dialog reading by program, and forward the list to the 32-bit hook host. Emit the flags from the Orca extension and cover the matching, validation, and manager behavior with regression tests.
This commit is contained in:
1 parent
0db42de77e
commit
78b70e1ab9
11 files changed
+278
-8
No files matched your search
@@ -104,6 +104,27 @@ def controller_only_arguments(programs: set[str], listed,
|
||||
return []
|
||||
|
||||
|
||||
def excluded_hook_arguments(listed) -> list[str]:
|
||||
"""--exclude-hook-program flags for the listed executable names.
|
||||
|
||||
The helper itself enforces these from its first foreground poll, so a
|
||||
listed program's thread is never hooked even in the passes before
|
||||
discovery sees it and the whole-prefix controller-only restart lands.
|
||||
Validation mirrors Cthulhu's settings rules: bare executable names
|
||||
only, passed lower-case, at most as many as the helper stores.
|
||||
"""
|
||||
|
||||
if not isinstance(listed, (list, tuple)):
|
||||
return []
|
||||
arguments: list[str] = []
|
||||
names = sorted(name for name in listed if isinstance(name, str))
|
||||
for name in names[:256]:
|
||||
if (name and len(name) <= 255 and name.strip() == name
|
||||
and not any(char in name for char in "\0\r\n/\\")):
|
||||
arguments += ["--exclude-hook-program", name.lower()]
|
||||
return arguments
|
||||
|
||||
|
||||
def find_helper() -> str | None:
|
||||
for path in helper_candidates():
|
||||
if os.access(path, os.X_OK):
|
||||
|
||||
Reference in new issue
Block a user