-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Low
-
Affects Version/s: 6.12.2, 6.13.10, 7.1.0, 7.2.1, 7.3.5, 7.4.0, 7.4.3, 7.4.4
-
Component/s: Macros - Other Macros
-
None
-
13
-
Severity 3 - Minor
-
0
Issue Summary
Code Block Macro with multiple of 1024 characters wrapped with square bracket [] is not able to be saved
Steps to Reproduce
- Edit a page in Confluence
- Insert a Code Block Macro in the page
- Paste the text below into the Code Block Macro:
[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]
There is exactly 1024 characters, including the opening and closing square bracket. This can also occur if it is a multiple of 1024 characters such as 2048. - Save or Publish the page
Expected Results
Page with the Code Block Macro can be saved without issue
Actual Results
The page cannot be saved and the error message below can be seen from the pop-up:
Unable to communicate with server. Saving is not possible at the moment.
The error stacktrace below is observed in the log:
2020-09-03 22:43:20,465 ERROR [http-nio-6740-exec-5] [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error : -- referer: http://localhost:6740/pages/resumedraft.action?draftId=8683523&draftShareId=e523b968-31c4-4f99-a818-e2cb2a0f94c1& | url: /rest/api/content/8683522 | traceId: 4702de3bc9c5e11d | userName: admin com.atlassian.confluence.api.service.exceptions.ServiceException: java.lang.RuntimeException: org.owasp.validator.html.ScanException: java.lang.ArrayIndexOutOfBoundsException: 1024 at com.atlassian.confluence.api.impl.service.content.ContentBodyConversionManagerImpl.lambda$computeConversionResources$1(ContentBodyConversionManagerImpl.java:110) at com.atlassian.confluence.api.impl.ReadOnlyAndReadWriteTransactionConversionTemplate.executeInReadWrite(ReadOnlyAndReadWriteTransactionConversionTemplate.java:65) ... Caused by: java.lang.RuntimeException: org.owasp.validator.html.ScanException: java.lang.ArrayIndexOutOfBoundsException: 1024 at com.atlassian.confluence.content.render.xhtml.PolicyConfiguredCleaner.antiSamyClean(PolicyConfiguredCleaner.java:190) at com.atlassian.confluence.content.render.xhtml.PolicyConfiguredCleaner.cleanEntityBody(PolicyConfiguredCleaner.java:140) ... Caused by: org.owasp.validator.html.ScanException: java.lang.ArrayIndexOutOfBoundsException: 1024 at org.owasp.validator.html.scan.AntiSamySAXScanner.scan(AntiSamySAXScanner.java:153) at org.owasp.validator.html.AntiSamy.scan(AntiSamy.java:101) ... Caused by: java.lang.ArrayIndexOutOfBoundsException: 1024 at com.atlassian.xhtml.serialize.AllowCDataSectionXHTMLSerializer.characters(AllowCDataSectionXHTMLSerializer.java:66) at org.apache.xalan.transformer.TransformerIdentityImpl.characters(TransformerIdentityImpl.java:1126)
Information
This issue persists regardless if the Collaborative Editing is turned On or Off
Workaround
Add or remove some characters so that the content in the Code Block Macro doesn't fulfill both of the conditions below:
- There is a multiple of 1024 characters in the macro content
- The content starts with left square bracket ( [ ) and ends with right square bracket ( ] )
- mentioned in
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...