Neutralize CSV formula injection in trader history exports (#432) #960
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic!960
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/432-csv-formula-injection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Addresses SEC-F12 (#432): trader history CSV exports (
text_csv.rs) now neutralize spreadsheet formula prefixes before RFC 4180 quoting.csv_escape_cellprefixes cells starting with=,+,-, or@with a leading'so Excel/LibreOffice/Google Sheets do not interpret them as formulas.TradeResponserow withoffer_asset = "=HYPERLINK(...)".docs/indexer-invariants.mdandskills/AGENTS_FRONTEND_ORDER_HISTORY.md.Acceptance checklist
=,+,-,@cd indexer && cargo test --lib api::text_csv::tests::csv_escape_cell_neutralizes_formula_prefixes -- --nocapturetext_csv.rs)grep -n 'csv_escape_cell_neutralizes' indexer/src/api/text_csv.rscd indexer && cargo test --test api_traders get_trader_trades_csv_returns_text_csv -- --test-threads=1docs/indexer-invariants.mdtrader history row +skills/AGENTS_FRONTEND_ORDER_HISTORY.mdThird-party verification
Confirm
indexer/src/api/text_csv.rscontains:csv_escape_cell_neutralizes_bare_formula_prefixcsv_escape_cell_neutralizes_formula_prefixes(loops=,+,-,@)trader_swaps_csv_neutralizes_formula_in_offer_assetSecurity review — MR !960
Commit reviewed:
c14c989fa192542e89ed25cbd7f24c07c04ed70aScope:
indexer/src/api/text_csv.rs(csv_escape_cellformula-prefix neutralization + unit tests),docs/indexer-invariants.md,skills/AGENTS_FRONTEND_ORDER_HISTORY.mdOutcome: FINDINGS: 0 medium+
Summary
Reviewed the SEC-F12 / #432 fix that prefixes CSV cells starting with
=,+,-, or@with a leading'before RFC 4180 quoting. Traced attacker-controlled inputs (CW20symbolviatrade_response_from_swap_row→offer_asset/ask_asset;maker/owner/sender/tx_hashfrom indexed chain events) throughjoin_row→csv_escape_cell→trader_*_csv→ unauthenticatedGET /api/v1/traders/{addr}/...?format=csvresponses.The change correctly neutralizes the documented formula-prefix vector for all exported string cells. Existing controls (read-only public API, parameterized SQL,
trader_csv_slugfilename sanitization,formatallowlist) remain intact; no new injection, authz, SSRF, XSS, or secret-leak surfaces were introduced.Checks performed
csv_escape_cellapplies the'prefix before quote detection so comma-containing formula payloads are still neutralized inside quoted fields.csv_escape_cell.cargo test --lib api::text_csv::tests— all 4 tests pass.=,+,-,@only) and require non-standard CW20 metadata; not rated medium+ for this diff.Security review: no medium+ findings on this diff. No inline threads.
mentioned in commit
6afbcb194f