Skip to content

Conversation

@newnix
Copy link

@newnix newnix commented Nov 15, 2025

  • keripy/src/keri/db/basing.py
    • Remove a potential TOCTOU (Time Of Check/Time Of Use) issue in the Baser.clean() method when using shutil functions. Now instead of if (exists), use unlinkat(2)-style deletions by opening the parent directory and unconditionally running the deletions
    • Additionally pre-compute the value of /usr/local/var/keri/clean so there's no reliance on the runtime or using something like python3 -m compileall -OO to hoist this value before passing it into shutil.rmtree()

These may not be serious issues depending on the environment, but these changes should reduce the chances of malicious or misbehaving code to cause problems.

* keripy/src/keri/db/basing.py
  - Remove a potential TOCTOU issue in the `Baser.clean()` method when using `shutil` functions. Now instead of `if (exists)`, use `unlinkat(2)`-style deletions by opening the parent directory and unconditionally running the deletions
  - Additionally pre-compute the value of `/usr/local/var/keri/clean` so there's no reliance on the runtime or using something like `python3 -m compileall -OO` to hoist this value before passing it into `shutil.rmtree()`

These may not be serious issues depending on the environment, but these changes should reduce the chances of malicious or misbehaving code to cause problems.
Corrected the use of `dirname()`/`basename()` functions.
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.

1 participant