{"action":"created","comment":{"url":"https://api.github.com/repos/shapesecurity/salvation/pulls/comments/87933010","pull_request_review_id":8522699,"id":87933010,"diff_hunk":"@@ -59,40 +59,51 @@ public boolean isWildcard() {\n         return this.host.equals(\"*\") && this.scheme == null && this.port == Constants.EMPTY_PORT && this.path == null;\n     }\n \n-    @Override public boolean matchesSource(@Nonnull Origin origin, @Nonnull URI source) {\n-        if (!(origin instanceof SchemeHostPortTriple)) {\n+    @Override public boolean matchesSource(@Nonnull Origin origin, @Nonnull URI resource) {\n+        if (origin instanceof GUID) {\n+            if (this.isWildcard()) {\n+                // the scheme is a network scheme or the same scheme as the origin\n+                return resource.isNetworkScheme() || (origin).equals(resource.scheme);\n+            }\n+        } else if (!(origin instanceof SchemeHostPortTriple)) {\n             return false;\n         }\n         SchemeHostPortTriple shpOrigin = (SchemeHostPortTriple) origin;\n         if (this.isWildcard()) {\n-            return true;\n+            // the scheme is a network scheme or the same scheme as the origin\n+            return resource.isNetworkScheme() || shpOrigin.scheme.matches(resource.scheme);\n         }\n         boolean schemeMatches;\n         if (this.scheme == null) {\n-            schemeMatches = source.scheme.equalsIgnoreCase(\"http\") ?\n+            schemeMatches = resource.scheme.equalsIgnoreCase(\"http\") ?\n                 shpOrigin.scheme.equalsIgnoreCase(\"http\") || shpOrigin.scheme.equalsIgnoreCase(\"https\") :\n-                source.scheme.equalsIgnoreCase(shpOrigin.scheme);\n+                resource.scheme.equalsIgnoreCase(shpOrigin.scheme);\n         } else {\n-            schemeMatches = this.scheme.equalsIgnoreCase(source.scheme);\n+            schemeMatches = this.scheme.equalsIgnoreCase(resource.scheme);\n         }\n         boolean hostMatches = this.host.equals(\"*\") || (this.host.startsWith(\"*.\") ?\n-            source.host.toLowerCase().endsWith(this.host.substring(1).toLowerCase()) :\n-            this.host.equalsIgnoreCase(source.host));\n-        boolean uriUsesDefaultPort = source.port == Constants.EMPTY_PORT\n-            || SchemeHostPortTriple.defaultPortForProtocol(source.scheme) == source.port;\n+            resource.host.toLowerCase().endsWith(this.host.substring(1).toLowerCase()) :\n+            this.host.equalsIgnoreCase(resource.host));\n+        boolean uriUsesDefaultPort = resource.port == Constants.EMPTY_PORT\n+            || SchemeHostPortTriple.defaultPortForProtocol(resource.scheme) == resource.port;\n         boolean thisUsesDefaultPort = this.scheme != null && (this.port == Constants.EMPTY_PORT\n             || SchemeHostPortTriple.defaultPortForProtocol(this.scheme) == this.port);\n         boolean portMatches = this.port == Constants.WILDCARD_PORT || (this.port == Constants.EMPTY_PORT ?\n             uriUsesDefaultPort :\n-            (source.port == Constants.EMPTY_PORT ? thisUsesDefaultPort : this.port == source.port));\n+            (resource.port == Constants.EMPTY_PORT ? thisUsesDefaultPort : this.port == resource.port));\n         boolean pathMatches = this.path == null || (this.path.endsWith(\"/\") ?\n-            source.path.startsWith(this.path) :\n-            this.path.equals(source.path));\n+            resource.path.startsWith(this.path) :\n+            this.path.equals(resource.path));\n         return schemeMatches && hostMatches && portMatches && pathMatches;\n     }\n \n-    @Override public boolean matchesSource(@Nonnull Origin origin, @Nonnull GUID source) {\n-        return false;\n+    @Override public boolean matchesSource(@Nonnull Origin origin, @Nonnull GUID resource) {\n+        /* if resource starts with data: and origin starts with data:, match */","path":"src/main/java/com/shapesecurity/salvation/directiveValues/HostSource.java","position":58,"original_position":58,"commit_id":"8141da9b07f75d5a64dcf6f37e221aa25d435a95","original_commit_id":"8141da9b07f75d5a64dcf6f37e221aa25d435a95","user":{"login":"michaelficarra","id":218840,"avatar_url":"https://avatars.githubusercontent.com/u/218840?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelficarra","html_url":"https://github.com/michaelficarra","followers_url":"https://api.github.com/users/michaelficarra/followers","following_url":"https://api.github.com/users/michaelficarra/following{/other_user}","gists_url":"https://api.github.com/users/michaelficarra/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelficarra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelficarra/subscriptions","organizations_url":"https://api.github.com/users/michaelficarra/orgs","repos_url":"https://api.github.com/users/michaelficarra/repos","events_url":"https://api.github.com/users/michaelficarra/events{/privacy}","received_events_url":"https://api.github.com/users/michaelficarra/received_events","type":"User","site_admin":false},"body":"No longer need this comment.","created_at":"2016-11-15T01:39:09Z","updated_at":"2016-11-15T01:41:29Z","html_url":"https://github.com/shapesecurity/salvation/pull/157#discussion_r87933010","pull_request_url":"https://api.github.com/repos/shapesecurity/salvation/pulls/157","_links":{"self":{"href":"https://api.github.com/repos/shapesecurity/salvation/pulls/comments/87933010"},"html":{"href":"https://github.com/shapesecurity/salvation/pull/157#discussion_r87933010"},"pull_request":{"href":"https://api.github.com/repos/shapesecurity/salvation/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/shapesecurity/salvation/pulls/157","id":92724873,"html_url":"https://github.com/shapesecurity/salvation/pull/157","diff_url":"https://github.com/shapesecurity/salvation/pull/157.diff","patch_url":"https://github.com/shapesecurity/salvation/pull/157.patch","issue_url":"https://api.github.com/repos/shapesecurity/salvation/issues/157","number":157,"state":"open","locked":false,"title":"fixes GH-155: Allow \"*\" to match scheme of protected resource","user":{"login":"shekyan","id":1631049,"avatar_url":"https://avatars.githubusercontent.com/u/1631049?v=3","gravatar_id":"","url":"https://api.github.com/users/shekyan","html_url":"https://github.com/shekyan","followers_url":"https://api.github.com/users/shekyan/followers","following_url":"https://api.github.com/users/shekyan/following{/other_user}","gists_url":"https://api.github.com/users/shekyan/gists{/gist_id}","starred_url":"https://api.github.com/users/shekyan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shekyan/subscriptions","organizations_url":"https://api.github.com/users/shekyan/orgs","repos_url":"https://api.github.com/users/shekyan/repos","events_url":"https://api.github.com/users/shekyan/events{/privacy}","received_events_url":"https://api.github.com/users/shekyan/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-08T06:59:49Z","updated_at":"2016-11-15T01:41:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"47dfb37e54953be4a63de5e2136f40aab51c9b27","assignee":{"login":"michaelficarra","id":218840,"avatar_url":"https://avatars.githubusercontent.com/u/218840?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelficarra","html_url":"https://github.com/michaelficarra","followers_url":"https://api.github.com/users/michaelficarra/followers","following_url":"https://api.github.com/users/michaelficarra/following{/other_user}","gists_url":"https://api.github.com/users/michaelficarra/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelficarra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelficarra/subscriptions","organizations_url":"https://api.github.com/users/michaelficarra/orgs","repos_url":"https://api.github.com/users/michaelficarra/repos","events_url":"https://api.github.com/users/michaelficarra/events{/privacy}","received_events_url":"https://api.github.com/users/michaelficarra/received_events","type":"User","site_admin":false},"assignees":[{"login":"michaelficarra","id":218840,"avatar_url":"https://avatars.githubusercontent.com/u/218840?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelficarra","html_url":"https://github.com/michaelficarra","followers_url":"https://api.github.com/users/michaelficarra/followers","following_url":"https://api.github.com/users/michaelficarra/following{/other_user}","gists_url":"https://api.github.com/users/michaelficarra/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelficarra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelficarra/subscriptions","organizations_url":"https://api.github.com/users/michaelficarra/orgs","repos_url":"https://api.github.com/users/michaelficarra/repos","events_url":"https://api.github.com/users/michaelficarra/events{/privacy}","received_events_url":"https://api.github.com/users/michaelficarra/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/shapesecurity/salvation/pulls/157/commits","review_comments_url":"https://api.github.com/repos/shapesecurity/salvation/pulls/157/comments","review_comment_url":"https://api.github.com/repos/shapesecurity/salvation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shapesecurity/salvation/issues/157/comments","statuses_url":"https://api.github.com/repos/shapesecurity/salvation/statuses/8141da9b07f75d5a64dcf6f37e221aa25d435a95","head":{"label":"shapesecurity:GH-155","ref":"GH-155","sha":"8141da9b07f75d5a64dcf6f37e221aa25d435a95","user":{"login":"shapesecurity","id":7728313,"avatar_url":"https://avatars.githubusercontent.com/u/7728313?v=3","gravatar_id":"","url":"https://api.github.com/users/shapesecurity","html_url":"https://github.com/shapesecurity","followers_url":"https://api.github.com/users/shapesecurity/followers","following_url":"https://api.github.com/users/shapesecurity/following{/other_user}","gists_url":"https://api.github.com/users/shapesecurity/gists{/gist_id}","starred_url":"https://api.github.com/users/shapesecurity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shapesecurity/subscriptions","organizations_url":"https://api.github.com/users/shapesecurity/orgs","repos_url":"https://api.github.com/users/shapesecurity/repos","events_url":"https://api.github.com/users/shapesecurity/events{/privacy}","received_events_url":"https://api.github.com/users/shapesecurity/received_events","type":"Organization","site_admin":false},"repo":{"id":35701371,"name":"salvation","full_name":"shapesecurity/salvation","owner":{"login":"shapesecurity","id":7728313,"avatar_url":"https://avatars.githubusercontent.com/u/7728313?v=3","gravatar_id":"","url":"https://api.github.com/users/shapesecurity","html_url":"https://github.com/shapesecurity","followers_url":"https://api.github.com/users/shapesecurity/followers","following_url":"https://api.github.com/users/shapesecurity/following{/other_user}","gists_url":"https://api.github.com/users/shapesecurity/gists{/gist_id}","starred_url":"https://api.github.com/users/shapesecurity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shapesecurity/subscriptions","organizations_url":"https://api.github.com/users/shapesecurity/orgs","repos_url":"https://api.github.com/users/shapesecurity/repos","events_url":"https://api.github.com/users/shapesecurity/events{/privacy}","received_events_url":"https://api.github.com/users/shapesecurity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shapesecurity/salvation","description":"Parse Content Security Policy headers, warn about policy errors, safely manipulate, render, and optimise policies","fork":false,"url":"https://api.github.com/repos/shapesecurity/salvation","forks_url":"https://api.github.com/repos/shapesecurity/salvation/forks","keys_url":"https://api.github.com/repos/shapesecurity/salvation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shapesecurity/salvation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shapesecurity/salvation/teams","hooks_url":"https://api.github.com/repos/shapesecurity/salvation/hooks","issue_events_url":"https://api.github.com/repos/shapesecurity/salvation/issues/events{/number}","events_url":"https://api.github.com/repos/shapesecurity/salvation/events","assignees_url":"https://api.github.com/repos/shapesecurity/salvation/assignees{/user}","branches_url":"https://api.github.com/repos/shapesecurity/salvation/branches{/branch}","tags_url":"https://api.github.com/repos/shapesecurity/salvation/tags","blobs_url":"https://api.github.com/repos/shapesecurity/salvation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shapesecurity/salvation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shapesecurity/salvation/git/refs{/sha}","trees_url":"https://api.github.com/repos/shapesecurity/salvation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shapesecurity/salvation/statuses/{sha}","languages_url":"https://api.github.com/repos/shapesecurity/salvation/languages","stargazers_url":"https://api.github.com/repos/shapesecurity/salvation/stargazers","contributors_url":"https://api.github.com/repos/shapesecurity/salvation/contributors","subscribers_url":"https://api.github.com/repos/shapesecurity/salvation/subscribers","subscription_url":"https://api.github.com/repos/shapesecurity/salvation/subscription","commits_url":"https://api.github.com/repos/shapesecurity/salvation/commits{/sha}","git_commits_url":"https://api.github.com/repos/shapesecurity/salvation/git/commits{/sha}","comments_url":"https://api.github.com/repos/shapesecurity/salvation/comments{/number}","issue_comment_url":"https://api.github.com/repos/shapesecurity/salvation/issues/comments{/number}","contents_url":"https://api.github.com/repos/shapesecurity/salvation/contents/{+path}","compare_url":"https://api.github.com/repos/shapesecurity/salvation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shapesecurity/salvation/merges","archive_url":"https://api.github.com/repos/shapesecurity/salvation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shapesecurity/salvation/downloads","issues_url":"https://api.github.com/repos/shapesecurity/salvation/issues{/number}","pulls_url":"https://api.github.com/repos/shapesecurity/salvation/pulls{/number}","milestones_url":"https://api.github.com/repos/shapesecurity/salvation/milestones{/number}","notifications_url":"https://api.github.com/repos/shapesecurity/salvation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shapesecurity/salvation/labels{/name}","releases_url":"https://api.github.com/repos/shapesecurity/salvation/releases{/id}","deployments_url":"https://api.github.com/repos/shapesecurity/salvation/deployments","created_at":"2015-05-15T23:14:49Z","updated_at":"2016-08-31T12:30:27Z","pushed_at":"2016-11-14T23:59:57Z","git_url":"git://github.com/shapesecurity/salvation.git","ssh_url":"git@github.com:shapesecurity/salvation.git","clone_url":"https://github.com/shapesecurity/salvation.git","svn_url":"https://github.com/shapesecurity/salvation","homepage":"http://cspvalidator.org","size":790,"stargazers_count":27,"watchers_count":27,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":10,"forks":8,"open_issues":10,"watchers":27,"default_branch":"master"}},"base":{"label":"shapesecurity:master","ref":"master","sha":"732788ea211b6d93917028f1c70def846f247fd0","user":{"login":"shapesecurity","id":7728313,"avatar_url":"https://avatars.githubusercontent.com/u/7728313?v=3","gravatar_id":"","url":"https://api.github.com/users/shapesecurity","html_url":"https://github.com/shapesecurity","followers_url":"https://api.github.com/users/shapesecurity/followers","following_url":"https://api.github.com/users/shapesecurity/following{/other_user}","gists_url":"https://api.github.com/users/shapesecurity/gists{/gist_id}","starred_url":"https://api.github.com/users/shapesecurity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shapesecurity/subscriptions","organizations_url":"https://api.github.com/users/shapesecurity/orgs","repos_url":"https://api.github.com/users/shapesecurity/repos","events_url":"https://api.github.com/users/shapesecurity/events{/privacy}","received_events_url":"https://api.github.com/users/shapesecurity/received_events","type":"Organization","site_admin":false},"repo":{"id":35701371,"name":"salvation","full_name":"shapesecurity/salvation","owner":{"login":"shapesecurity","id":7728313,"avatar_url":"https://avatars.githubusercontent.com/u/7728313?v=3","gravatar_id":"","url":"https://api.github.com/users/shapesecurity","html_url":"https://github.com/shapesecurity","followers_url":"https://api.github.com/users/shapesecurity/followers","following_url":"https://api.github.com/users/shapesecurity/following{/other_user}","gists_url":"https://api.github.com/users/shapesecurity/gists{/gist_id}","starred_url":"https://api.github.com/users/shapesecurity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shapesecurity/subscriptions","organizations_url":"https://api.github.com/users/shapesecurity/orgs","repos_url":"https://api.github.com/users/shapesecurity/repos","events_url":"https://api.github.com/users/shapesecurity/events{/privacy}","received_events_url":"https://api.github.com/users/shapesecurity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shapesecurity/salvation","description":"Parse Content Security Policy headers, warn about policy errors, safely manipulate, render, and optimise policies","fork":false,"url":"https://api.github.com/repos/shapesecurity/salvation","forks_url":"https://api.github.com/repos/shapesecurity/salvation/forks","keys_url":"https://api.github.com/repos/shapesecurity/salvation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shapesecurity/salvation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shapesecurity/salvation/teams","hooks_url":"https://api.github.com/repos/shapesecurity/salvation/hooks","issue_events_url":"https://api.github.com/repos/shapesecurity/salvation/issues/events{/number}","events_url":"https://api.github.com/repos/shapesecurity/salvation/events","assignees_url":"https://api.github.com/repos/shapesecurity/salvation/assignees{/user}","branches_url":"https://api.github.com/repos/shapesecurity/salvation/branches{/branch}","tags_url":"https://api.github.com/repos/shapesecurity/salvation/tags","blobs_url":"https://api.github.com/repos/shapesecurity/salvation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shapesecurity/salvation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shapesecurity/salvation/git/refs{/sha}","trees_url":"https://api.github.com/repos/shapesecurity/salvation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shapesecurity/salvation/statuses/{sha}","languages_url":"https://api.github.com/repos/shapesecurity/salvation/languages","stargazers_url":"https://api.github.com/repos/shapesecurity/salvation/stargazers","contributors_url":"https://api.github.com/repos/shapesecurity/salvation/contributors","subscribers_url":"https://api.github.com/repos/shapesecurity/salvation/subscribers","subscription_url":"https://api.github.com/repos/shapesecurity/salvation/subscription","commits_url":"https://api.github.com/repos/shapesecurity/salvation/commits{/sha}","git_commits_url":"https://api.github.com/repos/shapesecurity/salvation/git/commits{/sha}","comments_url":"https://api.github.com/repos/shapesecurity/salvation/comments{/number}","issue_comment_url":"https://api.github.com/repos/shapesecurity/salvation/issues/comments{/number}","contents_url":"https://api.github.com/repos/shapesecurity/salvation/contents/{+path}","compare_url":"https://api.github.com/repos/shapesecurity/salvation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shapesecurity/salvation/merges","archive_url":"https://api.github.com/repos/shapesecurity/salvation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shapesecurity/salvation/downloads","issues_url":"https://api.github.com/repos/shapesecurity/salvation/issues{/number}","pulls_url":"https://api.github.com/repos/shapesecurity/salvation/pulls{/number}","milestones_url":"https://api.github.com/repos/shapesecurity/salvation/milestones{/number}","notifications_url":"https://api.github.com/repos/shapesecurity/salvation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shapesecurity/salvation/labels{/name}","releases_url":"https://api.github.com/repos/shapesecurity/salvation/releases{/id}","deployments_url":"https://api.github.com/repos/shapesecurity/salvation/deployments","created_at":"2015-05-15T23:14:49Z","updated_at":"2016-08-31T12:30:27Z","pushed_at":"2016-11-14T23:59:57Z","git_url":"git://github.com/shapesecurity/salvation.git","ssh_url":"git@github.com:shapesecurity/salvation.git","clone_url":"https://github.com/shapesecurity/salvation.git","svn_url":"https://github.com/shapesecurity/salvation","homepage":"http://cspvalidator.org","size":790,"stargazers_count":27,"watchers_count":27,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":10,"forks":8,"open_issues":10,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shapesecurity/salvation/pulls/157"},"html":{"href":"https://github.com/shapesecurity/salvation/pull/157"},"issue":{"href":"https://api.github.com/repos/shapesecurity/salvation/issues/157"},"comments":{"href":"https://api.github.com/repos/shapesecurity/salvation/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/shapesecurity/salvation/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/shapesecurity/salvation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shapesecurity/salvation/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/shapesecurity/salvation/statuses/8141da9b07f75d5a64dcf6f37e221aa25d435a95"}}}}
{"actor":{"display_login":"michaelficarra"}}