Skip to content

Commit ce73bd4

Browse files
author
Romain GUINOT
committed
0.56:
- prevent a form a stored XSS in the stored audit values. Addresses GitHub issue #7. - replaced the use of the YUI compressor ant task by a call to the jar directly as the ant task seems to be incompatible with current underlying dependencies - fixed a small unrelated typo - no new features
1 parent f040741 commit ce73bd4

File tree

7 files changed

+29
-8
lines changed

7 files changed

+29
-8
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ Some sample screenshots with different configurations are included below :
174174
Changelog
175175
---------
176176

177+
0.56:
178+
179+
- prevent a form a stored XSS in the stored audit values. Addresses GitHub issue #7.
180+
- replaced the use of the YUI compressor ant task by a call to the jar directly as the ant task seems to be incompatible with current underlying dependencies
181+
- fixed a small unrelated typo
182+
- no new features
183+
177184
0.55:
178185

179186
- switched back to using the previous, alfresco-provided, JSON parsing utility rather than JSON.parse, which is not available in all supported versions for this dashlet (issue #5).

build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
build.version=0.55
1+
build.version=0.56
22
project.name=audit-dashlet
33
jar.name=${project.name}-${build.version}.jar

build.xml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
<property name="build.zip.dir" value="${build.dir}/war" />
7070
<property name="build.amp.dir" value="${build.dir}/amp" />
7171
<property name="dist.dir" value="${basedir}/dist" />
72+
<property name="js.dashlet.dir" value="extras/components/dashlets" />
7273
<property name="amp.file.properties" value="module.properties" />
7374
<property name="amp.file.mappings" value="file-mapping.properties" />
7475

@@ -86,7 +87,7 @@
8687

8788
<path id="yuicompressor.classpath">
8889
<fileset dir="lib">
89-
<include name="yuicompressor-2.4.7.jar"/>
90+
<include name="yuicompressor-2.4.8-alfresco-patched.jar"/>
9091
<include name="yui-compressor-ant-task-0.5.jar"/>
9192
</fileset>
9293
</path>
@@ -173,10 +174,19 @@
173174
<filename name="share-config-custom.xml" />
174175
</fileset>
175176
</copy>
176-
<!-- Minify JS -->
177-
<yuicompress fromdir="${res.dir}" todir="${build.jar.dir}/META-INF" excludes="**/*-min.js" warn="${yuicompress.warn}">
177+
178+
<!-- Minify JS ant task : commented out as the ant task is no longer maintained and not compatible with current underlying rhino version -->
179+
<!--yuicompress fromdir="${res.dir}" todir="${build.jar.dir}/META-INF" excludes="**/*-min.js" warn="${yuicompress.warn}">
178180
<include name="**/*.js" />
179-
</yuicompress>
181+
</yuicompress-->
182+
183+
<!-- Minify JS by calling the compressor directly -->
184+
<echo message="Calling YUI Compressor"/>
185+
<java jar="${basedir}/lib/yuicompressor-2.4.8-alfresco-patched.jar" fork="true" failonerror="true">
186+
<arg value="${res.dir}/${js.dashlet.dir}/audit-application.js"/>
187+
<arg value="-o"/>
188+
<arg value="${build.jar.dir}/META-INF/${js.dashlet.dir}/audit-application-min.js"/>
189+
</java>
180190

181191
<jar destfile="${dist.dir}/${jar.name}">
182192
<fileset dir="${build.jar.dir}" />
@@ -446,4 +456,4 @@
446456
</target>
447457
-->
448458

449-
</project>
459+
</project>

config/alfresco/site-webscripts/org/sharextras/components/dashlets/audit-application-data.get.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ function main()
8181
var escaped_response = json_requoted_response.replace(/(\n|\r\n|\r)/g, " ");
8282
//if (logger.isLoggingEnabled()) logger.log("escaped_response:\n"+escaped_response);
8383

84-
var auditresponse = jsonUtils.toObject(escaped_response);
84+
// prevents some form of stored XSS by preventing HTML tags from being interpreted as part of the stored audit values. addresses GitHub issue #7.
85+
var xss_replacements_response = escaped_response.replace(/</g, "&lt;").replace(/\>/g, "&gt;");
86+
//if (logger.isLoggingEnabled()) logger.log("xss_replacements_response:\n"+xss_replacements_response);
87+
88+
var auditresponse = jsonUtils.toObject(xss_replacements_response);
8589
model.auditresponse = auditresponse;
8690
model.jsonResp = result.response;
8791
}

lib/yuicompressor-2.4.7.jar

-870 KB
Binary file not shown.
784 KB
Binary file not shown.

source/web/extras/components/dashlets/audit-application.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ if (typeof Extras.dashlet == "undefined" || !Extras.dashlet)
926926

927927
}
928928

929-
// all this additional highlighting work is unncessary if we're looking for negated matches,
929+
// all this additional highlighting work is unnecessary if we're looking for negated matches,
930930
// as there will be no highlighting for those
931931
if (!negation_predicate_present)
932932
{

0 commit comments

Comments
 (0)