File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 99
1010logger = logging .getLogger (__name__ )
1111
12+ DEFAULT_REGEXES = [
13+ ".*(?i)(api[\W_]*key).*" , # apikey and variations e.g: shub_apikey or SC_APIKEY
14+ ".*(?i)(AWS[\W_]*(SECRET[\W_]*)?(ACCESS)?[\W_]*(KEY|ACCESS[\W_]*KEY))" , # AWS_SECRET_ACCESS_KEY and variations
15+ ".*(?i)([\W_]*password[\W_]*).*" # password word
16+ ]
17+
1218
1319def prepare_for_json_serialization (obj ):
1420 """Prepare the obj recursively for JSON serialization.
@@ -52,12 +58,7 @@ def spider_closed(self, spider):
5258 if regex is not None :
5359 settings = {k : v for k , v in settings .items () if re .search (regex , k )}
5460 if spider .settings .getbool ("MASKED_SENSITIVE_SETTINGS_ENABLED" , True ):
55- default_regexes = [
56- ".*(?i)(api[\W_]*key).*" , # apikey and possible variations e.g: shub_apikey or SC_APIKEY
57- ".*(?i)(AWS[\W_]*(SECRET[\W_]*)?(ACCESS)?[\W_]*(KEY|ACCESS[\W_]*KEY))" , # AWS_SECRET_ACCESS_KEY and possible variations
58- ".*(?i)([\W_]*password[\W_]*).*" # password word
59- ]
60- regex_list = spider .settings .getlist ("MASKED_SENSITIVE_SETTINGS_REGEX_LIST" , default_regexes )
61+ regex_list = spider .settings .getlist ("MASKED_SENSITIVE_SETTINGS_REGEX_LIST" , DEFAULT_REGEXES )
6162 for reg in regex_list :
6263 updated_settings = {k : '**********' if v else v for k , v in settings .items () if re .match (reg , k )}
6364 settings = {** settings , ** updated_settings }
You can’t perform that action at this time.
0 commit comments