#4027 closed defect (fixed)

If an Authorization header cannot be decoded using UTF-8 then a traceback is logged

Reported by: exarkun Owned by: GitHub <noreply@…>
Priority: normal Milestone: HTTP Storage Protocol
Component: unknown Version: n/a
Keywords: Cc:
Launchpad Bug:


2023-05-05T19:39:51-0400 [twisted.web.server.Request#critical] 
        Traceback (most recent call last):
          File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python3.9/site-packages/twisted/web/server.py", line 292, in render
            body = resrc.render(self)
          File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python3.9/site-packages/klein/_resource.py", line 215, in render
            d = maybeDeferred(_execute)
          File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python3.9/site-packages/twisted/internet/defer.py", line 206, in maybeDeferred
            result = f(*args, **kwargs)
          File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python3.9/site-packages/klein/_resource.py", line 205, in _execute
            d = maybeDeferred(
        --- <exception caught here> ---
          File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python3.9/site-packages/twisted/internet/defer.py", line 206, in maybeDeferred
            result = f(*args, **kwargs)
          File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python3.9/site-packages/klein/_app.py", line 230, in execute_endpoint
            return endpoint_f(
          File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python3.9/site-packages/klein/_app.py", line 366, in _f
            return _call(instance, f, request, *a, **kw)
          File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python3.9/site-packages/klein/_app.py", line 124, in _call
            result = __klein_f__(*args, **kwargs)
          File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/storage/http_server.py", line 120, in route
            request.requestHeaders.getRawHeaders("Authorization", [""])[
          File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python3.9/site-packages/twisted/web/http_headers.py", line 271, in getRawHeaders
            return [v.decode("utf8") for v in values]
          File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python3.9/site-packages/twisted/web/http_headers.py", line 271, in <listcomp>
            return [v.decode("utf8") for v in values]
        builtins.UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 17: invalid start byte

The request can presumably not receive any kind of success response but it should probably not trigger logging of a traceback either.

Change History (1)

comment:1 Changed at 2023-05-23T18:53:26Z by GitHub <noreply@…>

  • Owner set to GitHub <noreply@…>
  • Resolution set to fixed
  • Status changed from new to closed

In d510103/trunk:

Merge pull request #1301 from tahoe-lafs/4027-invalid-unicode

Invalid unicode in Authorization header should give better response

Fixes ticket:4027

Note: See TracTickets for help on using tickets.