fix(auto): use action parser for repair gates
This commit is contained in:
@@ -62,18 +62,18 @@ class TestValidKubectlCommands:
|
||||
"""常見合法 kubectl 指令應通過"""
|
||||
assert validate_kubectl_command(cmd) is True
|
||||
|
||||
def test_kubectl_exec_with_psql(self):
|
||||
"""kubectl exec 查詢(含 SQL SELECT)→ 通過"""
|
||||
def test_kubectl_exec_with_psql_is_not_auto_executable(self):
|
||||
"""kubectl exec 可執行任意 shell,必須降級人工"""
|
||||
cmd = (
|
||||
"kubectl exec -n awoooi-prod deployment/postgresql -- "
|
||||
"psql -U postgres -c 'SELECT pg_terminate_backend(pid) FROM pg_stat_activity;'"
|
||||
)
|
||||
assert validate_kubectl_command(cmd) is True
|
||||
assert validate_kubectl_command(cmd) is False
|
||||
|
||||
def test_kubectl_get_with_jq(self):
|
||||
"""kubectl get + pipe → 通過"""
|
||||
def test_compound_kubectl_get_is_not_auto_executable(self):
|
||||
"""compound shell 指令必須降級人工"""
|
||||
cmd = "kubectl get pods -n monitoring && curl -s http://192.168.0.120:9093/api/v1/status"
|
||||
assert validate_kubectl_command(cmd) is True
|
||||
assert validate_kubectl_command(cmd) is False
|
||||
|
||||
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user