Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change master seed on each save #366

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

A6GibKm
Copy link
Contributor

@A6GibKm A6GibKm commented Nov 3, 2023

Fixes: #219

@A6GibKm
Copy link
Contributor Author

A6GibKm commented Nov 3, 2023

12 tests fail, with error

ERROR: test_set_credentials (__main__.PyKeePassTests4.test_set_credentials)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/home/deathwish/Projects/pykeepass/tests/tests.py", line 827, in test_set_credentials
    self.kp_tmp.save()
  File "/var/home/deathwish/Projects/pykeepass/pykeepass/pykeepass.py", line 179, in save
    raise e
  File "/var/home/deathwish/Projects/pykeepass/pykeepass/pykeepass.py", line 169, in save
    KDBX.build_file(
  File "/var/home/deathwish/.local/share/pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 451, in build_file
    self.build_stream(obj, f, **contextkw)
  File "/var/home/deathwish/.local/share/pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 441, in build_stream
    self._build(obj, stream, context, "(building)")
  File "/var/home/deathwish/.local/share/pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 2229, in _build
    buildret = sc._build(subobj, stream, context, path)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/deathwish/.local/share/pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 2742, in _build
    return self.subcon._build(obj, stream, context, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/deathwish/.local/share/pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 4007, in _build
    keyfunc = evaluate(self.keyfunc, context)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/deathwish/.local/share/pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 291, in evaluate
    return param(context) if callable(param) else param
           ^^^^^^^^^^^^^^
  File "/var/home/deathwish/.local/share/pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/expr.py", line 188, in __call__
    return self.__parent(obj)[self.__field]
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

I suspect those are the ones that save.

@A6GibKm
Copy link
Contributor Author

A6GibKm commented Nov 4, 2023

When saving, the newer value for the master seed is not taken into account by compute_header_hmac_hash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Security vulnerability] Seeds are not changed on database save
1 participant