T09 · Insecure Skill Coding Practices
- Location
scripts/init_book.py:15- Finding
Unsanitized Project and Character Names Allow Workspace Path Traversal
- Content
View full analysis
2 else "" # Create the project root directory base_dir = Path.home() / ".qclaw" / "workspace" / "novels" / book_name ``` `scripts/char_state.py:24-33`: ```python ROOT = Path.home() / ".qclaw" / "workspace" / "novels" def _chars_dir(book): return ROOT / book / "settings" / "characters" def _state_file(book, name): return _chars_dir(book) / name / "state.json" def _bus_file(book): return ROOT / book / "tracker" / "plot_bus.json" ``` `scripts/char_state.py:44-47`: ```python def cmd_init(book, name, bias=None): d = _chars_dir(book) / name d.mkdir(parents=True, exist_ok=True) sf = d / "state.json" ``` `scripts/ncg.py:18-21`: ```python ROOT = Path.home() / ".qclaw" / "workspace" / "novels" def _ncg_file(book): return ROOT / book / "tracker" / "ncg.json" ``` `scripts/track_foreshadowing.py:19-22`: ```python book_name = sys.argv[1] action = sys.argv[2] fp_file = Path.home() / ".qclaw" / "workspace" / "novels" / book_name / "tracker" / "foreshadowing.json" ``` `scripts/update_state.py:16-21`: ```python book_name = sys.argv[1] chapter = int(sys.argv[2]) words = int(sys.argv[3]) unresolved_fp = int(sys.argv[4]) if len(sys.argv) > 4 else None state_file = Path.home() / ".qclaw" / "workspace" / "novels" / book_name / "state.json" ``` ### Technical Analysis The scripts treat command-line values for book and character names as trusted path components. They do not reject absolute paths, directory separators, `.` or `..` co ...[truncated 2636 chars]- Remediation
View remediation
