[GH-ISSUE #523] crash due to nameserver_ip key missing in cleaned_data #378

Closed
opened 2026-02-26 10:31:10 +03:00 by kerem · 2 comments
Owner

Originally created by @ThomasWaldmann on GitHub (Apr 18, 2023).
Original GitHub issue: https://github.com/nsupdate-info/nsupdate.info/issues/523

  File "/srv/nsupdate.info/.local/share/virtualenvs/repo-LIy5eWGZ/lib/python3.9/site-packages/django/views/generic/edit.py", line 141, in post
    if form.is_valid():
  File "/srv/nsupdate.info/.local/share/virtualenvs/repo-LIy5eWGZ/lib/python3.9/site-packages/django/forms/forms.py", line 175, in is_valid
    return self.is_bound and not self.errors
  File "/srv/nsupdate.info/.local/share/virtualenvs/repo-LIy5eWGZ/lib/python3.9/site-packages/django/forms/forms.py", line 170, in errors
    self.full_clean()
  File "/srv/nsupdate.info/.local/share/virtualenvs/repo-LIy5eWGZ/lib/python3.9/site-packages/django/forms/forms.py", line 373, in full_clean
    self._clean_form()
  File "/srv/nsupdate.info/.local/share/virtualenvs/repo-LIy5eWGZ/lib/python3.9/site-packages/django/forms/forms.py", line 400, in _clean_form
    cleaned_data = self.clean()
  File "/srv/nsupdate.info/repo/src/nsupdate/main/forms.py", line 79, in clean
    check_domain(self.instance.name, cleaned_data['nameserver_ip'])

KeyError: nameserver_ip

POST data:

nameserver_ip = '1.1.1.1:53'
nameserver2_ip = '8.8.8.8'
available = 'on'
...

Guess the unexpected port spec (:53) makes it fail, but it should not crash.

Originally created by @ThomasWaldmann on GitHub (Apr 18, 2023). Original GitHub issue: https://github.com/nsupdate-info/nsupdate.info/issues/523 ``` File "/srv/nsupdate.info/.local/share/virtualenvs/repo-LIy5eWGZ/lib/python3.9/site-packages/django/views/generic/edit.py", line 141, in post if form.is_valid(): File "/srv/nsupdate.info/.local/share/virtualenvs/repo-LIy5eWGZ/lib/python3.9/site-packages/django/forms/forms.py", line 175, in is_valid return self.is_bound and not self.errors File "/srv/nsupdate.info/.local/share/virtualenvs/repo-LIy5eWGZ/lib/python3.9/site-packages/django/forms/forms.py", line 170, in errors self.full_clean() File "/srv/nsupdate.info/.local/share/virtualenvs/repo-LIy5eWGZ/lib/python3.9/site-packages/django/forms/forms.py", line 373, in full_clean self._clean_form() File "/srv/nsupdate.info/.local/share/virtualenvs/repo-LIy5eWGZ/lib/python3.9/site-packages/django/forms/forms.py", line 400, in _clean_form cleaned_data = self.clean() File "/srv/nsupdate.info/repo/src/nsupdate/main/forms.py", line 79, in clean check_domain(self.instance.name, cleaned_data['nameserver_ip']) KeyError: nameserver_ip ``` POST data: ``` nameserver_ip = '1.1.1.1:53' nameserver2_ip = '8.8.8.8' available = 'on' ... ``` Guess the unexpected port spec (`:53`) makes it fail, but it should not crash.
kerem 2026-02-26 10:31:10 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ThomasWaldmann commented on GitHub (Apr 18, 2023):

@PhrozenByte guess #492 needs another fix, now it is practically tested. :-)

I replaced the nameserver_ip POST value by an equivalent other IPv4 IP for privacy reasons.
But nameserver2_ip was really posted like that, haha.

<!-- gh-comment-id:1513597632 --> @ThomasWaldmann commented on GitHub (Apr 18, 2023): @PhrozenByte guess #492 needs another fix, now it is practically tested. :-) I replaced the `nameserver_ip` POST value by an equivalent other IPv4 IP for privacy reasons. But `nameserver2_ip` was really posted like that, haha.
Author
Owner

@PhrozenByte commented on GitHub (Apr 18, 2023):

Told you I've never used Django 🙈 😄

Fixing the KeyError is trivial, but since I still have never used Django and don't have a local dev environment of nsupdate.info, I just don't know for sure. I hope that it's going to trigger a form validation error, but the patch surely needs testing. See #524

Again, thanks Thomas, please keep up your amazing work! ❤️

<!-- gh-comment-id:1513689479 --> @PhrozenByte commented on GitHub (Apr 18, 2023): Told you I've never used Django :see_no_evil: :smile: Fixing the `KeyError` is trivial, but since I still have never used Django and don't have a local dev environment of nsupdate.info, I just don't know for sure. I hope that it's going to trigger a form validation error, but the patch surely needs testing. See #524 Again, thanks Thomas, please keep up your amazing work! :heart:
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nsupdate.info-nsupdate-info#378
No description provided.