hardlinked source files are refused, remote schema URLs require an explicit flag, generated harvest artifacts use the hardened bundle writer, and task/handler/playbook YAML writes go through one safety gate.

This commit is contained in:
Miguel Jacq 2026-06-28 18:17:45 +10:00
parent f56f076765
commit 44d1a22db4
Signed by: mig5
GPG key ID: 03906B4110AAD3B8
11 changed files with 202 additions and 37 deletions

View file

@ -106,3 +106,16 @@ def test_ansible_unsafe_data_still_tags_jinja_values():
assert not isinstance(out["safe"], AnsibleUnsafeText)
assert is_ansible_template_like("{{ x }}")
assert not is_ansible_template_like("plain")
def test_write_generated_task_yaml_uses_safety_gate(tmp_path):
from enroll.ansible import _write_generated_task_yaml
path = tmp_path / "tasks.yml"
with pytest.raises(RenderSafetyError):
_write_generated_task_yaml(
str(path), "---\nkey: value\n", label="test tasks/main.yml"
)
assert not path.exists()