Skip to content

Commit

Permalink
remove internal app allowlist
Browse files Browse the repository at this point in the history
  • Loading branch information
diegocepedaw authored and jwon committed Aug 18, 2021
1 parent 0754ea3 commit 1082055
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/iris/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,7 @@ def process_request(self, req, resp):


class AuthMiddleware(object):
def __init__(self, config={}, debug=False):

self.allowlisted_apps = config.get('allowlisted_internal_apps', [])
def __init__(self, debug=False):
if debug:
self.process_resource = self.debug_auth

Expand Down Expand Up @@ -891,12 +889,6 @@ def process_resource(self, req, resp, resource, params): # pragma: no cover
req.context['app'] = app
if username_header:
req.context['username'] = username_header

# if trying to access internal route ensure that the app is in the allowlist
if hasattr(resource, "internal_allowlist_only"):
if resource.internal_allowlist_only:
if app_name not in self.allowlisted_apps:
raise HTTPUnauthorized('This endpoint is only available for internal allowlisted applications', '', [])
return
# No successful HMACs match, fail auth.
if username_header:
Expand All @@ -915,8 +907,8 @@ def process_resource(self, req, resp, resource, params): # pragma: no cover


class ACLMiddleware(object):
def __init__(self, config={}, debug=False):
self.allowlisted_apps = config.get('allowlisted_internal_apps', [])
def __init__(self, debug):
pass

def process_resource(self, req, resp, resource, params):
self.process_frontend_routes(req, resource)
Expand All @@ -942,10 +934,6 @@ def process_admin_acl(self, req, resource, params):
enforce_user = getattr(resource, 'enforce_user', False)
app = req.context.get('app')

# internally allowlisted apps have access to all internal data
if req.context.get('app', {}).get('name') in self.allowlisted_apps:
return

if not req.context['username']:
# Check if we need to raise 401s when user must be enforced
if enforce_user:
Expand Down Expand Up @@ -5435,8 +5423,8 @@ def construct_falcon_api(debug, healthcheck_path, allowed_origins, iris_sender_a
cors = CORS(allow_origins_list=allowed_origins)
api = API(middleware=[
ReqBodyMiddleware(),
AuthMiddleware(config=config, debug=debug),
ACLMiddleware(config=config, debug=debug),
AuthMiddleware(debug=debug),
ACLMiddleware(debug=debug),
HeaderMiddleware(),
cors.middleware
])
Expand Down

0 comments on commit 1082055

Please sign in to comment.