Skip to content

Redact and mask private data before text model calls - #2003

Merged
asim merged 1 commit into
mainfrom
fix/model-privacy
Oct 2, 2026
Merged

asim merged 1 commit into
mainfrom
fix/model-privacy

Conversation

@asim

@asim asim commented Oct 2, 2026

Copy link
Copy Markdown
Member

Text model providers currently receive account context, mail and calendar tool results verbatim. Add a local privacy boundary around the supported text model adapters, including their internal tool loops.

  • Mask email addresses, known account/mail display names, private Google links and Gmail/Drive identifiers with consistent random placeholders scoped to one run. Mappings stay in memory and are not shared between runs or accounts.
  • Irreversibly redact recognized credentials, structured secret fields and the known account secret. Restore identity placeholders locally in answers and tool arguments before the existing authorization checks.
  • Trim standard plaintext mail quote/signature tails and duplicate snippets from the model copy. Mask calendar locations and keep the existing interval-only availability path; instruct the model to prefer Free for availability.
  • Cover prompts, system context, message history, tool results, structured replies and split streaming chunks. Register the protection for OpenAI, OpenRouter, Atlas Cloud, Anthropic, Gemini and the Codex preview adapter.

Validation: full go test -buildvcs=false ./... -short; focused race tests for privacy, ai, codex, agent, mail and events; go build -buildvcs=false ./...; diff checks. Fake HTTP endpoints verify actual initial and follow-up payloads for all five HTTP adapters, plus local tool-argument and answer restoration. Tests cover run isolation, concurrency, structured secrets, exact large JSON IDs, private Google links, revoked mappings and every streaming split position.

Limits: this is deterministic pseudonymization, not encryption or anonymity. Unrecognized names and identifying prose can remain. Standard plaintext quote/signature trimming does not recognize every mail format. Availability preference is a model instruction, not a ban on event-detail access. Image/media generation is outside this text-model boundary. No live Google account, provider call, authenticated browser or screenshot verification was performed; there are no UI changes.

@asim
asim merged commit bda0d7e into main Oct 2, 2026
1 check passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T10:11:22.312113Z 470cde1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 470cde132b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/ai/privacy.go
Comment on lines +12 to +14
gmai.Register("openai", func(opts ...gmai.Option) gmai.Model { return privacy.New(openai.NewProvider, opts...) })
gmai.Register("anthropic", func(opts ...gmai.Option) gmai.Model { return privacy.New(anthropic.NewProvider, opts...) })
gmai.Register("atlascloud", func(opts ...gmai.Option) gmai.Model { return privacy.New(atlascloud.NewProvider, opts...) })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Protect providers instantiated by the local CLI agent

These registrations protect only models created through gmai.New, but the mu agent path in agent/local/local.go:172-213 directly calls anthropic.NewProvider, atlascloud.NewProvider, and openai.NewProvider. Consequently, when that CLI agent calls remote personal tools such as Gmail or Drive, its prompts, history, and tool results still go to the configured provider verbatim, bypassing the new redaction and placeholder restoration boundary. Route those direct constructions through privacy.New (or the protected registry) as well.

Useful? React with 👍 / 👎.

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