Skip to content
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
6 changes: 4 additions & 2 deletions horizon/enforcer/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ async def post_to_opa(request: Request, path: str, data: dict | None):
exc = None
_set_use_debugger(data)
try:
logger.debug(f"calling OPA at '{url}' with input: {data}")
logger.info(f"calling OPA at '{url}' with input: {data}")
async with aiohttp.ClientSession(trust_env=True) as session: # noqa: SIM117
async with session.post(
url,
Expand Down Expand Up @@ -251,7 +251,8 @@ def _set_use_debugger(data: dict | None) -> None:
async def _is_allowed(query: BaseSchema, request: Request, policy_package: str):
opa_input = {"input": query.dict()}
path = policy_package.replace(".", "/")
return await post_to_opa(request, path, opa_input)
opa_response = await post_to_opa(request, path, opa_input)
return opa_response


def init_enforcer_api_router(policy_store: BasePolicyStoreClient = None): # noqa: C901
Expand Down Expand Up @@ -369,6 +370,7 @@ async def user_permissions(
request: Request,
query: UserPermissionsQuery,
):
logger.info("user-permissions request: {}", query.json())
response = await _is_allowed(query, request, USER_PERMISSIONS_POLICY_PACKAGE)
log_query_result(query, response)
try:
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ httpx>=0.27.0,<1
# google-re2 # use re2 instead of re for regex matching because it's simiplier and safer for user inputted regexes
protobuf>=6.33.5 # pinned to avoid CVE-2026-0994
cryptography>=46.0.5,<47 # pinned to avoid CVE-2026-26007
opal-common==0.9.5
opal-client==0.9.5
opal-common==0.9.6
opal-client==0.9.6
Loading