Add text parameter type; verify commands run in the owning repo root
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: sonnet Assistant-Process: 295952@bnt-lap001 Assistant-Session: e93f64ad-516c-46eb-9666-aad8d300c477
This commit is contained in:
parent
f790c3c11b
commit
7f8b55d036
5 changed files with 26 additions and 4 deletions
|
|
@ -61,3 +61,16 @@ def test_render():
|
|||
assert P.render(cmd, {"host": "example.org", "count": "2"}, pk) == "ping -c 2 example.org"
|
||||
with pytest.raises(ValueError):
|
||||
P.render(cmd, {"host": "a;rm -rf /"}, pk)
|
||||
|
||||
|
||||
def test_text_parameter_allows_spaces_but_not_metacharacters():
|
||||
d = copy.deepcopy(GOOD)
|
||||
d["parameters"].append({"id": "need", "label": "Need", "type": "text", "default": "read a password"})
|
||||
d["steps"][0]["command"] = 'echo "{{need}}" {{host}} {{count}}'
|
||||
pk = P.Pack(Path("x"), d)
|
||||
assert P.render(d["steps"][0]["command"], {"host": "h"}, pk) == 'echo "read a password" h 1'
|
||||
with pytest.raises(ValueError):
|
||||
P.render(d["steps"][0]["command"], {"host": "h", "need": 'x"; rm -rf /'}, pk)
|
||||
with pytest.raises(ValueError):
|
||||
P.render(d["steps"][0]["command"], {"host": "two words"}, pk)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue