Skip to content

bug: AttributeError: 'NoneType' object has no attribute 'key' when no HackerOne API Key is present (v2.2.0) causing 500 Server Error #1505

@n1nj4ghost

Description

@n1nj4ghost

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When running reNgine v2.2.0 (Docker setup), the dashboard throws a 500 error after login if no HackerOneAPIKey object exists in the database.

The error occurs in dashboard/views.py at line 420:

context['hackerone_key'] = HackerOneAPIKey.objects.first().key

If no record exists, .first() returns None, leading to:

AttributeError: 'NoneType' object has no attribute 'key'

Expected Behavior

Application should be properly redirected to dashboard after Login to the web UI.

Steps To Reproduce

  1. Set up reNgine using Docker (v2.2.0) and complete installation.
  2. Login to the web UI.
  3. Observe the 500 error after login.

Environment

- reNgine: 2.2.0
- OS: Docker container -MSYS_NT-10.0-22631 3.5.7-463ebcdc.x86_64 
- Python: Python 3.10.12
- Docker Engine: 4.41.1 (191279)
- Docker Compose: v2.35.1-desktop.1
- Browser: Version 136.0.3240.50 (Official build) (64-bit)

Anything else?

Logs & Traceback:

Internal Server Error: /
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/src/app/dashboard/views.py", line 420, in onboarding
    context['hackerone_key'] = HackerOneAPIKey.objects.first().key
AttributeError: 'NoneType' object has no attribute 'key'

Workaround:

I manually created a dummy key via Django shell:

docker compose exec web python3 manage.py shell

Then ran:

>>>from dashboard.models import HackerOneAPIKey
>>>HackerOneAPIKey.objects.create(key='dummy_key')
>>>exit()

After that, the error was resolved.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions