You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm building an online safe based on carrierwave and a personal cipher library.
My needs are quite simple, I want a user to upload a file, my Rails app encrypt it, then store it (using Fog) in any datacenter.
Then, when retrieving the file, my app needs to decrypt it from cache, and send it to the user.
My uploader :
classEncryptorUploader < CarrierWave::Uploader::Basestorage:fogbefore:store,:remember_cache_idafter:store,:delete_tmp_dirprocess:encryptdefencryptcache_stored_file!if !cached?#.... Encryption logic altering the cached file in placeend
...
end
How I want to use it (here without activerecord for now):
@uploader=EncryptorUploader.new(FakeClass.new,:fake)@uploader.store!(File.open(__FILE__))
...
#... Years later, I need to get the file back@uploader.retrieve_from_store!(@uploader.identifier)@uploader.cache_stored_file!#... Decryption logic altering the cached file in place@uploader.read
But process! is called twice, once on store!, which is quite normal, but also on cache_stored_file! (which call cache! too)
Meaning that when I want to retrieve the file, it is double encrypted...
I'm not understanding, if I misuse Carrierwave, or if there is an issue in the cache_stored_file! feature/code.
BTW cache_stored_file! have no test, so I was unable to check what was the point of this method.
Anybody have any though on my case ?
I'm ready to help writing code and test case on this feature or in a new feature matching my needs.
PS : I checked for issue #380 & #422 but it seems to be a different case.
The text was updated successfully, but these errors were encountered:
Is there a reason you need to call cache_stored_file! in your encrypt method? I think you're just supposed to return the processed file at the end of your custom method.
Hi Trevor,
Thx for looking at this.
I do not know with which web server I'm gonna interact with, and I'm not sure my Rails app will be allowed to write to the file location. Since then I built a method around openssl that cipher the file in place.
I would be glad to cipher the file in webserver temporary place (less copy means less resource and more security), but I don't think it is cross-compatible.
Anyhow I also wanted to point that cache_stored_file! behavior's seems awkward.
Hi,
I'm building an online safe based on carrierwave and a personal cipher library.
My needs are quite simple, I want a user to upload a file, my Rails app encrypt it, then store it (using Fog) in any datacenter.
Then, when retrieving the file, my app needs to decrypt it from cache, and send it to the user.
My uploader :
How I want to use it (here without activerecord for now):
But
process!
is called twice, once onstore!
, which is quite normal, but also oncache_stored_file!
(which callcache!
too)Meaning that when I want to retrieve the file, it is double encrypted...
I'm not understanding, if I misuse Carrierwave, or if there is an issue in the
cache_stored_file!
feature/code.BTW
cache_stored_file!
have no test, so I was unable to check what was the point of this method.Anybody have any though on my case ?
I'm ready to help writing code and test case on this feature or in a new feature matching my needs.
PS : I checked for issue #380 & #422 but it seems to be a different case.
The text was updated successfully, but these errors were encountered: