Skip to content

Conversation

@neeraj-pilot
Copy link
Contributor

Summary

  • Previously, the public collection participants endpoint was exposing the full email domain (e.g., ******@gmail.com)
  • Now masks both username and domain: first 2 chars of username + *** + @ + first char of domain + *** + last char
  • Example: [email protected]jo**@g*******m

Changes

  • Added GetMaskedEmailForPublic function in pkg/utils/email/email.go
  • Updated Participants method in pkg/controller/public/comments.go to use the new masking
  • Added tests for the new masking function

Copy link

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

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: f34fcaf7f8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 376 to 380
func maskForPublicUsername(s string) string {
if len(s) <= 2 {
return s
}
return s[:2] + strings.Repeat("*", len(s)-2)

Choose a reason for hiding this comment

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

P2 Badge Avoid byte slicing to prevent invalid UTF-8 masking

The new masking uses byte indices (s[:2]) on the username (and similarly domain[0]/domain[len-1]), which will split multi‑byte UTF‑8 runes for non‑ASCII local parts or IDN domains (SMTPUTF8). That produces invalid UTF‑8 strings that encoding/json will replace with , so public participant responses can contain replacement characters instead of a proper masked value. This is a regression from the old masking, which did not slice the string. Consider rune‑aware slicing (e.g., []rune) or utf8 helpers to keep valid characters while masking.

Useful? React with 👍 / 👎.

@ua741 ua741 merged commit 460ee16 into ente-io:main Jan 7, 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