# along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging
+import validators
import bs4
elif block["severity"] in ["accept", "accepted"]:
logger.debug("block[domain]='%s' has unwanted severity level '%s' - SKIPPED!", block["domain"], block["severity"])
continue
+ elif "digest" in block and validators.hashes.sha256(block["digest"]):
+ logger.warning("block[domain]='%s' has invalid block[digest]='%s' - SKIPPED!", block["domain"], block["digest"])
+ continue
reason = tidyup.reason(block["comment"]) if "comment" in block and block["comment"] is not None and block["comment"] != "" else None
blocklist.append({
"blocker" : domain,
"blocked" : block["domain"],
- "hash" : block["digest"],
+ "hash" : block["digest"] if "digest" in block else None,
"reason" : reason,
"block_level": blocks.alias_block_level(block["severity"]),
})