feat(export): audit-grade hardening (CSV injection guard, BOM, provenance, PII redaction, HTML report)#32
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@-