CVE-2023-29515: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (CWE-79)
value: XWiki Platform is a generic wiki platform offering runtime services for applications built on top of it. Any user who can create a space can become admin of that space through App Within Minutes. The admin right implies the script right and thus allows JavaScript injection. The vulnerability can be exploited by creating an app in App Within Minutes. If the button should be disabled because the user doesn't have global edit right, the app can also be created by directly opening `/xwiki/bin/view/AppWithinMinutes/CreateApplication?wizard=true` on the XWiki installation. This has been patched in XWiki 13.10.11, 14.4.8, 14.10.1 and 15.0 RC1 by not granting the space admin right if the user doesn't have script right on the space where the app is created. Error message are displayed to warn the user that the app will be broken in this case. Users who became space admin through this vulnerability won't loose the space admin right due to the fix, so it is advised to check if all users who created AWM apps should keep their space admin rights. Users are advised to upgrade. There are no known workarounds for this vulnerability.
CWE description: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
CVSS v3 base score: 5.4
Published: 2023-04-19T00:15Z
Repository: https://github.com/xwiki/xwiki-platform
Language: XML
Files changed: xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/AllITs.java, xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/AppsLiveTableIT.java, xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/WithoutScriptRightIT.java, xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/WizardIT.java, xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/pom.xml, xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/CreateApplication.xml, xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/LiveTableEditSheet.xml, xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml
Commit date: 2022-12-07 16:14:26 +0100
Commit message: XWIKI-20190: Properly handle AWM creation without script right

* Warn when the user doesn't have script right.
* Ensure that in integration tests the users have script right.
* Add an explicit test for the behavior without script right.
* Fix missing dependency.
* Actually delete the preferences in AppsLiveTableIT.

Diff: diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/AllITs.java b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/AllITs.java
index 0d99bcf95df12..8842b82ff0438 100644
--- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/AllITs.java
+++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/AllITs.java
@@ -83,6 +83,12 @@ class NestedUserClassFieldIT extends UserClassFieldIT
     @Nested
     @DisplayName("Class Editor tests")
     class NestedClassEditorIT extends ClassEditorIT
     {
     }
+
+    @Nested
+    @DisplayName("Without script right test")
+    class NestedWithoutScriptRightIT extends WithoutScriptRightIT
+    {
+    }
 }
diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/AppsLiveTableIT.java b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/AppsLiveTableIT.java
index 2b09db27cfd04..887d211ec3c27 100644
--- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/AppsLiveTableIT.java
+++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/AppsLiveTableIT.java
@@ -56,10 +56,13 @@
     private String appName;
 
     @BeforeAll
     public void setupClass(TestUtils testUtils)
     {
+        testUtils.loginAsSuperAdmin();
+        // The application creator needs script rights in order to execute the scripts generated by the wizard.
+        testUtils.setGlobalRights("", "XWiki." + USERNAME, "script", true);
         testUtils.createUserAndLogin(USERNAME, PASSWORD);
     }
 
     @BeforeEach
     public void setUp(TestReference testReference, TestUtils testUtils, LogCaptureConfiguration logCaptureConfiguration)
@@ -177,10 +180,11 @@ void testActionRights(TestUtils testUtils, TestReference testReference)
             appsLiveTable = AppWithinMinutesHomePage.gotoPage().getAppsLiveTable();
             appsLiveTable.filterApplicationName(appName);
             assertTrue(appsLiveTable.canEditApplication(appName));
             assertFalse(appsLiveTable.canDeleteApplication(appName));
         } finally {
+            testUtils.loginAsSuperAdmin();
             // We don't want to keep the rights
             testUtils.deletePage(xwikiPreferences);
         }
     }
 }
diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/WithoutScriptRightIT.java b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/WithoutScriptRightIT.java
new file mode 100644
index 0000000000000..b3289fcb9d1c3
--- /dev/null
+++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/WithoutScriptRightIT.java
@@ -0,0 +1,96 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.appwithinminutes.test.ui;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.xwiki.appwithinminutes.test.po.AppWithinMinutesHomePage;
+import org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage;
+import org.xwiki.appwithinminutes.test.po.ApplicationCreatePage;
+import org.xwiki.appwithinminutes.test.po.ApplicationHomeEditPage;
+import org.xwiki.appwithinminutes.test.po.ApplicationHomePage;
+import org.xwiki.appwithinminutes.test.po.ApplicationsLiveTableElement;
+import org.xwiki.appwithinminutes.test.po.EntryEditPage;
+import org.xwiki.appwithinminutes.test.po.EntryNamePane;
+import org.xwiki.test.docker.junit5.TestReference;
+import org.xwiki.test.docker.junit5.UITest;
+import org.xwiki.test.ui.TestUtils;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Tests AWM without script right.
+ *
+ * @version $Id$
+ * @since 13.10.11
+ * @since 14.4.8
+ * @since 14.10.1
+ * @since 15.0RC1
+ */
+@UITest
+class WithoutScriptRightIT
+{
+    private static final String USER_NAME = "NoScript";
+
+    private static final String PASSWORD = "password";
+
+    private static final String NO_SCRIPT_ERROR = "You don't have the script right which is necessary to create or "
+        + "edit an application. The application might not work correctly when you continue.";
+
+    @BeforeAll
+    static void beforeAll(TestUtils testUtils)
+    {
+        testUtils.loginAsSuperAdmin();
+        testUtils.createUserAndLogin(USER_NAME, PASSWORD, "");
+    }
+
+    @Order(1)
+    @Test
+    void createApplicationWithoutScriptRight(TestReference testReference)
+    {
+        ApplicationCreatePage appCreatePage = AppWithinMinutesHomePage.gotoPage().clickCreateApplication();
+        String appName = testReference.getLastSpaceReference().getName();
+        appCreatePage.setApplicationName(appName);
+        appCreatePage.waitForApplicationNamePreview();
+        assertTrue(appCreatePage.getContent().contains(NO_SCRIPT_ERROR));
+
+        ApplicationClassEditPage classEditPage = appCreatePage.clickNextStep();
+        classEditPage.addField("Short Text");
+        ApplicationHomeEditPage applicationHomeEditPage = classEditPage.clickNextStep().clickNextStep();
+        assertTrue(applicationHomeEditPage.getContent().contains(NO_SCRIPT_ERROR));
+
+        ApplicationHomePage applicationHomePage = applicationHomeEditPage.clickFinish();
+        // TODO: change to assert rendering errors when https://jira.xwiki.org/browse/XWIKI-20423 has been fixed.
+        assertTrue(applicationHomePage.hasEntriesLiveTable());
+
+        EntryNamePane entryNamePane = applicationHomePage.clickAddNewEntry();
+        entryNamePane.setName("Test entry");
+        EntryEditPage editPage = entryNamePane.clickAdd();
+        // The edit form doesn't work without script right.
+        assertTrue(editPage.hasRenderingError());
+
+        // Without script right, no delete is available.
+        ApplicationsLiveTableElement liveTable = AppWithinMinutesHomePage.gotoPage().getAppsLiveTable();
+        assertTrue(liveTable.isApplicationListed(appName));
+        assertFalse(liveTable.canDeleteApplication(appName));
+    }
+}
diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/WizardIT.java b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/WizardIT.java
index 36c185e2f1a0f..647667cb957fb 100644
--- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/WizardIT.java
+++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/WizardIT.java
@@ -342,14 +342,12 @@ void goBackToFirstStep(TestUtils testUtils, TestReference testReference)
         assertFalse(classEditPage.hasPreviousStep());
     }
 
     private ApplicationCreatePage goToAppCreatePage(TestUtils testUtils, TestReference testReference)
     {
-        // Register a simple user, login and go to the App Within Minutes home page.
-        String userName = "SimpleUser";
-        String password = "SimplePassword";
-        testUtils.createUserAndLogin(userName, password);
+        // Login and go to the App Within Minutes home page.
+        testUtils.login(USER_NAME, PASSWORD);
         // Make sure the application location exists so that we can select it with the location picker.
         testUtils.createPage(Arrays.asList(getClass().getSimpleName(), testReference.getLastSpaceReference().getName()),
             "WebHome", null, null);
         AppWithinMinutesHomePage appWithinMinutesHomePage = AppWithinMinutesHomePage.gotoPage();
 
diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/pom.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/pom.xml
index e9c10e0a05c98..2fcedee43907b 100644
--- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/pom.xml
+++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/pom.xml
@@ -117,10 +117,16 @@
       <groupId>org.xwiki.rendering</groupId>
       <artifactId>xwiki-rendering-macro-html</artifactId>
       <version>${rendering.version}</version>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.xwiki.rendering</groupId>
+      <artifactId>xwiki-rendering-macro-message</artifactId>
+      <version>${rendering.version}</version>
+      <scope>runtime</scope>
+    </dependency>
     <!-- Used to implement drag & drop in the "Structure" (class definition) and  "Presentation" (home page) steps. -->
     <dependency>
       <groupId>org.webjars</groupId>
       <artifactId>scriptaculous</artifactId>
     </dependency>
diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/CreateApplication.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/CreateApplication.xml
index 7df957b931823..c7de9010582a0 100644
--- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/CreateApplication.xml
+++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/CreateApplication.xml
@@ -141,10 +141,15 @@
     #if ($appDescriptor || $xwiki.exists($appHomeRef) || $xwiki.exists($appClassRef))
       &lt;div class="box warningmessage"&gt;
         $services.localization.render('platform.appwithinminutes.appNameIsUsedWarning')
       &lt;/div&gt;
     #end
+    #if (!$services.security.authorization.hasAccess('script', $xcontext.userReference, $appHomeRef))
+      &lt;div class="box errormessage"&gt;
+        $escapetool.xml($services.localization.render('platform.appwithinminutes.appHomePageNoScriptRight'))
+      &lt;/div&gt;
+    #end
   #end
 #end
 
 #macro (getAppReference)
   #if ($request.resolve == 'true')
diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/LiveTableEditSheet.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/LiveTableEditSheet.xml
index ea70536e22e72..471d74aa7436c 100644
--- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/LiveTableEditSheet.xml
+++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/LiveTableEditSheet.xml
@@ -229,11 +229,13 @@
 
 #macro (maybeGrantSpaceAdminRight $spaceRef)
   ## Grant space administration rights only if the space is new. Don't overwrite existing space preferences.
   #set ($spaceHomeRef = $services.model.resolveDocument('', 'default', $spaceRef))
   #set ($spacePrefsRef = $services.model.resolveDocument('WebPreferences', 'explicit', $spaceRef))
-  #if (!$xwiki.exists($spaceHomeRef) &amp;&amp; !$xwiki.exists($spacePrefsRef))
+  ## Verify that the current user has script right on the current space home.
+  #set ($hasScript = $services.security.authorization.hasAccess('script',  $xcontext.userReference, $spaceHomeRef))
+  #if ($hasScript &amp;&amp; !$xwiki.exists($spaceHomeRef) &amp;&amp; !$xwiki.exists($spacePrefsRef))
     #set ($spacePrefsDoc = $xwiki.getDocument($spacePrefsRef))
     #set ($discard = $spacePrefsDoc.use($spacePrefsDoc.getObject('XWiki.XWikiGlobalRights', true)))
     #set ($discard = $spacePrefsDoc.set('allow', 1))
     #set ($discard = $spacePrefsDoc.set('levels', 'admin'))
     #set ($discard = $spacePrefsDoc.set('users', $services.model.serialize($xcontext.userReference, 'default')))
@@ -351,10 +353,14 @@
   #end
 #end
 {{/velocity}}
 
 {{velocity}}
+#if (!$services.security.authorization.hasAccess('script', $xcontext.userReference, $doc.documentReference))
+  {{error}}{{translation key="platform.appwithinminutes.appHomePageNoScriptRight" /}}{{/error}}
+
+#end
 #if ("$!request.wizard" == 'true')
   {{include reference="AppWithinMinutes.WizardStep" /}}
 #end
 {{/velocity}}
 
diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml
index f17f88f755471..f5c0173074496 100644
--- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml
+++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml
@@ -208,10 +208,11 @@
 platform.appwithinminutes.appHomePageDeleteEntriesLabel=Delete all entries
 platform.appwithinminutes.appHomePageEditAppLabel=Edit application
 platform.appwithinminutes.appHomePageTranslateAppLabel=Translate application
 platform.appwithinminutes.appHomePageDeleteAppLabel=Delete application
 platform.appwithinminutes.appHomePageMovedWarning=The application might not function correctly because it has been renamed or moved without updating the code. Please edit the application and follow the steps in order to update the code.
+platform.appwithinminutes.appHomePageNoScriptRight=You don't have the script right which is necessary to create or edit an application. The application might not work correctly when you continue.
 AppWithinMinutes.LiveTableClass_description=Description
 AppWithinMinutes.LiveTableClass_columns=Live Table Columns
 
 ### Delete application dialog
 platform.appwithinminutes.deleteAppConfirmation=The application {0} and ALL its entries will be deleted. Are you sure you want to continue?

Vulnerable code:         // Register a simple user, login and go to the App Within Minutes home page.
        String userName = "SimpleUser";
        String password = "SimplePassword";
        testUtils.createUserAndLogin(userName, password);
  #if (!$xwiki.exists($spaceHomeRef) &amp;&amp; !$xwiki.exists($spacePrefsRef))
Fixed code: 
    @Nested
    @DisplayName("Without script right test")
    class NestedWithoutScriptRightIT extends WithoutScriptRightIT
    {
    }
        testUtils.loginAsSuperAdmin();
        // The application creator needs script rights in order to execute the scripts generated by the wizard.
        testUtils.setGlobalRights("", "XWiki." + USERNAME, "script", true);
            testUtils.loginAsSuperAdmin();
/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.appwithinminutes.test.ui;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.xwiki.appwithinminutes.test.po.AppWithinMinutesHomePage;
import org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage;
import org.xwiki.appwithinminutes.test.po.ApplicationCreatePage;
import org.xwiki.appwithinminutes.test.po.ApplicationHomeEditPage;
import org.xwiki.appwithinminutes.test.po.ApplicationHomePage;
import org.xwiki.appwithinminutes.test.po.ApplicationsLiveTableElement;
import org.xwiki.appwithinminutes.test.po.EntryEditPage;
import org.xwiki.appwithinminutes.test.po.EntryNamePane;
import org.xwiki.test.docker.junit5.TestReference;
import org.xwiki.test.docker.junit5.UITest;
import org.xwiki.test.ui.TestUtils;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
 * Tests AWM without script right.
 *
 * @version $Id$
 * @since 13.10.11
 * @since 14.4.8
 * @since 14.10.1
 * @since 15.0RC1
 */
@UITest
class WithoutScriptRightIT
{
    private static final String USER_NAME = "NoScript";

    private static final String PASSWORD = "password";

    private static final String NO_SCRIPT_ERROR = "You don't have the script right which is necessary to create or "
        + "edit an application. The application might not work correctly when you continue.";

    @BeforeAll
    static void beforeAll(TestUtils testUtils)
    {
        testUtils.loginAsSuperAdmin();
        testUtils.createUserAndLogin(USER_NAME, PASSWORD, "");
    }

    @Order(1)
    @Test
    void createApplicationWithoutScriptRight(TestReference testReference)
    {
        ApplicationCreatePage appCreatePage = AppWithinMinutesHomePage.gotoPage().clickCreateApplication();
        String appName = testReference.getLastSpaceReference().getName();
        appCreatePage.setApplicationName(appName);
        appCreatePage.waitForApplicationNamePreview();
        assertTrue(appCreatePage.getContent().contains(NO_SCRIPT_ERROR));

        ApplicationClassEditPage classEditPage = appCreatePage.clickNextStep();
        classEditPage.addField("Short Text");
        ApplicationHomeEditPage applicationHomeEditPage = classEditPage.clickNextStep().clickNextStep();
        assertTrue(applicationHomeEditPage.getContent().contains(NO_SCRIPT_ERROR));

        ApplicationHomePage applicationHomePage = applicationHomeEditPage.clickFinish();
        // TODO: change to assert rendering errors when https://jira.xwiki.org/browse/XWIKI-20423 has been fixed.
        assertTrue(applicationHomePage.hasEntriesLiveTable());

        EntryNamePane entryNamePane = applicationHomePage.clickAddNewEntry();
        entryNamePane.setName("Test entry");
        EntryEditPage editPage = entryNamePane.clickAdd();
        // The edit form doesn't work without script right.
        assertTrue(editPage.hasRenderingError());

        // Without script right, no delete is available.
        ApplicationsLiveTableElement liveTable = AppWithinMinutesHomePage.gotoPage().getAppsLiveTable();
        assertTrue(liveTable.isApplicationListed(appName));
        assertFalse(liveTable.canDeleteApplication(appName));
    }
}
        // Login and go to the App Within Minutes home page.
        testUtils.login(USER_NAME, PASSWORD);
    <dependency>
      <groupId>org.xwiki.rendering</groupId>
      <artifactId>xwiki-rendering-macro-message</artifactId>
      <version>${rendering.version}</version>
      <scope>runtime</scope>
    </dependency>
    #if (!$services.security.authorization.hasAccess('script', $xcontext.userReference, $appHomeRef))
      &lt;div class="box errormessage"&gt;
        $escapetool.xml($services.localization.render('platform.appwithinminutes.appHomePageNoScriptRight'))
      &lt;/div&gt;
    #end
  ## Verify that the current user has script right on the current space home.
  #set ($hasScript = $services.security.authorization.hasAccess('script',  $xcontext.userReference, $spaceHomeRef))
  #if ($hasScript &amp;&amp; !$xwiki.exists($spaceHomeRef) &amp;&amp; !$xwiki.exists($spacePrefsRef))
#if (!$services.security.authorization.hasAccess('script', $xcontext.userReference, $doc.documentReference))
  {{error}}{{translation key="platform.appwithinminutes.appHomePageNoScriptRight" /}}{{/error}}

#end
platform.appwithinminutes.appHomePageNoScriptRight=You don't have the script right which is necessary to create or edit an application. The application might not work correctly when you continue.