Skip to content

feat(export): audit-grade hardening (CSV injection guard, BOM, provenance, PII redaction, HTML report)#32

Merged
JoniMartin27 merged 2 commits into
mainfrom
feat/audit-export-hardening
Jun 12, 2026
Merged

feat(export): audit-grade hardening (CSV injection guard, BOM, provenance, PII redaction, HTML report)#32
JoniMartin27 merged 2 commits into
mainfrom
feat/audit-export-hardening

Conversation

@JoniMartin27

Copy link
Copy Markdown
Owner

@-

JoniMartin27 and others added 2 commits June 12, 2026 12:57
…ovenance, PII redaction, HTML report)

Audit-grade hardening of GET /api/export/traces:

- CSV/formula injection guard (CWE-1236): string cells starting with
  = + - @ TAB CR are prefixed with a single quote before RFC 4180 quoting.
  Numbers/booleans are never prefixed (negative numbers stay intact).
- UTF-8 BOM on the CSV body so Excel on Windows reads accents correctly.
- Deterministic order: export() now ORDER BY started_at ASC, trace_id ASC.
- Explicit truncation: export() returns { traces, truncated, totalAvailable }
  via a COUNT(*) over the same filters; surfaced as X-Lookspan-Export-Truncated
  and JSON truncated/totalAvailable fields.
- Provenance + integrity: exportedAt, filters, count, truncated, totalAvailable,
  tool, version (from package.json) and sha256 of the exact CSV body; CSV adds
  X-Lookspan-Export-Sha256 / -Count headers.
- PII redaction by default (GDPR art. 5/32): JSON export omits attributes unless
  ?raw=1. CSV/HTML are metadata-only.
- New format=html: self-contained, printable audit report (0 client deps, no CDN)
  with provenance header, summary cards and hand-drawn inline-SVG charts.

Tests added/updated for every point; README + docs-site http-api.md updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@JoniMartin27 JoniMartin27 merged commit bafd6dc into main Jun 12, 2026
2 checks passed
@JoniMartin27 JoniMartin27 deleted the feat/audit-export-hardening branch June 12, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant