Skip to content

Commit

Permalink
Hub: Filter auth_info from config
Browse files Browse the repository at this point in the history
Make sure the auth_info in config is sane and only send known keys to
the clients.
  • Loading branch information
holesch committed May 20, 2024
1 parent cd9653b commit f21441d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions not_my_board/_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,15 @@ def __init__(self, config=None):
format="%(levelname)s: %(name)s: %(message)s", level=log_level
)

self._config = config
auth_info = config.get("auth_info")
if auth_info:
required_keys = ["issuer", "client_id"]
optional_keys = ["show_claims"]
keys = required_keys
keys.extend([k for k in optional_keys if k in auth_info])
self._auth_info = {k: auth_info[k] for k in keys}
else:
self._auth_info = {}

self._id_generator = itertools.count(start=1)

Expand Down Expand Up @@ -299,8 +307,7 @@ async def oidc_callback(self, query):

@jsonrpc.hidden
def auth_info(self):
# TODO check and filter config
return self._config.get("auth_info", {})
return self._auth_info


def _unmap_ip(ip_str):
Expand Down

0 comments on commit f21441d

Please sign in to comment.