From 8b84fbd29e61b071c81482f2e45fe57f7b4ea112 Mon Sep 17 00:00:00 2001 From: Adam Rauch Date: Sun, 29 Nov 2026 13:21:16 -0800 Subject: [PATCH] GH Issue 1930: Fix terms of use redirect loop in admin-only mode (#8394) ## Rationale Fix the endless redirect loop that makes a server unreachable when mandatory site-wide terms of use are enabled while the server is in admin-only mode ([GH Issue 1930](https://github.com/LabKey/internal-issues/issues/1930)). The maintenance page enforced terms of use while the terms page wasn't allowed during admin-only mode, so guests and non-admins bounced between the two with an ever-growing `returnUrl` until requests exceeded the header size limit. A regression test will follow on 26.11 once this merges forward, since that branch has the site settings API needed to toggle admin-only mode cleanly. ## Related Pull Requests - https://github.com/LabKey/testAutomation/pull/3322 ## Changes - Actions allowed during upgrade or admin-only mode now implicitly ignore terms of use, so terms are enforced only once the server is fully available --- api/src/org/labkey/api/action/PermissionCheckableAction.java | 4 +++- api/src/org/labkey/api/module/AllowedDuringUpgrade.java | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/org/labkey/api/action/PermissionCheckableAction.java b/api/src/org/labkey/api/action/PermissionCheckableAction.java index d5b0fe91a02..94ff8e1ffbb 100644 --- a/api/src/org/labkey/api/action/PermissionCheckableAction.java +++ b/api/src/org/labkey/api/action/PermissionCheckableAction.java @@ -19,6 +19,7 @@ import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.Nullable; import org.labkey.api.data.Container; +import org.labkey.api.module.AllowedDuringUpgrade; import org.labkey.api.module.IgnoresForbiddenProjectCheck; import org.labkey.api.security.AdminConsoleAction; import org.labkey.api.security.CSRF; @@ -263,7 +264,8 @@ private void checkPermissionsAndTermsOfUse(Set contextualRoles, boolean is { checkActionPermissions(contextualRoles); - if (!getClass().isAnnotationPresent(IgnoresTermsOfUse.class)) + // GH Issue 1930: terms enforcement on actions allowed during admin-only mode can loop with the maintenance redirect + if (!getClass().isAnnotationPresent(IgnoresTermsOfUse.class) && !getClass().isAnnotationPresent(AllowedDuringUpgrade.class)) verifyTermsOfUse(isSendBasic); } diff --git a/api/src/org/labkey/api/module/AllowedDuringUpgrade.java b/api/src/org/labkey/api/module/AllowedDuringUpgrade.java index 6c0bf626ff0..bb704053af8 100644 --- a/api/src/org/labkey/api/module/AllowedDuringUpgrade.java +++ b/api/src/org/labkey/api/module/AllowedDuringUpgrade.java @@ -21,9 +21,7 @@ /** * Tag for the very small set of actions that users are allowed to access while the server is in the midst - * of an upgrade to the newly deployed module versions or initial install. - * User: adam - * Date: Nov 11, 2008 + * of an upgrade to the newly deployed module versions or initial installation. Also implies {@link org.labkey.api.security.IgnoresTermsOfUse}. */ public @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @interface AllowedDuringUpgrade