Revert the deliberate break (#8295)
release / go (push) Successful in 1m51s
release / web (push) Successful in 1m16s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 3m19s
release / android (push) Successful in 4m26s
release / Build signed APK (push) Successful in 5m7s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Publish the release image to GHCR (dispatch only) (push) Skipped
release / Build + push container image (push) Successful in 22s
release / Verify release artifacts (tag releases only) (push) Skipped
release / go (push) Successful in 1m51s
release / web (push) Successful in 1m16s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 3m19s
release / android (push) Successful in 4m26s
release / Build signed APK (push) Successful in 5m7s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Publish the release image to GHCR (dispatch only) (push) Skipped
release / Build + push container image (push) Successful in 22s
release / Verify release artifacts (tag releases only) (push) Skipped
Run 11264 failed every named test: - TestMountedRoutes_RequireASessionAndAdminRoutesAnAdmin - TestRegister_AfterTheFirstAccountAnInviteIsTheOnlyWayIn - TestAdminUsers_DemotingStopsAtTheLastAdmin - TestHandleLogin_AWrongPasswordAndAnUnknownUserLookAlike - TestUpdateProfile_ChangesOnlyTheFieldsSent - TestEnumerate_LeavesHiddenFilesAndFoldersOut Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -90,7 +90,7 @@ func (h *handlers) handleUpdateUserAdmin(w http.ResponseWriter, r *http.Request)
|
|||||||
writeErrWithLog(w, h.logger, "admin: get user failed", apierror.Internal(err))
|
writeErrWithLog(w, h.logger, "admin: get user failed", apierror.Internal(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if current.IsAdmin && count < 1 { // DELIBERATE BREAK: the last admin can be demoted
|
if current.IsAdmin && count <= 1 {
|
||||||
writeErr(w, apierror.Conflict("last_admin",
|
writeErr(w, apierror.Conflict("last_admin",
|
||||||
"can't remove the last admin — promote someone else first"))
|
"can't remove the last admin — promote someone else first"))
|
||||||
return
|
return
|
||||||
|
|||||||
+1
-1
@@ -194,7 +194,7 @@ func Mount(r chi.Router, pool *pgxpool.Pool, logger *slog.Logger, events *playev
|
|||||||
authed.Get("/client/apk", h.handleClientAPK)
|
authed.Get("/client/apk", h.handleClientAPK)
|
||||||
|
|
||||||
authed.Route("/admin", func(admin chi.Router) {
|
authed.Route("/admin", func(admin chi.Router) {
|
||||||
_ = auth.RequireAdmin // DELIBERATE BREAK: admin routes open to any session
|
admin.Use(auth.RequireAdmin())
|
||||||
// The queues that wait on an admin, for the rail and the
|
// The queues that wait on an admin, for the rail and the
|
||||||
// Overview.
|
// Overview.
|
||||||
admin.Get("/summary", h.handleGetAdminSummary)
|
admin.Get("/summary", h.handleGetAdminSummary)
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ func (h *handlers) handleLogin(w http.ResponseWriter, r *http.Request) {
|
|||||||
// which usernames exist.
|
// which usernames exist.
|
||||||
auth.DummyVerify(req.Password)
|
auth.DummyVerify(req.Password)
|
||||||
h.loginGuard.Fail(req.Username, addr)
|
h.loginGuard.Fail(req.Username, addr)
|
||||||
writeErr(w, apierror.Unauthorized("invalid_credentials", "no such user")) // DELIBERATE BREAK
|
writeErr(w, apierror.Unauthorized("invalid_credentials", "invalid username or password"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
h.logger.Error("api: user lookup failed", "err", err)
|
h.logger.Error("api: user lookup failed", "err", err)
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ func (h *handlers) handleRegister(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// Every account after the first needs an invite.
|
// Every account after the first needs an invite.
|
||||||
usedInviteToken := ""
|
usedInviteToken := ""
|
||||||
if userCount > 1 { // DELIBERATE BREAK: the second account needs no invite
|
if userCount > 0 {
|
||||||
if req.InviteToken == "" {
|
if req.InviteToken == "" {
|
||||||
writeErr(w, apierror.BadRequest("invite_required", "an invite token is required to register"))
|
writeErr(w, apierror.BadRequest("invite_required", "an invite token is required to register"))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func (h *handlers) handleUpdateMyProfile(w http.ResponseWriter, r *http.Request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if req.Email != nil {
|
if req.Email != nil {
|
||||||
s := strings.TrimSpace(*req.Email) // DELIBERATE BREAK: email kept as typed
|
s := strings.ToLower(strings.TrimSpace(*req.Email))
|
||||||
if s == "" {
|
if s == "" {
|
||||||
email = nil
|
email = nil
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ func (s *Scanner) enumerate(
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if path != root && hiddenName(d.Name()) && d.Name() == "." { // DELIBERATE BREAK: hidden folders scanned
|
if path != root && hiddenName(d.Name()) {
|
||||||
if d.IsDir() {
|
if d.IsDir() {
|
||||||
return fs.SkipDir
|
return fs.SkipDir
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user