InQuest / InQuest/ThreatKB

500 HTTP error on login

Open
#235 0 comments 0 reactions 1 assignee View on GitHub

@danny248 is already working on this.

Since Oct 17, 2018.

bug
Dominant language
JavaScript
Stars
104
Forks
17
PR merge metrics
No merged PRs in 30d

Description

On staging server, on failed login the API returns a 500 HTTP error:

POST /ThreatKB/login
{"email":"jgemic@inquest.net","password":"*******"}

AttributeError
AttributeError: 'AnonymousUserMixin' object has no attribute 'id'

Traceback (most recent call last)
File "/opt/threatkb/env/lib/python2.7/site-packages/flask/app.py", line 1701, in __call__
                                'Flask.blueprints instead'), stacklevel=2)
        return self.blueprints
 
    def __call__(self, environ, start_response):
        """Shortcut for :attr:`wsgi_app`."""
        return self.wsgi_app(environ, start_response)
File "/opt/threatkb/env/lib/python2.7/site-packages/flask/app.py", line 1689, in wsgi_app
        """
        with self.request_context(environ):
            try:
                response = self.full_dispatch_request()
            except Exception, e:
                response = self.make_response(self.handle_exception(e))
            return response(environ, start_response)
 
    @property
    def modules(self):
        from warnings import warn
File "/opt/threatkb/env/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app
                               a list of headers and an optional
                               exception context to start the response
        """
        with self.request_context(environ):
            try:
                response = self.full_dispatch_request()
            except Exception, e:
                response = self.make_response(self.handle_exception(e))
            return response(environ, start_response)
 
    @property
File "/opt/threatkb/env/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
            request_started.send(self)
            rv = self.preprocess_request()
            if rv is None:
                rv = self.dispatch_request()
        except Exception, e:
            rv = self.handle_user_exception(e)
        response = self.make_response(rv)
        response = self.process_response(response)
        request_finished.send(self, response=response)
        return response
 
File "/opt/threatkb/env/lib/python2.7/site-packages/flask/app.py", line 1262, in handle_user_exception
        if handlers is not None:
            blueprint_handlers = handlers.get(None, ())
        app_handlers = self.error_handler_spec[None].get(None, ())
        for typecheck, handler in chain(blueprint_handlers, app_handlers):
            if isinstance(e, typecheck):
                return handler(e)
 
        raise exc_type, exc_value, tb
 
    def handle_exception(self, e):
        """Default exception handling that kicks in when an exception
File "/opt/threatkb/app/routes/error_handling.py", line 24, in handle_exception
 
    stacktrace = "%s" % (
        re.sub(r'\"[^\"]+\/([^\"]+)', r"\1", traceback.format_exc().replace("\n", "<BR>").replace(" ", "&nbsp;")))
    err = Error(
        stacktrace=traceback.format_exc(),
        user_id=current_user.id,
        remote_addr=request.remote_addr,
        args=str(request.args.to_dict(flat=False)),
        method=request.method,
        route=request.url_rule
    )
File "/opt/threatkb/env/lib/python2.7/site-packages/werkzeug/local.py", line 347, in __getattr__
            return []
 
    def __getattr__(self, name):
        if name == '__members__':
            return dir(self._get_current_object())
        return getattr(self._get_current_object(), name)
 
    def __setitem__(self, key, value):
        self._get_current_object()[key] = value
 
    def __delitem__(self, key):
AttributeError: 'AnonymousUserMixin' object has no attribute 'id'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.