Age | Commit message (Collapse) | Author |
|
Resolves: https://0xacab.org/leap/soledad/issues/8788
|
|
Handle it only if self.deferred wasnt called yet, otherwise that's just
an out-of-sync call from a scheduled deferred. Since it was already
logged, it's ok to ignore.
|
|
|
|
After refactor, the client secret bootstrap logic was flawed, and remote
secret was not being saved properly. This commit fixed that and tries to
improve the bootstrap code to make it more clear.
|
|
|
|
|
|
|
|
In order to be able to change passphrase, token and offline status of
soledad from the bitmask client api, the secrets api also has to be able
to use up-to-date values when encrypting/decrypting secrets and
uploading/downloading them to the server. This commit makes public some
soledad attributes that were previously "private" (i.e. used to start
with "_" and were not meant to be accessed from outside), and passes the
whole soledad object to the client secrets api. This makes the code
cleaner and also allows for always getting newest values of soledad
attributes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
That's necessary for blobs-io. Current code includes backwards
compatibility branching and tests, which shall be removed on next
releases.
|
|
|
|
The need for token caching in server is a matter of debate, as is the
ideal way to do it. Twisted sessions store the session id in a cookie
and use that session id to persist. It is not clear if that
implementation is needed, works with future features (as multiple
soledad servers) or represents a security problem in some way. Because
of these, this commit removes it for now. The feature is left in git
history so we can bring it back later if needed.
|
|
|
|
|
|
- store ENC_METHOD value instead of string in secrets file
- allow for migration of not-activated secrets
- allow migration of 'aes256' and ENC_METHOD secrets cipher
|
|
|
|
|
|
Current implementation can allow tampering and the CTR->GCM exchange can
help to avoid it.
This commits also alters a behaviour where we moved ahead after failing
to decrypt a recovery document. IMHO we can't move ahead as this is a
fatal error.
Signed-off-by: Victor Shyba <victor1984@riseup.net>
|
|
Integrated the secrets's JSON key that specifies ciphers into _crypto
and added optional GCM. Also added a test to check if both cipher types
can be imported.
Resolves: #8680
Signed-off-by: Victor Shyba <victor1984@riseup.net>
|
|
Resolves: #8668 - client: substitute usage of CTR mode + HMAC by GCM
cipher mode
Signed-off-by: Victor Shyba <victor1984@riseup.net>
|
|
Our magic value wasn't being used and were represented as a string.
Refactored it to a constant, increased it's size to 2 bytes and optimzed
is_symmetrically_encrypted to look for the magic and symmetrically
encrypted flag under base64 encoding. Most file types will use this
feature to help identifying themselves, so it got refactored to serve
the purpose it was created.
|
|
Naming, interfaces and other details.
|
|
AESWriter and HMACWriter are just applying hmac or aes into a flow of
data. Abstracted the application of those operations into a super class
and highlighted just the difference on each implementation.
|
|
VerifiedEncryptor and VerifiedDecryptor are just a pipe and a fan-out.
This class provides both behaviors to two distinct writeable things.
|
|
After adding the streaming decrypt, some classes were doing almost the
same thing. Unified them.
Also fixed some module level variables to upper case and some class name
to camel case.
|
|
Some exceptions were missing a proper description and client_side_db.py
script wasn't capturing logs from Twisted.
|
|
Unfortunately, if a doc finishes decryption before the previous one we
will still have an issue while inserting. This commits solves it by
adding the parse and decrypt inside of the semaphore.
|
|
We are already doing this on encryption, now we can stream also from
decryption. This unblocks the reactor and will be valuable for blobs-io.
|
|
We now encode preamble and ciphertext+hmac in two distinct payloads
separated by a space. This allows metadata to be extracted and used
before decoding the whole document.
It also introduces a single packer for packing and unpacking of data
instead of reads and writes. Downside: doc_id and rev are limited to 255
chars now.
|
|
IV was being set during tests and this required some defensive coding to
avoid IV being set in production. This commits makes the test use the
generated IV and "hides" it using a read-only property to let it clear
this should never happen.
Also refactored out some parameters that are generated automatically to
reduce some lines of code and enhance readability.
|
|
Also explaining how we are using Twisted's consumer interfaces.
|
|
received docs makes no sense for a single request download, plus all its
comments and docstrings. Also updated docstrings for other methods.
The method that tests if sqlcipher is encrypted can return a db handle
that can be used right away. If we ignore it and reopen we can end up
with a lost open cursor.
|
|
Batching is now decided on server side, so the code can be simplified.
Also, sync_db and other parameters were used to initialize encdecpool,
which is no longer supported.
|
|
Document sending happens after encryption, so the last sent document
needs to be signalled after request end.
|
|
We need to emit zmq status during doc prepare, which is called during
upload.
|
|
Fixes setup.cfg, adding current exclude rules, simplified tox.ini to use
setup.cfg and fixed all.
|
|
Also refactored tests and code to stop relying on old parameters which
included docs instead of get_doc calls.
|
|
Giving the proper name to the function and arguments helps to make the
producer wizardry less magic.
|
|
Those are already present, but we are using the ones coming from our
dependencies. Explicit is better than implicit.
|
|
|
|
Code was complex and raised a flag during review.
|
|
|
|
|
|
Asserts aren't a good solution for stream parsing, its cleaner to check
and raise in place. Also, asserts can be ignored.
|