diff --git a/src/researchhub/settings.py b/src/researchhub/settings.py index d93e8c412..937fe6476 100644 --- a/src/researchhub/settings.py +++ b/src/researchhub/settings.py @@ -594,7 +594,10 @@ def silky_capture(request): "tyler@researchhub.com", ] -SIFT_MODERATION_WHITELIST = [35747, 34581, 36837, 35436, 14, 33287, 34416] +SIFT_MODERATION_WHITELIST = [ + user_id.strip() + for user_id in os.environ.get("SIFT_MODERATION_WHITELIST", "").split(",") +] # Persona PERSONA_WEBHOOK_SECRET = os.environ.get( diff --git a/src/user/views/user_views.py b/src/user/views/user_views.py index 1bc72c4e2..6216f9afb 100644 --- a/src/user/views/user_views.py +++ b/src/user/views/user_views.py @@ -35,11 +35,7 @@ DynamicContributionSerializer, ) from reputation.views import BountyViewSet -from researchhub.settings import ( - EMAIL_WHITELIST, - SIFT_MODERATION_WHITELIST, - SIFT_WEBHOOK_SECRET_KEY, -) +from researchhub import settings from researchhub_comment.models import RhCommentModel from user.filters import UserFilter from user.models import Author, Follow, Major, University, User @@ -758,7 +754,7 @@ def sift_check_user_content(self, request): postback_signature = request.headers.get("X-Sift-Science-Signature") # Next, let's try to assemble the signature on our side to verify - key = SIFT_WEBHOOK_SECRET_KEY.encode("utf-8") + key = settings.SIFT_WEBHOOK_SECRET_KEY.encode("utf-8") postback_body = request.body h = hmac.new(key, postback_body, sha1) @@ -771,8 +767,8 @@ def sift_check_user_content(self, request): user = User.objects.get(id=user_id) if ( - not user.moderator or user.email not in EMAIL_WHITELIST - ) and user.id not in SIFT_MODERATION_WHITELIST: + not user.moderator or user.email not in settings.EMAIL_WHITELIST + ) and user.id not in settings.SIFT_MODERATION_WHITELIST: if "mark_as_probable_spammer_content_abuse" in decision_id: log_info( f"Possible Spammer - {user.id}: {user.first_name} {user.last_name} - {decision_id}"