diff --git a/config.toml b/config.toml index 155c656..bd2daf3 100644 --- a/config.toml +++ b/config.toml @@ -51,7 +51,7 @@ include_content = true [extra] version = "1.21.16" -release_version = "1.21.19" +release_version = "1.21.20" navbar_items = [ { code = "en", nav_items = [ diff --git a/scripts/test_agent_hooks_publication.py b/scripts/test_agent_hooks_publication.py index 95086b1..5097df8 100644 --- a/scripts/test_agent_hooks_publication.py +++ b/scripts/test_agent_hooks_publication.py @@ -1,4 +1,6 @@ """Bind hook claims to actual captured failures, correction and executed output.""" +import ast +import re import hashlib import json from pathlib import Path @@ -52,6 +54,23 @@ def test_bundle_proves_hook_result_and_execution_separately(self): digest, name = row.split(' ', 1) self.assertEqual(hashlib.sha256(z.read(name)).hexdigest(), digest) + def test_host_prompt_delimits_an_allowed_command(self): + with zipfile.ZipFile(MEDIA / 'harbour-hooks-example.zip') as z: + tree = ast.parse(z.read('reproduce.py').decode()) + prompt = next(ast.literal_eval(n.value) for n in tree.body + if isinstance(n, ast.Assign) + and any(isinstance(t, ast.Name) and t.id == 'prompt' for t in n.targets)) + commands = re.findall(r'```sh\n([^`]+)\n```', prompt) + self.assertEqual(commands, ['python3 validate-brief.py --chek']) + config = json.loads(z.read('fixture/opencode.json')) + allowed = {p['resource'] for p in config['permissions'] + if p['action'] == 'shell' and p['effect'] == 'allow'} + self.assertEqual(allowed, {'python3 validate-brief.py --chek', + 'python3 validate-brief.py --check'}) + self.assertIn(commands[0], allowed) + self.assertNotIn(commands[0] + ' .', allowed) + self.assertIn('Do not repair it or add arguments, punctuation', prompt) + def test_article_preserves_scope_and_downloads(self): page = (ROOT / 'content/how-tos/command-rewriting-howto.md').read_text() self.assertIn('date=2026-04-15', page) diff --git a/static/demos/agent-hooks/harbour-hooks-example.zip b/static/demos/agent-hooks/harbour-hooks-example.zip index 9ac6960..6897df5 100644 Binary files a/static/demos/agent-hooks/harbour-hooks-example.zip and b/static/demos/agent-hooks/harbour-hooks-example.zip differ diff --git a/static/demos/agent-hooks/manifest.json b/static/demos/agent-hooks/manifest.json index f1174d6..8b4832f 100644 --- a/static/demos/agent-hooks/manifest.json +++ b/static/demos/agent-hooks/manifest.json @@ -41,8 +41,8 @@ }, { "file": "harbour-hooks-example.zip", - "sha256": "f17baaaf504380209e9574d0990336d517a66f974a6f9bf27bbbab704c9acb71", - "bytes": 30326 + "sha256": "bc5e8277a99dc6a7434b723a5ca0c3f20a34449b6a4527ab0721f988dd4eea45", + "bytes": 30482 }, { "file": "screenshots/executed-result.jpg",