Skip to content

feat(collector): add explicit session export boundary - #85

Merged
luhe19001 merged 2 commits into
mainfrom
feature/eng-1340c-session-export
Aug 17, 2026
Merged

feat(collector): add explicit session export boundary#85
luhe19001 merged 2 commits into
mainfrom
feature/eng-1340c-session-export

Conversation

@luhe19001

@luhe19001 luhe19001 commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add the explicit private-to-wire allow-list for session snapshots, including path proof, credential redaction, text/item budgets, and frozen usage/cost mapping.

Why this is separate

This is the privacy boundary. Keeping it apart from the public schema and aggregate fitting lets reviewers focus on exactly which local fields may leave the machine and how each one is sanitized.

Changes

  • map approved session, usage, digest, todo, edit, commit, Git, and subagent facts;
  • exclude raw commands, transcripts, tool output, diffs, reasoning, log paths, and parser state;
  • redact quoted and unquoted credential patterns without leaking quoted suffixes;
  • export file paths only after proving they are repository-relative;
  • normalize and safely truncate UTF-8 text and paths;
  • transform, drop, merge, sort, and deduplicate model names before validation;
  • add a nested allow-list census so new local fields remain excluded by default.

Review guide

Review Build field by field, then the credential/path helpers, followed by allowlist_test.go. Marshal still delegates directly to the public contract in this slice; aggregate degradation arrives next.

Verification

  • go test ./...
  • go vet ./...

Stack

This is PR 3 of 5 for ENG-1340. Its base is PR 2.

Order PR Scope
1 #83 Canonical session start
2 #84 Public v1 contract
3 #85 Private-to-wire export boundary
4 #86 Aggregate payload fitting
5 #87 Fixtures, measurement, and docs

Rollout

The mapper is internal and has no preview/upload caller in this stack, so it remains inert until integration is added.

@calvintvu calvintvu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up to author, rename sessionexport to just export for readability

@calvintvu

calvintvu commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

[P1] – Incomplete credentials leak secrets. The regexes require closing quotes/PEM markers. Truncated password="first-secret second-secret leaks second-secret; an incomplete private-key block leaks its body. Redact through end-of-string when delimiters are missing.

@luhe19001

Copy link
Copy Markdown
Collaborator Author

Addressed the P1 incomplete-credential leak in 3bc080b. Unterminated JSON and shell-style quoted credentials, bearer values, and private-key blocks now redact through end-of-text, including dangling escape cases. Added end-to-end export regression coverage and verified with go test ./....

I kept the sessionexport package name: this package is specifically the trust boundary from the private session model to the public snapshot contract, and export would be less descriptive and easier to confuse with future export surfaces.

@luhe19001
luhe19001 changed the base branch from feature/eng-1340b-snapshot-contract to main August 17, 2026 22:42
@luhe19001
luhe19001 force-pushed the feature/eng-1340c-session-export branch from 3bc080b to 71a9a57 Compare August 17, 2026 22:43
@luhe19001
luhe19001 merged commit 5a10d97 into main Aug 17, 2026
3 checks passed
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.

2 participants