Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bot] Merge 24.11 to develop #2305

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions modules/simpletest/resources/views/encodeButton.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<input id="firstName" type="text" value="<script>alert('XSS Input Success')</script><span>Loading XSS</span>" />
<button class="btn btn-primary input-test" data-loading-text="<span>I'm Loading</span>" type="button">
Attempt XSS injection
</button>
<script type="text/javascript" nonce="<%=scriptNonce%>">
// Issue 52402: Verify the "loadingText" attribute for a bootstrap button() is properly encoded.
// See ClientAPITest.testBootstrapButtonEncoding
$(function () {
$('.input-test').click(function () {
let inputValue = $('#firstName').val();
$(this).data('loadingText', inputValue);
$(this).button('loading', inputValue);
});
});
</script>
5 changes: 5 additions & 0 deletions modules/simpletest/resources/views/encodeButton.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<view xmlns="http://labkey.org/data/xml/view">
<dependencies>
<dependency path="internal/jQuery" />
</dependencies>
</view>
15 changes: 15 additions & 0 deletions src/org/labkey/test/tests/ClientAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,21 @@ public void suggestedColumnsInQueryDetailsTest() throws Exception
columns.stream().noneMatch(col -> col.getName().equalsIgnoreCase("Container")));
}

@Test
public void testBootstrapButtonEncoding()
{
assumeTestModules();

beginAt(WebTestHelper.buildURL("simpletest", getProjectName(), "encodeButton"));
var buttonLocator = Locator.tagWithClass("button", "input-test");
waitForElement(buttonLocator);

// Prior to the patch for Issue 52402 clicking the button would result in a XSS injection
// which would result in an UnhandledAlertException.
click(buttonLocator);
waitForElement(Locator.buttonContainingText("<script>alert('XSS Input Success')</script><span>Loading XSS</span>"));
}

@Override
public BrowserType bestBrowser()
{
Expand Down