Skip to content

auth: deny access for disabled accounts on all credential paths - #8439

Merged
unknwon merged 9 commits into
mainfrom
ghsa-f9cv-gfvg-3464
Nov 10, 2026
Merged

unknwon merged 9 commits into
mainfrom
ghsa-f9cv-gfvg-3464

Conversation

@unknwon

@unknwon unknwon commented Nov 8, 2026

Copy link
Copy Markdown
Member

Describe the pull request

Accounts that an admin has prohibited from logging in, or that are not activated while email confirmation is required, are now denied on every credential path, not only on web sign-in.

Link to the issue: GHSA-f9cv-gfvg-3464

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code or have provided the test plan. (if applicable)
  • I have added an entry to CHANGELOG. (if applicable)

Test plan

  • moon run gogs:test and moon run gogs:lint pass.
  • Reproduced the advisory steps on a local instance, before and after the change, with both "Prohibit login" and deactivation (with REQUIRE_EMAIL_CONFIRMATION = true). Access through every transport works while the account is enabled and is rejected once it is disabled.

@unknwon
unknwon requested a balanced review from Copilot November 8, 2026 00:19
@unknwon unknwon added this to the 0.14.4 milestone Nov 8, 2026

Copilot AI 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.

🟡 Changes recommended

Disabled accounts retain private repository access through existing sessions or reverse-proxy authentication, while anonymous fallback allows star/watch requests to create user-0 relations and alter repository counters.

3 open issues
What changed in this PR

This PR extends disabled-account checks beyond web sign-in to repository credential paths, using a shared account-status predicate.

Changes:

  • Adds User.IsDisabled() for prohibited login and activation requirements.
  • Applies checks to HTTP Git, LFS, SSH, Basic/token authentication, and web repository context.
  • Adds predicate and LFS tests, plus a security changelog entry.
File Description
internal/​route/​repo/​http.go Rejects disabled users during HTTP Git authentication.
internal/​route/​lfs/​route.go Rejects disabled users during LFS authentication.
internal/​route/​lfs/​route_test.go Tests prohibited accounts using passwords and tokens.
internal/​database/​users.go Adds the shared disabled-account predicate.
internal/​database/​users_test.go Tests account-status and email-confirmation combinations.
internal/​context/​auth.go Adds Basic/token checks while retaining session identity.
cmd/​gogs/​serv.go Checks SSH key owners on protected access paths.
cmd/​gogs/​internal/​web/​repo_context.go Treats disabled repository viewers as anonymous.
CHANGELOG.md Documents the disabled-account security fix.

Review effort: Balanced

Comment thread internal/context/auth.go Resolved
Comment thread internal/context/auth.go Resolved
Comment thread cmd/gogs/internal/web/repo_context.go Resolved
@unknwon
unknwon merged commit 8a8ebb1 into main Nov 10, 2026
11 checks passed
@unknwon
unknwon deleted the ghsa-f9cv-gfvg-3464 branch November 10, 2026 00:24
unknwon added a commit that referenced this pull request Nov 11, 2026
appthin added a commit to appthin/gogs-plus that referenced this pull request Nov 12, 2026
Brings in the 0.14.4 security and bug fixes (gogs#8439, gogs#8472, gogs#8478, gogs#8480-gogs#8484,
gogs#8486, gogs#8488), the Highlights-based diff highlighter for the web UI (gogs#8492,
gogs#8434, gogs#8435), absolute entrypoint paths for the SPA shell (gogs#8447), Docker
workflow updates (gogs#8463, gogs#8475), and housekeeping.

Fork-specific code is preserved: CodeQL workflow, login bans, sign-in
protection, the -plus release pipeline, and the rewritten README.
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