Skip to content

Commit

Permalink
#153 Ignore 'javascript:' URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
ascheman committed Aug 21, 2024
1 parent 950e35c commit 65fc198
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ public static boolean isRemoteURL(String imgSrc) {
|| startsWithIP(imgSrc);
}

public static boolean isVirtualURL(String resource) {
return resource.startsWith("javascript:");
}

/**
* Checks if this String represents a data-image-URI
Expand Down Expand Up @@ -211,6 +214,7 @@ public static boolean isLocalResource(String link) {
|| (link.isEmpty())
|| isCrossReference(link) // "#link" or similar
|| isRemoteURL(link) // "mailto:", "http" etc
|| isVirtualURL(link) // "javascript:" ...
) {
return false;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class WebSpec extends Specification {

false | "10.0.0.1/index.html" // this is a valid REMOTE address, defaults to http or https

false | "javascript:dummy"
}

@Unroll
Expand Down Expand Up @@ -142,7 +143,5 @@ class WebSpec extends Specification {
false | "1.2.3"
false | "1.2"
false | "110"


}
}

0 comments on commit 65fc198

Please sign in to comment.