mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-24 20:38:38 +00:00
Skills/Python: harden script edge cases and add regression tests (#24277)
* Skill creator: skip self-including .skill output * Skill creator tests: cover output-dir-inside-skill case * Skill validator: parse frontmatter robustly across newlines * Skill validator tests: add CRLF and malformed frontmatter coverage * Model usage: require positive --days value * Model usage tests: cover --days validation and filtering * Nano banana: close input image handles after loading * Skill validator: keep type hints compatible with older python * Changelog: credit @vincentkoc for Python skills hardening
This commit is contained in:
@@ -135,6 +135,20 @@ class TestPackageSkillSecurity(TestCase):
|
||||
names = set(archive.namelist())
|
||||
self.assertIn("nested-skill/lib/helpers/util.py", names)
|
||||
|
||||
def test_skips_output_archive_when_output_dir_is_skill_dir(self):
|
||||
skill_dir = self.create_skill("self-output-skill")
|
||||
|
||||
result = package_skill(str(skill_dir), str(skill_dir))
|
||||
|
||||
self.assertIsNotNone(result)
|
||||
skill_file = skill_dir / "self-output-skill.skill"
|
||||
self.assertTrue(skill_file.exists())
|
||||
with zipfile.ZipFile(skill_file, "r") as archive:
|
||||
names = set(archive.namelist())
|
||||
self.assertIn("self-output-skill/SKILL.md", names)
|
||||
self.assertIn("self-output-skill/script.py", names)
|
||||
self.assertNotIn("self-output-skill/self-output-skill.skill", names)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user