yanganto / s3rs

A s3 cli client with multi configs with diffent provider
MIT License
47 stars 8 forks source link

Implement config encrypt feature #64

Closed yanganto closed 4 years ago

yanganto commented 4 years ago
yanganto commented 4 years ago

The feature branch is using strip_prefix, which can only be built in Rust nightly version after June 2020. Relate issue in Rust is #67302, the feature is merged and will be released in July 16th 2020 (version 1.45.0). This feature branch will be merged when the function becomes stable.

EmanuelKuhn commented 4 years ago

Hey @yanganto, I saw your request for a codereview on gitcoin and thought I would have a look.

The main issue I saw is that your xor encryption scheme is not secure. Specifically it is vulnerable to a known plaintext attack. Some of the fields which you encrypt can probably be guessed (hostname, region), then the secret can trivially be obtained by xor'ing the cipher text with guess. Because the secret is reused for all fields, all fields can then be decrypted after the value of one field was guessed correctly.

I think that in general it's not recommended to try to implement your own encryption algorithm as there are many potential ways a crypto algorithm can break.

I would recommend looking for an open source cryptography library and use an existing symmetric encryption algorithm.

yanganto commented 4 years ago

@EmanuelKuhn Thank you for your review. May you send your ethereum address to me? Thanks.

EmanuelKuhn commented 4 years ago

Hey, sorry for the slightly late reply. My eth address is 0x1f1e2F6BC42Ef6b48bcD83E0e471fA741f9D3443.

Generating unique keys seems a lot better than what you had initially, but you should still be aware of the following:

yanganto commented 4 years ago

Thanks for keeping reviewing this PR. I will implement the minimum length check, and need to time to think about your other opinions. I appreciated. :)

yanganto commented 4 years ago

There are at least two things that need to be done about this feature.

kedMertens commented 4 years ago

Not related to the issue, I found that your link to patreon is actually leads to home page of patreon.

kedMertens commented 4 years ago

@yanganto, what do you think will it be possible to specify what encryption technique is in use in help, so that a user could have an idea what secret should be used to achieve higher security?

yanganto commented 4 years ago

Many thanks for your review.

Not related to the issue, I found that your link to patreon is actually leads to home page of patreon.

https://github.com/yanganto/s3rs/issues/65

yanganto commented 4 years ago

@yanganto, what do you think will it be possible to specify what encryption technique is in use in help, so that a user could have an idea what secret should be used to achieve higher security?

That's cool. I open an issue for this. :) https://github.com/yanganto/s3rs/issues/66

yanganto commented 4 years ago

@kedMertens Thanks for your review. I fix the problems in this issue, and some parts open other issues to track them. Do you think this PR is good for merge or there is still something we need to fix?

If you are interested in this project, it is welcome to implement things you like or to open an issue on this project? Thanks.

kedMertens commented 4 years ago

@yanganto, I think it can be merged. If something will come up new issues can be opened. Thanks I’ll follow the project👍