diff --git a/core/src/main/java/hudson/markup/MyspacePolicy.java b/core/src/main/java/hudson/markup/MyspacePolicy.java
index 2e6bc107f8..f0543f9538 100644
--- a/core/src/main/java/hudson/markup/MyspacePolicy.java
+++ b/core/src/main/java/hudson/markup/MyspacePolicy.java
@@ -58,7 +58,7 @@ public class MyspacePolicy {
tag("select", "multiple");
tag("option", "value","label","selected");
tag("textarea");
- tag("h1,h2,h3,h4,h5,h6,p,i,b,u,strong,em,small,big,pre,code,cite,samp,sub,sup,strike,center,lockquote");
+ tag("h1,h2,h3,h4,h5,h6,p,i,b,u,strong,em,small,big,pre,code,cite,samp,sub,sup,strike,center,blockquote");
tag("hr,br,col");
tag("font", "color", "face", "size");
tag("a", "nohref","rel");
@@ -66,6 +66,7 @@ public class MyspacePolicy {
tag("span,div");
tag("img", "src",ONSITE_OR_OFFSITE_URL,
"hspace","vspace");
+ tag("iframe", "src");
tag("link", "type","rel");
tag("ul,ol,li,dd,dl,dt,thead,tbody,tfoot");
tag("table", "noresize");
@@ -73,12 +74,13 @@ public class MyspacePolicy {
tag("colgroup", "span");
tag("col", "span");
tag("fieldset,legend");
+ allowStandardUrlProtocols();
}}.toFactory();
}
public static void main(String[] args) throws IOException {
// Fetch the HTML to sanitize.
- String html = "
";
+ String html = "Google";
// Set up an output channel to receive the sanitized HTML.
HtmlStreamRenderer renderer = HtmlStreamRenderer.create(
System.out,
diff --git a/core/src/test/java/hudson/markup/MyspacePolicyTest.java b/core/src/test/java/hudson/markup/MyspacePolicyTest.java
new file mode 100644
index 0000000000..cb1a63e2bb
--- /dev/null
+++ b/core/src/test/java/hudson/markup/MyspacePolicyTest.java
@@ -0,0 +1,88 @@
+package hudson.markup;
+
+import com.google.common.base.Throwables;
+import org.junit.Assert;
+import org.junit.Test;
+import org.owasp.html.Handler;
+import org.owasp.html.HtmlSanitizer;
+import org.owasp.html.HtmlStreamRenderer;
+
+import java.io.IOException;
+
+/**
+ * @author Kohsuke Kawaguchi
+ */
+public class MyspacePolicyTest extends Assert {
+ @Test
+ public void testPolicy() {
+ assertIntact("CB");
+ assertIntact("relative");
+ assertIntact("myself");
+ assertReject("javascript","test");
+
+ assertIntact("
");
+ assertIntact("
");
+ assertIntact("
");
+ assertReject("javascript","");
+
+ assertIntact("
basic tag");
+ assertIntact("
basic block tags
| header |
|---|
| something |
blurb"); + + assertIntact(""); + assertIntact(""); + assertReject("javascript",""); + + assertReject("script",""); + assertReject("script",""); + assertReject("script",""); + + assertIntact(""); + assertIntact(""); + assertIntact("