mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
[TEST] Add html found during testing to cause problems for the sanitizer.
This change adds a html string that was found to cause problems for the sanitizer during testing. Original commit: elastic/x-pack-elasticsearch@275e728674
This commit is contained in:
parent
bc78dd36c9
commit
d95e068a77
@ -66,5 +66,12 @@ public class HtmlSanitizeTests extends ElasticsearchTestCase {
|
||||
assertThat(sanitizedHtml, equalTo("This was a dangerous script"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_HtmlSanitizer_FullHtmlWithMetaString() {
|
||||
String needsSanitation = "<html><head></head><body><h1>Hello {{ctx.metadata.name}}</h1> meta <a href='https://www.google.com/search?q={{ctx.metadata.name}}'>Testlink</a>meta</body></html>";
|
||||
byte[] bytes = new byte[0];
|
||||
String sanitizedHtml = Profile.sanitizeHtml(ImmutableMap.of("foo", (Attachment) new Attachment.Bytes("foo", bytes, "")), needsSanitation);
|
||||
assertThat(sanitizedHtml, equalTo("<head></head><body><h1>Hello {{ctx.metadata.name}}</h1> meta <a href=\"https://www.google.com/search?q={{ctx.metadata.name}}\" rel=\"nofollow\">Testlink</a>meta</body>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user