Skip to content

use user id in noreply emails#36550

Merged
silverwind merged 8 commits intogo-gitea:mainfrom
TheFox0x7:static-emails
Feb 14, 2026
Merged

use user id in noreply emails#36550
silverwind merged 8 commits intogo-gitea:mainfrom
TheFox0x7:static-emails

Conversation

@TheFox0x7
Copy link
Copy Markdown
Contributor

This implements id based hidden emails in format of user+id@NoReplyAddress

resolves: #33471


The change is not breaking however it is recommended for users to move to this newer type of no reply address

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 7, 2026
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Feb 7, 2026
@lunny
Copy link
Copy Markdown
Member

lunny commented Feb 7, 2026

The ID should not be leaked to outside of the system?

@TheFox0x7
Copy link
Copy Markdown
Contributor Author

I've tested it manually in UI somewhat and I didn't found any issues so far, it handles both styles and keeps track of user after name change.
The only place which uses old style of emails is PAM - services/auth/source/pam/source_authenticate.go, but changing that would require fetching the user after creation and updating the email. Plus I'm really not sure PAM if is wildly used and since the change works with old ones I'm not sure it's worth the effort.


The ID should not be leaked to outside of the system?

  • /users/search allows to look up user by id
  • query to the above endpoint returns the id for each user in the list
  • /users/{username} returns the id

It's not a secret.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Gitea’s “keep email private” noreply address format to be ID-based (name+id@NoReplyAddress) so commits remain associated with the correct account even after username changes.

Changes:

  • Generate placeholder (noreply) emails as lowername+uid@NoReplyAddress.
  • Extend user lookup by email to recognize both legacy name@NoReplyAddress and new name+id@NoReplyAddress formats.
  • Update and expand integration/unit tests to assert the new noreply format and related lookup behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/integration/repofiles_change_test.go Updates expected commit author/committer noreply emails to include +id.
tests/integration/editor_test.go Updates web editor commit email expectation for “keep private” default to include +id.
models/user/user_test.go Adds/extends test cases to cover user+id@NoReplyAddress resolution and conflicts.
models/user/user.go Switches placeholder generation to +id and updates lookup logic to support ID-based aliases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 12, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 13, 2026
@silverwind silverwind merged commit 4805151 into go-gitea:main Feb 14, 2026
24 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Feb 14, 2026
silverwind added a commit to silverwind/gitea that referenced this pull request Feb 14, 2026
* origin/main: (2555 commits)
  automate updating nix flakes (go-gitea#35641)
  Update AGENTS.md instructions (go-gitea#36627)
  use user id in noreply emails (go-gitea#36550)
  feat(db): Improve BuildCaseInsensitiveLike with lowercase (go-gitea#36598)
  [skip ci] Updated translations via Crowdin
  BUG: Fix workflow run jobs API returning null steps (go-gitea#36603)
  Refactor highlight and diff (go-gitea#36599)
  Fix bug when do LFS GC (go-gitea#36500)
  feature to be able to filter project boards by milestones (go-gitea#36321)
  Update emoji data for Unicode 16 (go-gitea#36596)
  Adapt monaco error matching pattern to recent webpack config change (go-gitea#36533)
  Fix a bug user could change another user's primary email (go-gitea#36586)
  fix(repo-editor): disable Monaco `editContext` to avoid bugs with lost focus (go-gitea#36585)
  Fine tune diff highlighting (go-gitea#36592)
  Add code editor setting dropdowns (go-gitea#36534)
  Update to go 1.26.0 and golangci-lint 2.9.0 (go-gitea#36588)
  Improve diff highlighting (go-gitea#36583)
  Fix markup code block layout (go-gitea#36578)
  Remove striped tables in UI (go-gitea#36509)
  Fix vertical alignment of `.commit-sign-badge` children (go-gitea#36570)
  ...

# Conflicts:
#	custom/conf/app.example.ini
#	docs/content/administration/config-cheat-sheet.en-us.md
#	docs/content/administration/config-cheat-sheet.zh-cn.md
#	modules/setting/security.go
#	routers/common/errpage.go
#	services/context/api.go
#	services/context/context.go
@Enzime
Copy link
Copy Markdown
Contributor

Enzime commented Feb 15, 2026

Should this match GitHub's id+username@... format instead as the ID can't change but your username might change

see: https://docs.github.com/en/account-and-profile/reference/email-addresses-reference#your-noreply-email-address

@TheFox0x7
Copy link
Copy Markdown
Contributor Author

TheFox0x7 commented Feb 15, 2026

not github's per say but yeah. It should be a correct subaddress correctly working subaddress which this isn't. Will fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use name+id@NO_REPLY_ADDRESS when user choose to keep email private

8 participants