-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ plugins { | |
} | ||
|
||
|
||
version "1.1.5" | ||
version "1.1.5.1" | ||
|
||
group "au.org.ala" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,22 @@ class SanitiserServiceSpec extends Specification implements ServiceUnitTest<Sani | |
'<p>hello <b>there</b></p> <p>How <i>are</i> you?</p>' | 'hello <b>there</b> How <i>are</i> you?' | ||
} | ||
|
||
void "text sanitisation with truncation"(String input, String output) { | ||
void "test output == sanitised(input, imageId, key)"(String input, String output) { | ||
|
||
expect: | ||
output == service.sanitise(input, '1234-1234-1234', 'creator') | ||
|
||
where: | ||
input | output | ||
'Some Guy < [email protected] >' | 'Some Guy < some.guy@example.org >' | ||
'<a href="https://hello">A</a>' | '<a href="https://hello" rel="nofollow">A</a>' | ||
'<a href="https://hello" onclick="javascript:alert(1)">A</a>'| '<a href="https://hello" rel="nofollow">A</a>' | ||
'<a href="https://hello" onclick="javascript:alert(1)">' | '<a href="https://hello" rel="nofollow"></a>' | ||
'\\<a onmouseover=alert(document.cookie)\\>xss link\\</a\\>' | '\\xss link\\' | ||
'<p>hello <b>there</b></p> <p>How <i>are</i> you?</p>' | 'hello <b>there</b> How <i>are</i> you?' | ||
} | ||
|
||
void "test sanitisation with truncation"(String input, String output) { | ||
expect: | ||
|
||
output == service.truncateAndSanitise(input, 10) | ||
|
@@ -35,4 +50,19 @@ class SanitiserServiceSpec extends Specification implements ServiceUnitTest<Sani | |
'<a href="https://example.org">hello <b>there</b> How <i>are</i> you?</a>' | '<a href="https://example.org" rel="nofollow">hello <b>t...</b></a>' | ||
'<a onmouseover=alert(document.cookie)\\>hello <b>there</b> How <i>are</i> you?</a>' | 'hello <b>t...</b>' | ||
} | ||
|
||
void "test sanitisation with truncation and context"(String input, String output) { | ||
expect: | ||
|
||
output == service.truncateAndSanitise(input, '1234-1234-1234-1234', 'creator', 10) | ||
|
||
where: | ||
input | output | ||
'\'"&&&&&&&&&&"\'' | ''"&&&&&...' | ||
'hello <b>there</b></p> <p>How <i>are</i> you?' | 'hello <b>t...</b>' | ||
'<p>hello <b>there</b></p> <p>How <i>are</i> you?</p>' | 'hello <b>t...</b>' | ||
'<p>hello <b>there</b> How <i>are</i> you?</p>' | 'hello <b>t...</b>' | ||
'<a href="https://example.org">hello <b>there</b> How <i>are</i> you?</a>' | '<a href="https://example.org" rel="nofollow">hello <b>t...</b></a>' | ||
'<a onmouseover=alert(document.cookie)\\>hello <b>there</b> How <i>are</i> you?</a>' | 'hello <b>t...</b>' | ||
} | ||
} |