@@ -64,6 +64,7 @@ def __init__(self):
64
64
self .has_unsafe_eval = False
65
65
self .has_unsafe_hashes = False
66
66
self .has_http = False
67
+ self .has_bare_https = False
67
68
self .has_data = False
68
69
self .has_base_uri = False
69
70
self .has_form_action = False
@@ -78,6 +79,7 @@ def failures(self):
78
79
"has_unsafe_inline" ,
79
80
"has_unsafe_eval" ,
80
81
"has_http" ,
82
+ "has_bare_https" ,
81
83
"has_data" ,
82
84
"has_invalid_host" ,
83
85
"has_unsafe_hashes" ,
@@ -110,6 +112,7 @@ def __str__(self):
110
112
f"has_unsafe_eval: { self .has_unsafe_eval } \n "
111
113
f"has_unsafe_hashes: { self .has_unsafe_hashes } \n "
112
114
f"has_http: { self .has_http } \n "
115
+ f"has_bare_https: { self .has_bare_https } \n "
113
116
f"has_data: { self .has_data } \n "
114
117
f"has_base_uri: { self .has_base_uri } \n "
115
118
f"has_form_action: { self .has_form_action } \n "
@@ -125,7 +128,7 @@ def __str__(self):
125
128
host_source_regex = re .compile (
126
129
r"^(?:(?P<scheme>.+)://)?" r"(?P<host>[^:/']+|\[.+\])" r"(?::(?P<port>\d+|\*))?" r"(?P<path>\/.*)?$"
127
130
)
128
- scheme_source_regex = re .compile (r"^(?P<scheme >https?|data|mediastream|blob|filesystem):$" )
131
+ scheme_source_regex = re .compile (r"^(?P<scheme_source >https?|data|mediastream|blob|filesystem):$" )
129
132
self_none_regex = re .compile (r"^(?:(?P<self>'self')|(?P<none>'none'))$" )
130
133
other_source_regex = re .compile (
131
134
r"(?:"
@@ -356,8 +359,6 @@ def _check_none_self_similar(self, domain, directive: str):
356
359
found_self = True
357
360
elif "report_sample" in match .groupdict () and match .group ("report_sample" ):
358
361
expected_sources += 1
359
- elif "scheme" in match .groupdict () and match .group ("scheme" ) and match .string == "https:" :
360
- expected_sources += 1
361
362
elif "host" in match .groupdict () and match .group ("host" ):
362
363
expected_sources += 1
363
364
host = match .group ("host" ).rstrip ("." )
@@ -392,9 +393,10 @@ def _check_none_self_similar(self, domain, directive: str):
392
393
return False
393
394
394
395
def _verdict (self , domain ):
395
- self .result .has_http = self ._check_matched_for_groups (dict (scheme = ["http" , "*" ]))
396
+ self .result .has_http = self ._check_matched_for_groups (dict (scheme = ["http" , "*" ], scheme_source = ["http" , "*" ]))
397
+ self .result .has_bare_https = self ._check_matched_for_groups (dict (scheme_source = ["https" ]))
396
398
self .result .has_data = self ._check_matched_for_groups (
397
- dict (scheme = ["data" , "*" ]), directives = ["object-src" , "script-src" ]
399
+ dict (scheme_source = ["data" , "*" ]), directives = ["object-src" , "script-src" ]
398
400
)
399
401
self .result .has_invalid_host = self ._check_matched_for_groups (dict (host = ["*" , "127.0.0.1" ]))
400
402
self .result .has_unsafe_inline = self ._check_matched_for_groups (dict (unsafe_inline = []))
0 commit comments