fix(security): harden bundle and plugin validation

This commit is contained in:
sickn33
2026-03-31 17:44:19 +02:00
parent e3d2c777fa
commit e18e63cfcb
7 changed files with 172 additions and 13 deletions

View File

@@ -106,6 +106,30 @@ class EditorialBundlesTests(unittest.TestCase):
)
self.assertEqual(generated_plugins, expected_plugins)
def test_manifest_rejects_bundle_ids_with_path_traversal(self):
with tempfile.TemporaryDirectory() as temp_dir:
temp_root = pathlib.Path(temp_dir)
skill_dir = temp_root / "skills" / "safe-skill"
skill_dir.mkdir(parents=True, exist_ok=True)
payload = {
"bundles": [
{
"id": "../../outside",
"name": "Safe Bundle",
"group": "Security",
"emoji": "🛡️",
"tagline": "Test bundle",
"audience": "Testers",
"description": "Testers",
"skills": [{"id": "safe-skill", "summary": "ok"}],
}
]
}
with self.assertRaisesRegex(ValueError, "Invalid editorial bundle id"):
editorial_bundles._validate_editorial_bundles(temp_root, payload)
def test_sample_bundle_copy_matches_source_file_inventory(self):
sample_bundle = next(bundle for bundle in self.manifest_bundles if bundle["id"] == "documents-presentations")
plugin_skills_root = REPO_ROOT / "plugins" / "antigravity-bundle-documents-presentations" / "skills"