Skip to content

Commit

Permalink
hotfix/DES-2673: improve security on public listings (#1162)
Browse files Browse the repository at this point in the history
* improve security on public listings

* add NEES public system to allowlist
  • Loading branch information
jarosenb authored Jan 23, 2024
1 parent f8e11e8 commit 8f90292
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion designsafe/apps/api/datafiles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from boxsdk.exception import BoxOAuthException
from django.http import JsonResponse
from django.contrib.auth import get_user_model
from django.conf import settings
from designsafe.apps.api.datafiles.handlers import datafiles_get_handler, datafiles_post_handler, datafiles_put_handler, resource_unconnected_handler, resource_expired_handler
from designsafe.apps.api.datafiles.operations.transfer_operations import transfer, transfer_folder
from designsafe.apps.api.datafiles.notifications import notify
Expand Down Expand Up @@ -56,7 +57,9 @@ def get(self, request, api, operation=None, scheme='private', system=None, path=
client = get_client(request.user, api)
except AttributeError:
raise resource_unconnected_handler(api)
elif api == 'agave':
elif api == 'agave' and system in (settings.COMMUNITY_SYSTEM,
settings.PUBLISHED_SYSTEM,
settings.NEES_PUBLIC_SYSTEM):
client = service_account()
else:
return JsonResponse({'message': 'Please log in to access this feature.'}, status=403)
Expand Down
2 changes: 2 additions & 0 deletions designsafe/settings/common_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,8 @@
}

PUBLISHED_SYSTEM = 'designsafe.storage.published'
COMMUNITY_SYSTEM = 'designsafe.storage.community'
NEES_PUBLIC_SYSTEM = 'nees.public'

# RECAPTCHA SETTINGS FOR LESS SPAMMO
DJANGOCMS_FORMS_RECAPTCHA_PUBLIC_KEY = os.environ.get('DJANGOCMS_FORMS_RECAPTCHA_PUBLIC_KEY')
Expand Down

0 comments on commit 8f90292

Please sign in to comment.