File tree Expand file tree Collapse file tree
modules/simpletest/resources/views
src/org/labkey/test/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ < input id ="firstName " type ="text " value ="<script>alert('XSS Input Success')</script><span>Loading XSS</span> " />
2+ < button class ="btn btn-primary input-test " data-loading-text ="<span>I'm Loading</span> " type ="button ">
3+ Attempt XSS injection
4+ </ button >
5+ < script type ="text/javascript " nonce ="<%=scriptNonce%> ">
6+ // Issue 52402: Verify the "loadingText" attribute for a bootstrap button() is properly encoded.
7+ // See ClientAPITest.testBootstrapButtonEncoding
8+ $ ( function ( ) {
9+ $ ( '.input-test' ) . click ( function ( ) {
10+ let inputValue = $ ( '#firstName' ) . val ( ) ;
11+ $ ( this ) . data ( 'loadingText' , inputValue ) ;
12+ $ ( this ) . button ( 'loading' , inputValue ) ;
13+ } ) ;
14+ } ) ;
15+ </ script >
Original file line number Diff line number Diff line change 1+ <view xmlns =" http://labkey.org/data/xml/view" >
2+ <dependencies >
3+ <dependency path =" internal/jQuery" />
4+ </dependencies >
5+ </view >
Original file line number Diff line number Diff line change @@ -1546,6 +1546,21 @@ public void suggestedColumnsInQueryDetailsTest() throws Exception
15461546 columns .stream ().noneMatch (col -> col .getName ().equalsIgnoreCase ("Container" )));
15471547 }
15481548
1549+ @ Test
1550+ public void testBootstrapButtonEncoding ()
1551+ {
1552+ assumeTestModules ();
1553+
1554+ beginAt (WebTestHelper .buildURL ("simpletest" , getProjectName (), "encodeButton" ));
1555+ var buttonLocator = Locator .tagWithClass ("button" , "input-test" );
1556+ waitForElement (buttonLocator );
1557+
1558+ // Prior to the patch for Issue 52402 clicking the button would result in a XSS injection
1559+ // which would result in an UnhandledAlertException.
1560+ click (buttonLocator );
1561+ waitForElement (Locator .buttonContainingText ("<script>alert('XSS Input Success')</script><span>Loading XSS</span>" ));
1562+ }
1563+
15491564 @ Override
15501565 public BrowserType bestBrowser ()
15511566 {
You can’t perform that action at this time.
0 commit comments