corrections
CI / CI configuration security checks (push) Successful in 6s
CI / Python tests and compilation (push) Failing after 12s
CI / QMD unit tests (push) Skipped
CI / Capabilities and shell quality (push) Successful in 1m50s
CI / Build and inspect generated packages (push) Skipped
CI / Bash integration and installation guards (push) Skipped
CI / Installed client configuration smoke tests (push) Skipped
CI / PowerShell tests on Ubuntu (push) Failing after 7m24s
CI / CI configuration security checks (push) Successful in 6s
CI / Python tests and compilation (push) Failing after 12s
CI / QMD unit tests (push) Skipped
CI / Capabilities and shell quality (push) Successful in 1m50s
CI / Build and inspect generated packages (push) Skipped
CI / Bash integration and installation guards (push) Skipped
CI / Installed client configuration smoke tests (push) Skipped
CI / PowerShell tests on Ubuntu (push) Failing after 7m24s
This commit is contained in:
1 parent
b35e2254b3
commit
c3e22eb902
39 files changed
+246
-151
No files matched your search
@@ -8,6 +8,7 @@ command text and cannot see what scripts, aliases, or variables expand to at run
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import importlib.util
|
||||
import json
|
||||
import ntpath
|
||||
import os
|
||||
@@ -250,9 +251,22 @@ def run_hook(data, shell_override=None):
|
||||
if reason:
|
||||
print(f'Blocked by command-safety hook: {reason}. Ask the user to run this command themselves if it is intended.', file=sys.stderr)
|
||||
return 2
|
||||
remind_search(event)
|
||||
return 0
|
||||
|
||||
|
||||
def remind_search(event):
|
||||
# Runs the search reminder in this process so shell calls start one hook process, not two.
|
||||
# Best effort like agent-guards.py itself: a reminder failure never blocks or fails the command.
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location('agent_guards', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'agent-guards.py'))
|
||||
guards = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(guards)
|
||||
guards.remind_search(event)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def run_check(command, workspace):
|
||||
reason = find_violation(command)
|
||||
if reason:
|
||||
|
||||
Reference in new issue
Block a user