Skip to content

Commit d958f58

Browse files
committed
fix auditd search user schema
1 parent f52b462 commit d958f58

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

docs/plugins/generated.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,10 +881,10 @@ Search audit events by key, user or time window.
881881

882882
| Parameter | Required | Type | Default | Description |
883883
|---|---:|---|---|---|
884-
| `key` | no | `string` | | SSH public key line. |
885-
| `user` | no | `boolean` | `False` | Use systemctl --user instead of the system manager. |
886-
| `start` | no | `boolean` | `False` | Start a service or timer after installing its unit. |
887-
| `end` | no | `string` | | End time for an audit search or time window. |
884+
| `key` | no | `string` | | Audit event key. |
885+
| `user` | no | `string` | | Audit user name or numeric UID. |
886+
| `start` | no | `string` | | Audit search start time. |
887+
| `end` | no | `string` | | Audit search end time. |
888888
| `sudo` | no | `boolean` | `False` | Run the remote operation through sudo -n when supported. |
889889

890890
Result fields:

src/automax/plugins/ops_completeness.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ class AuditdSearchPlugin(_ReadOnlyCommandPlugin):
173173
name = "auditd.search"
174174
description = "Search audit events by key, user or time window."
175175
optional_params = ("key", "user", "start", "end", "sudo")
176+
parameter_schema = {
177+
"key": {"type": "string", "default": None, "description": "Audit event key."},
178+
"user": {"type": "string", "default": None, "description": "Audit user name or numeric UID."},
179+
"start": {"type": "string", "default": None, "description": "Audit search start time."},
180+
"end": {"type": "string", "default": None, "description": "Audit search end time."},
181+
}
176182

177183
def manual_commands(self, params: Dict[str, Any], context: ExecutionContext) -> list[str]:
178184
args = []

tests/test_documentation_and_regressions.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,24 @@ def test_plugin_smoke_runbooks_match_archive_decompress_parameters():
663663

664664
assert offenders == []
665665

666+
667+
def test_plugin_smoke_runbooks_match_auditd_search_user_schema():
668+
from automax.plugins.registry import build_builtin_registry
669+
670+
plugin = build_builtin_registry().get("auditd.search")
671+
plugin.validate({"key": "automax", "user": "deploy", "start": "recent", "end": "now"})
672+
673+
runbook = yaml.safe_load(Path("examples/runbooks/runbooks/05-auditd.check.yaml").read_text(encoding="utf-8"))
674+
search_substeps = [
675+
substep
676+
for task in runbook.get("tasks", [])
677+
for step in task.get("steps", [])
678+
for substep in step.get("substeps", [])
679+
if substep.get("use") == "auditd.search"
680+
]
681+
assert search_substeps
682+
assert all(isinstance((substep.get("with") or {}).get("user"), str) for substep in search_substeps)
683+
666684
def test_docs_show_sudo_password_env_for_runs_and_capability_installs():
667685
docs = "\n".join(
668686
path.read_text(encoding="utf-8")

0 commit comments

Comments
 (0)