Skip to content

fix: represent a deleted assignee team as a Ghost team - #38413

Merged
bircni merged 3 commits into
go-gitea:mainfrom
Otto-Deviant1904:fix/ghost-team-for-deleted-assignee-team
Jul 12, 2026
Merged

fix: represent a deleted assignee team as a Ghost team#38413
bircni merged 3 commits into
go-gitea:mainfrom
Otto-Deviant1904:fix/ghost-team-for-deleted-assignee-team

Conversation

@Otto-Deviant1904

@Otto-Deviant1904 Otto-Deviant1904 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #35472.

Comment.LoadAssigneeUserAndTeam already has a Ghost user fallback
for a deleted assignee user, but the parallel branch for a deleted
assignee team just swallowed the not-found error and left
AssigneeTeam as nil. This is inconsistent (the reporter's example
shows assignee becoming a Ghost user while assignee_team becomes
null), and it's also a latent nil pointer bug: other code that
assumes AssigneeTeam is set once this function returns without
error will panic.

Added organization.NewGhostTeam() / Team.IsGhost(), mirroring the
existing user_model.NewGhostUser() / User.IsGhost() pattern, and
used it in the same fallback branch.

LoadAssigneeUserAndTeam already falls back to a Ghost user when the
assignee user has been deleted, but silently left AssigneeTeam nil
when the assignee team had been deleted (#35472), causing a nil
pointer panic in code paths that assume AssigneeTeam is non-nil once
LoadAssigneeUserAndTeam has run. Added organization.NewGhostTeam,
mirroring user_model.NewGhostUser, and used it in the same fallback
branch as the user case.

Fixes #35472
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 12, 2026
@wxiaoguang wxiaoguang added the backport/v1.27 This PR should be backported to Gitea 1.27 label Jul 12, 2026
@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 Jul 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 Jul 12, 2026
@bircni
bircni merged commit aba0eb1 into go-gitea:main Jul 12, 2026
27 checks passed
@GiteaBot GiteaBot added this to the 28.0.0 milestone Jul 12, 2026
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Jul 12, 2026
wxiaoguang added a commit that referenced this pull request Jul 12, 2026
Backport #38413

Fixes #35472.

Co-authored-by: Harsh Satyajit Thakur <f20240223@goa.bits-pilani.ac.in>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 13, 2026
* 'main' of https://github.com/go-gitea/gitea:
  fix: various security fixes (go-gitea#38406)
  fix(util): reject invalid characters between time-estimate units (go-gitea#38416)
  feat(actions): implement adaptive auto-refresh for workflow runs list (go-gitea#38329)
  fix(turnstile): route CAPTCHA verification through the configured proxy (go-gitea#38412)
  fix: represent a deleted assignee team as a Ghost team (go-gitea#38413)
  [skip ci] Updated translations via Crowdin
  fix: refresh pull request merge box when the commit status is pending (go-gitea#38410)
  chore: remove Yarden Shoham from maintainers (go-gitea#38407)
  fix: actions task state concurrent update (go-gitea#38405)
  fix(actions): keep workflow run trailing on one row with long branch names (go-gitea#38382)
  fix(pull): re-evaluate review official flag on target branch change (go-gitea#38319)
  fix(web): use locale-aware date formatting for contribution calendar tooltips (go-gitea#38398)
  fix(security): harden access checks and migration validation (go-gitea#38324)
  fix: enforce public-only token scope and harden push options / locale parsing (go-gitea#38323)
  fix: co-author detection (go-gitea#38392)
  fix(api): stop leaking private repo metadata after access revocation (go-gitea#38321)
  fix(lfs): require proof of possession for cross-repo objects (go-gitea#38322)
  fix: incorrect co-author detection on commit page (go-gitea#38386)
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 13, 2026
* main:
  fix: various security fixes (go-gitea#38406)
  fix(util): reject invalid characters between time-estimate units (go-gitea#38416)
  feat(actions): implement adaptive auto-refresh for workflow runs list (go-gitea#38329)
  fix(turnstile): route CAPTCHA verification through the configured proxy (go-gitea#38412)
  fix: represent a deleted assignee team as a Ghost team (go-gitea#38413)
  [skip ci] Updated translations via Crowdin
  fix: refresh pull request merge box when the commit status is pending (go-gitea#38410)
  chore: remove Yarden Shoham from maintainers (go-gitea#38407)
  fix: actions task state concurrent update (go-gitea#38405)
  fix(actions): keep workflow run trailing on one row with long branch names (go-gitea#38382)
  fix(pull): re-evaluate review official flag on target branch change (go-gitea#38319)
  fix(web): use locale-aware date formatting for contribution calendar tooltips (go-gitea#38398)
  fix(security): harden access checks and migration validation (go-gitea#38324)
  fix: enforce public-only token scope and harden push options / locale parsing (go-gitea#38323)
  fix: co-author detection (go-gitea#38392)
  fix(api): stop leaking private repo metadata after access revocation (go-gitea#38321)
  fix(lfs): require proof of possession for cross-repo objects (go-gitea#38322)
  fix: incorrect co-author detection on commit page (go-gitea#38386)
zeekay pushed a commit to hanzoai/git that referenced this pull request Jul 26, 2026
Fixes go-gitea#35472.

`Comment.LoadAssigneeUserAndTeam` already has a Ghost user fallback
for a deleted assignee user, but the parallel branch for a deleted
assignee team just swallowed the not-found error and left
`AssigneeTeam` as `nil`. This is inconsistent (the reporter's example
shows `assignee` becoming a Ghost user while `assignee_team` becomes
`null`), and it's also a latent nil pointer bug: other code that
assumes `AssigneeTeam` is set once this function returns without
error will panic.

Added `organization.NewGhostTeam()` / `Team.IsGhost()`, mirroring the
existing `user_model.NewGhostUser()` / `User.IsGhost()` pattern, and
used it in the same fallback branch.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/done All backports for this PR have been created backport/v1.27 This PR should be backported to Gitea 1.27 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assignees are not handled consistently in the issue timeline (assignee becomes Ghost, assignee_team becomes null)

4 participants