Implement obfuscation

This commit is contained in:
2022-08-26 20:44:39 +01:00
parent 5c12f651c8
commit ae25e1980e
4 changed files with 60 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ from core.views.helpers import (
encrypt_list,
hash_list,
hash_lookup,
obfuscate_list,
)
# from json import dumps
@@ -139,7 +140,7 @@ def filter_blacklisted(user, response):
# Just set it to none so the index is not off
response["hits"]["hits"][index] = None
else:
if not user.is_superuser:
if not user.has_perm("core.bypass_blacklist"):
response["hits"]["hits"][index] = None
else:
response["hits"]["hits"][index][data_index][
@@ -526,9 +527,12 @@ def query_results(
if settings.ENCRYPTION:
encrypt_list(request.user, results_parsed, settings.ENCRYPTION_KEY)
if not request.user.has_perm("view_plain"):
if settings.HASHING:
hash_list(request.user, results_parsed)
if settings.HASHING:
hash_list(request.user, results_parsed)
if settings.OBFUSCATION:
obfuscate_list(request.user, results_parsed)
# process_list(reqults)
# IMPORTANT! - DO NOT PASS query_params to the user!