Skip to content

Commit

Permalink
Annotate script tags that don't require nonces (#1756)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-adam authored Dec 14, 2023
1 parent 64c63be commit b3be4e7
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 250 deletions.
235 changes: 0 additions & 235 deletions data/api/LuminexGuideSet.html

This file was deleted.

1 change: 1 addition & 0 deletions data/api/getDataAggregateTest.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div id="getData-config-form-div"></div>
<br/>
<div id="getData-grid-div"></div>
<!-- Used as HTML wiki source, so nonce is NOT required -->
<script type="text/javascript">

function init() {
Expand Down
1 change: 1 addition & 0 deletions data/api/getDataDateTest.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div id="getData-config-form-div"></div>
<br/>
<div id="getData-grid-div"></div>
<!-- Used as HTML wiki source, so nonce is NOT required -->
<script type="text/javascript">
function getDateOptions(query, dateName)
{
Expand Down
1 change: 1 addition & 0 deletions data/api/getDataErrorsTest.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div id="getData-config-form-div"></div>
<br/>
<div id="getData-message-div"></div>
<!-- Used as HTML wiki source, so nonce is NOT required -->
<script type="text/javascript">

LABKEY.requiresExt3(function() {
Expand Down
1 change: 1 addition & 0 deletions data/api/getDataTest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
<!-- Used as HTML wiki source, so nonce is NOT required -->
<script type="text/javascript">

var id = 'jsonWrapperTest';
Expand Down
1 change: 1 addition & 0 deletions data/api/getDataVisitTest.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div id="getData-config-form-div"></div>
<br/>
<div id="getData-grid-div"></div>
<!-- Used as HTML wiki source, so nonce is NOT required -->
<script type="text/javascript">
var cd4Measure = {
"measure":{
Expand Down
1 change: 1 addition & 0 deletions data/api/groupSecurityTest.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<button class="labkey-button" id="start-test">Start Test</button>
<div id="log-info"></div>
<!-- Used as HTML wiki source, so nonce is NOT required -->
<script type="text/javascript">

var logHtml = "";
Expand Down
1 change: 1 addition & 0 deletions data/api/jsReportTest.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div id="rreporttest"></div>
<div id="jsreporttest"></div>
<!-- Used as HTML wiki source, so nonce is NOT required -->
<script type="text/javascript">

(function(){
Expand Down
1 change: 1 addition & 0 deletions data/api/nabApiTest.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<div id="testDiv"></div>
<!-- Used as HTML wiki source, so nonce is NOT required -->
<script type="text/javascript">
(function() {
var testProjectName = 'Nab Test Verify Project';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void addNavTrail(NavTree root)
}

@RequiresPermission(ReadPermission.class)
public class ExternalLinkAction extends SimpleViewAction<Object>
public static class ExternalLinkAction extends SimpleViewAction<Object>
{
@Override
public ModelAndView getView(Object form, BindException errors)
Expand Down
4 changes: 2 additions & 2 deletions modules/restrictedModule/resources/views/webpart.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p>This is a web part view in the restricted module.</p>
<a id="testlink" href="<%=contextPath%>/project<%=containerPath%>/begin.view">begin</a>
<a id="testlink" href="<%=contextPath%><%=containerPath%>/project-begin.view">begin</a>
<script type="text/javascript" nonce="<%=scriptNonce%>">
Ext.onReady(function()
LABKEY.Utils.onReady(function()
{
var webpart=<%=webpartContext%>;
});
Expand Down
1 change: 0 additions & 1 deletion src/org/labkey/test/LabKeySiteWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ protected void changeUserEmail(String userEmail, String newUserEmail)
clickButton("Submit");
}


protected void setSystemMaintenance(boolean enable)
{
// Not available in production mode
Expand Down
7 changes: 2 additions & 5 deletions src/org/labkey/test/tests/AbstractKnitrReportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@
import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

/**
* User: tgaluhn
* Date: 9/20/2017
*
* Split helper methods and tests from KnitrReportTest so a subset of those test cases can be run in RSandboxTest
*/
public abstract class AbstractKnitrReportTest extends BaseWebDriverTest
Expand All @@ -57,7 +54,7 @@ private static String readReport(final Path reportFile)

reportSource = TestFileUtils.getFileContents(reportFile);

assertTrue("No data in report file [" + reportFile.getFileName() + "]", reportSource.length() > 0);
assertFalse("No data in report file [" + reportFile.getFileName() + "]", reportSource.isEmpty());

return reportSource;
}
Expand Down
4 changes: 2 additions & 2 deletions src/org/labkey/test/tests/KnitrReportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void testKnitrHTMLFormat()
}

@Test
public void testKnitrMarkupFormat() throws Exception
public void testKnitrMarkupFormat()
{
Locator.XPathLocator plotLocator = Locator.xpath("//div[@class='labkey-knitr']//img");
Locator[] reportContains = {Locator.tag("h1").withText("A Minimal Example for Markdown"),
Expand Down Expand Up @@ -128,7 +128,7 @@ public void testAdhocReportDependenciesLib()
}

@Test
public void testRmarkdownV2Support() throws Exception
public void testRmarkdownV2Support()
{
markdownV2();
}
Expand Down
4 changes: 2 additions & 2 deletions src/org/labkey/test/tests/TimeChartAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ protected void doCreateSteps()
}

@SafeVarargs
private final void testVisApi(File htmlPage, String[] testTitles, @Nullable int[] testRowCounts, @Nullable String[][] testColumnNames,
@Nullable String[] testOutputTexts, List<Pair<String, List<Object>>>... colsForAllTests)
private void testVisApi(File htmlPage, String[] testTitles, @Nullable int[] testRowCounts, @Nullable String[][] testColumnNames,
@Nullable String[] testOutputTexts, List<Pair<String, List<Object>>>... colsForAllTests)
{
PortalHelper portalHelper = new PortalHelper(this);
WikiHelper wikiHelper = new WikiHelper(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ protected void initializeStudyFolder(String... tabs)
clickButton("Create Study");
}


protected void importSpecimens()
{
importSpecimens(getFolderName(), TestFileUtils.getSampleData("viability/specimens.txt"));
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/test/tests/viability/ViabilityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ protected void runReRunTest()
protected void runResultSpecimenLookupTest()
{
log("** Checking ResultSpecimens lookups");
beginAt("/query/" + getProjectName() + "/" + getFolderName() + "/executeQuery.view?schemaName=assay&query.queryName=" + getAssayName() + " ResultSpecimens");
beginAt("/" + getProjectName() + "/" + getFolderName() + "/query-executeQuery.view?schemaName=assay&query.queryName=" + getAssayName() + " ResultSpecimens");
DataRegionTable table = new DataRegionTable("query", this);
assertTextPresent(new TextSearcher(table.getComponentElement()::getText), "foobar", "vial1", "xyzzy", "160450533-5", "161400006.11-5");

Expand Down

0 comments on commit b3be4e7

Please sign in to comment.