Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Check mobile endpoints access across the board. #30761

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions corehq/apps/ota/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@

from django.http import HttpResponseForbidden

from dimagi.utils.couch.cache.cache_core import get_redis_client

from corehq.apps.domain.models import Domain
from corehq.apps.domain.auth import BASIC
from corehq.apps.domain.decorators import (
get_multi_auth_decorator,
two_factor_exempt,
)
from corehq.apps.domain.models import Domain
from corehq.apps.users.decorators import require_permission
from corehq.apps.users.models import Permissions
from dimagi.utils.couch.cache.cache_core import get_redis_client

auth_logger = logging.getLogger("commcare_auth")

Expand Down
5 changes: 5 additions & 0 deletions corehq/apps/receiverwrapper/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
two_factor_exempt,
)
from corehq.apps.locations.permissions import location_safe
from corehq.apps.ota.decorators import require_mobile_access
from corehq.apps.ota.utils import handle_401_response
from corehq.apps.receiverwrapper.auth import (
AuthContext,
Expand Down Expand Up @@ -238,6 +239,7 @@ def post(request, domain, app_id=None):
)


@require_mobile_access
def _noauth_post(request, domain, app_id=None):
"""
This is explicitly called for a submission that has secure submissions enabled, but is manually
Expand Down Expand Up @@ -309,6 +311,7 @@ def case_block_ok(case_updates):

@login_or_digest_ex(allow_cc_users=True)
@two_factor_exempt
@require_mobile_access
@set_request_duration_reporting_threshold(60)
def _secure_post_digest(request, domain, app_id=None):
"""only ever called from secure post"""
Expand All @@ -324,6 +327,7 @@ def _secure_post_digest(request, domain, app_id=None):
@handle_401_response
@login_or_basic_ex(allow_cc_users=True)
@two_factor_exempt
@require_mobile_access
@set_request_duration_reporting_threshold(60)
def _secure_post_basic(request, domain, app_id=None):
"""only ever called from secure post"""
Expand All @@ -339,6 +343,7 @@ def _secure_post_basic(request, domain, app_id=None):
@login_or_api_key_ex()
@require_permission(Permissions.edit_data)
@require_permission(Permissions.access_api)
@require_mobile_access
@set_request_duration_reporting_threshold(60)
def _secure_post_api_key(request, domain, app_id=None):
"""only ever called from secure post"""
Expand Down