T09 · Insecure Skill Coding Practices
- Location
scripts/debt_payoff_planner.py:267- Finding
Spreadsheet Formula Injection Through Unsanitized Debt Names in CSV Export
- Content
View full analysis
- Remediation
View remediation
str: if value and value[0] in ("=", "+", "-", "@", "\t", "\r"): return "'" + value return value ``` 2. Apply the function to the debt name at the CSV output boundary: ```python w.writerow([ month, csv_safe_text(name), pay / 100, max(bal, 0) / 100, ]) ``` 3. Apply equivalent protection to every future user-controlled textual CSV field, rather than relying only on validation at input time. 4. Add regression tests covering names beginning with `=`, `+`, `-`, `@`, tab, and carriage return. Verify that exported cells are stored as literal text. 5. Document that CSV exports contain user-supplied debt labels and should not be opened with formula execution enabled unless the values have been sanitized. Allowlisting debt-name characters could provide additional defense in depth, but output-boundary neutralization should remain in place because ordinary names may legitimately contain punctuation. ]]>
