fix(security): Harden skill tooling file handling

Guard metadata repair and doc sync scripts against symlink targets so
repo maintenance tasks cannot overwrite arbitrary local files.

Replace recursive skill discovery with an iterative walk that skips
symlinked directories, and harden the VideoDB listener to write only
private regular files in the user-owned state directory.

Also fix the broken pr:preflight script entry and make the last30days
skill stop embedding raw user arguments directly in the shell command.
This commit is contained in:
sickn33
2026-03-21 11:34:38 +01:00
parent a0e8381775
commit 3efff111d2
19 changed files with 453 additions and 31 deletions

View File

@@ -122,6 +122,32 @@ Activate this skill when:
self.assertIn("## When to Use", updated)
self.assertNotIn("## Examples", updated)
def test_update_skill_file_skips_symlinked_skill_markdown(self):
with tempfile.TemporaryDirectory() as temp_dir:
root = Path(temp_dir)
skill_dir = root / "skill"
outside_dir = root / "outside"
skill_dir.mkdir()
outside_dir.mkdir()
target = outside_dir / "SKILL.md"
original = """---
name: outside
description: Demo description.
---
# Outside
"""
target.write_text(original, encoding="utf-8")
skill_path = skill_dir / "SKILL.md"
skill_path.symlink_to(target)
changed, changes = fix_missing_skill_sections.update_skill_file(skill_path, add_missing=True)
self.assertFalse(changed)
self.assertEqual(changes, [])
self.assertEqual(target.read_text(encoding="utf-8"), original)
if __name__ == "__main__":
unittest.main()