Removing debugging. Changing it to INFO in many locations.
This commit is contained in:
@@ -62,13 +62,13 @@ async def authenticate_passcode(
|
||||
|
||||
if matched_role:
|
||||
log.info(f"Auth Success: Verified '{matched_role}' passcode for site {site_id}")
|
||||
|
||||
|
||||
# 4. Resolve Account Context
|
||||
account_id_random = record.get('account_id_random')
|
||||
if not account_id_random:
|
||||
if account_id_int := record.get('account_id'):
|
||||
account_id_random = get_id_random(record_id=account_id_int, table_name='account')
|
||||
|
||||
|
||||
# 5. Mint JWT
|
||||
payload = {
|
||||
'account_id': account_id_random,
|
||||
@@ -81,13 +81,13 @@ async def authenticate_passcode(
|
||||
'role': matched_role
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
token = sign_jwt(
|
||||
secret_key=settings.JWT_KEY,
|
||||
ttl=3600 * 24, # 24 hour session
|
||||
**payload
|
||||
)
|
||||
|
||||
|
||||
return mk_resp(data={'jwt': token, 'account_id': account_id_random, 'role': matched_role}, response=response)
|
||||
else:
|
||||
log.warning(f"Auth Failed: Invalid passcode for site {site_id}")
|
||||
@@ -174,11 +174,11 @@ async def request_jwt(
|
||||
return mk_resp(data=False, status_code=400, response=response) # Bad Request
|
||||
|
||||
# SECURITY PATCH: Prevent public API key from minting privileged tokens
|
||||
# If we are using the default system key (settings.JWT_KEY) but NO external signing key was provided
|
||||
# If we are using the default system key (settings.JWT_KEY) but NO external signing key was provided
|
||||
# (i.e. access via public API Key), we must NOT allow minting account-level privileges.
|
||||
# UNLESS we are renewing a valid existing token (handled by x_aether_jwt renewal logic below).
|
||||
if not x_aether_signing_key and not x_aether_jwt:
|
||||
if account_id or person_id or user_id:
|
||||
if account_id or person_id or user_id:
|
||||
log.warning("Security: Attempt to mint privileged JWT without signing key. Downgrading to Guest.")
|
||||
account_id = None
|
||||
person_id = None
|
||||
@@ -340,7 +340,7 @@ async def create_jitsi_jwt(
|
||||
Generates a Jitsi-specific JWT token for authentication.
|
||||
The token includes claims to set the user's name, email, and moderator status.
|
||||
"""
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
# log.debug(f"Received Jitsi token request: {request_data.model_dump_json(indent=2)}")
|
||||
log.debug(f"Received Jitsi token request: {request_data}")
|
||||
@@ -701,7 +701,7 @@ async def create_jitsi_jwt(
|
||||
Generates a Jitsi-specific JWT token for authentication.
|
||||
The token includes claims to set the user's name, email, and moderator status.
|
||||
"""
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
# log.debug(f"Received Jitsi token request: {request_data.model_dump_json(indent=2)}")
|
||||
log.debug(f"Received Jitsi token request: {request_data}")
|
||||
|
||||
Reference in New Issue
Block a user