Skip to content

Webhooks break when header value contains a ':' #6082

@friek

Description

@friek

NetBox version

v2.10.8

Python version

3.9

Steps to Reproduce

  1. Create a webhook in Django admin (probably any will do)
  2. In the "Additional headers" enter: Header: 1:2
  3. Trigger the webhook

Expected Behavior

The webhook should be called with the configured headers

Observed Behavior

The webhook raises an exception and is not calling the configured URL:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/rq/worker.py", line 1008, in perform_job
    rv = job.perform()
  File "/usr/local/lib/python3.9/site-packages/rq/job.py", line 706, in perform
    self._result = self._execute()
  File "/usr/local/lib/python3.9/site-packages/rq/job.py", line 729, in _execute
    result = self.func(*self.args, **self.kwargs)
  File "/opt/netbox/netbox/extras/webhooks_worker.py", line 36, in process_webhook
    raise e
  File "/opt/netbox/netbox/extras/webhooks_worker.py", line 33, in process_webhook
    headers.update(webhook.render_headers(context))
  File "/opt/netbox/netbox/extras/models/models.py", line 143, in render_headers
    header, value = line.split(':')
ValueError: too many values to unpack (expected 2)

I've forked the current develop branch and have a fix in place locally, including a working test case. I can submit a pull request if you like.

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions