Skip to content

Commit bf39e06

Browse files
fix: do not pass extra arg to logging.error
SATOSA formats all log messages explicitly before passing them to the logger. Python logging formats messages if it receives extra args in the call, otherwise pass them straight through. This call to logger.error in _run_bound_endpoint was (accidentally) passing an extra argument error.state, causing logging to do another round of formatting on an already formatted message. This is dangerous, as the text of the (already formatted) message may contain externally supplied data - such as the redirect URI with URI-encoded data like %3A#2F (which in best part just throw another exception - "Unknown formatting character A") State is already included in the explicit message formatting, so the extra argument here should be safe to remove.
1 parent 3ef0928 commit bf39e06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/satosa/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def _run_bound_endpoint(self, context, spec):
185185
err_id=error.error_id, state=state
186186
)
187187
logline = lu.LOG_FMT.format(id=lu.get_session_id(context.state), message=msg)
188-
logger.error(logline, error.state, exc_info=True)
188+
logger.error(logline, exc_info=True)
189189
return self._handle_satosa_authentication_error(error)
190190

191191
def _load_state(self, context):

0 commit comments

Comments
 (0)