Fix: prevent silent password overwrite on contact/domain update#264
Merged
ehsan-fj merged 2 commits intoInternetNZ:developfrom Mar 10, 2026
Merged
Conversation
Only include the password in Contact Update when supplying a password. To prevent silently overwriting the password.
…d domain creation; update tests accordingly
ehsan-fj
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: prevent silent password overwrite on contact/domain update
Problem
When calling
Contact.update()orDomain.update()without supplying apassword, the existing registry password was silently overwritten with a
randomly generated one.
Root cause:
base_command._prepare_commandauto-generated a 16-characterpassword for any command template that contained the word
password— whichincludes update templates even after the conditional
{% if password %}fixin fe0175d. The auto-generated password satisfied the Jinja condition, causing
the
<authInfo>block to be included in the XML and the password to beoverwritten on the EPP server.
Solution
Moved password auto-generation out of
base_command._prepare_commandand intothe specific
create()methods that actually require it:base_command._prepare_command— removed auto-generation logic and thenow-unused
helperimportcontact.create()— explicitly generates a password when none isprovided
domain.create()— explicitly generates a password when none isprovided
Update operations no longer touch the password unless one is explicitly
supplied by the caller.
Tests
test_prepare_command_password(which assertedauto-generation) with two new tests that assert:
test_create_generates_password_when_not_suppliedandtest_update_does_not_generate_password_when_not_suppliedfor bothContactandDomain