1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

25 commits

Author SHA1 Message Date
Łukasz Strzałkowski
29be3f5d83 Add config option for cookies digest
You can now configure custom digest for cookies in the same way as `serializer`:

  config.action_dispatch.cookies_digest = 'SHA256'
2014-08-12 21:57:51 +02:00
Lukasz Sarnacki
b23ffd0dac Allow session serializer key in config.session_store
MessageEncryptor has :serializer option, where any serializer object can
be passed. This commit make it possible to set this serializer from configuration
level.

There are predefined serializers (:marshal_serializer, :json_serialzier)
and custom serializer can be passed as String, Symbol (camelized and
constantized in ActionDispatch::Session namepspace) or serializer object.

Default :json_serializer was also added to generators to provide secure
defalt.
2014-01-29 17:05:00 +01:00
Vipul A M
a4e1e5d632 Use Base.strict_decode64 instead of Base.decode64 just as we do in encoding;
Also reduce extra object allocation by creating string directly instead of join on Array
2013-05-16 02:19:33 +05:30
Andrew White
051d289030 Merge pull request #9980 from stouset/patch-1
Improve poor security recommendation in docs

[ci skip]
2013-04-26 07:26:00 -07:00
jgls
91a0a1156e Reorganize MessageEncryptor
1) According to OpenSSL's documentation, cipher.random_iv must be called
   after cipher.encrypt and already sets the generated IV on the cipher.

2) OpenSSL::CipherError was moved to OpenSSL::Cipher::CipherError in
   Ruby 1.8.7. Since Rails 4 requires at least Ruby 1.9.3, support for
   the old location can be dropped.
2013-04-19 00:33:02 +02:00
Stephen Touset
9ec0cf8581 Improve poor security recommendation in docs
As reported in #9960, the current documentation recommends an insecure practice for
key generation from a password (a single round of SHA-256). The modified documentation
uses ActiveSupport::KeyGenerator to perform proper key stretching.
2013-03-28 10:17:31 -07:00
Akira Matsuda
9ec14c223b Missing require extract_options 2013-01-31 15:56:47 +09:00
claudiob
019df98875 Replace comments' non-breaking spaces with spaces
Sometimes, on Mac OS X, programmers accidentally press Option+Space
rather than just Space and don’t see the difference. The problem is
that Option+Space writes a non-breaking space (0XA0) rather than a
normal space (0x20).

This commit removes all the non-breaking spaces inadvertently
introduced in the comments of the code.
2012-12-04 22:11:54 -08:00
Santiago Pastorino
38c40dbbc1 Add cookie.encrypted which returns an EncryptedCookieJar
How to use it?

cookies.encrypted[:discount] = 45
=> Set-Cookie: discount=ZS9ZZ1R4cG1pcUJ1bm80anhQang3dz09LS1mbDZDSU5scGdOT3ltQ2dTdlhSdWpRPT0%3D--ab54663c9f4e3bc340c790d6d2b71e92f5b60315; path=/
cookies.encrypted[:discount]
=> 45
2012-11-03 14:57:53 -02:00
Francesco Rodriguez
d71d5ba71f update AS docs [ci skip] 2012-09-17 00:22:18 -05:00
Daniel Fone
d222211edf [ci skip] More docs for ActiveSupport::MessageEncryptor 2012-01-26 15:09:04 +13:00
Sergey Nartimov
0f2f8003d2 remove ActiveSupport::Base64 in favor of ::Base64 2012-01-02 22:48:15 +03:00
Vasiliy Ermolovich
a19d0f5a66 deprecate Base64.encode64s from AS. Use Base64.strict_encode64 instead 2011-12-27 22:46:44 +03:00
José Valim
6a6fc4e1db Remove deprecations from Active Support. 2011-12-20 15:18:42 +01:00
José Valim
a625523e75 Don't marshal dump twice when using encryptor. 2011-11-09 20:21:52 -02:00
José Valim
71e84a3b51 Deprecated ActiveSupport::MessageEncryptor#encrypt and decrypt. 2011-11-09 20:04:42 -02:00
Peter Suschlik
c9aac2a215 Fix typo in deprecation warning. 2011-09-16 09:08:53 +03:00
Willem van Bergen
41fea03342 Use an options hash to specify digest/cipher algorithm and a serializer for MessageVerifier and MessageEncryptor. 2011-09-15 14:27:12 -04:00
Willem van Bergen
db040cdf8b Implement API suggestions of pull request. 2011-09-15 13:15:21 -04:00
Willem van Bergen
bffaa888ac Custom serializers and deserializers in MessageVerifier and MessageEncryptor.
By default, these classes use Marshal for serializing and deserializing messages. Unfortunately, the Marshal format is closely associated with Ruby internals and even changes between different interpreters. This makes the resulting message very hard to impossible to unserialize messages generated by these classes in other environments like node.js.

This patch solves this by allowing you to set your own custom serializer and deserializer lambda functions. By default, it still uses Marshal to be backwards compatible.
2011-09-15 08:28:53 -04:00
suchasurge
9b96de6f3d Some style changes 2011-03-06 10:26:24 +01:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Xavier Noria
d26d671e38 message_encriptor.rb needs active_support/base64 2010-01-01 14:28:56 -08:00
Jeremy Kemper
d1213fa402 Rescue OpenSSL::Cipher::CipherError or OpenSSL::CipherError depending on which is present 2008-11-25 23:36:33 -08:00
Michael Koziarski
07abc5efe1 Add a MessageEncryptor, just like MessageVerifier but using symmetric key encryption.
The use of encryption prevents people from seeing any potentially secret values you've used.  It also supports and encrypt_and_sign model to prevent people from tampering with the bits and creating random junk that gets fed to

A motivated coder could use this to add an :encrypt=>true option to the cookie store.
2008-11-25 20:51:30 +01:00