aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/cookies.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* set message_encryptor default cipher to aes-256-gcmAssain2017-06-121-1/+1
| | | | - Introduce a method to select default cipher, and maintain backward compatibility
* Use mattr_accessor default: option throughout the projectGenadi Samokovarov2017-06-031-2/+1
|
* AEAD encrypted cookies and sessionsMichael Coyne2017-05-221-3/+48
| | | | | | | | | | | | | | | | This commit changes encrypted cookies from AES in CBC HMAC mode to Authenticated Encryption using AES-GCM. It also provides a cookie jar to transparently upgrade encrypted cookies to this new scheme. Some other notable changes include: - There is a new application configuration value: +use_authenticated_cookie_encryption+. When enabled, AEAD encrypted cookies will be used. - +cookies.signed+ does not raise a +TypeError+ now if the name of an encrypted cookie is used. Encrypted cookies using the same key as signed cookies would be verified and serialization would then fail due the message still be encrypted.
* [docs] fix ActionDispatch documentationHrvoje Šimić2017-03-131-5/+5
|
* Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-121-1/+1
| | | | (I personally prefer writing one string in one line no matter how long it is, though)
* Merge pull request #26905 from bogdanvlviv/docsAndrew White2016-11-131-2/+2
|\ | | | | Add missing `+` around a some literals.
| * Add missing `+` around a some literals.bogdanvlviv2016-10-271-2/+2
| | | | | | | | | | | | Mainly around `nil` [ci skip]
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-2/+2
|/
* Start passing cipher from EncryptedCookieJar since we use it to determine ↵Vipul A M2016-09-011-7/+5
| | | | key length
* Follow up of #25602Vipul A M2016-09-011-4/+6
| | | | | | | | | Since keys are truncated, ruby 2.4 doesn't accept keys greater than their lenghts. keys of same value but different lenght and greater than key size of cipher, produce the same results as reproduced at https://gist.github.com/rhenium/b81355fe816dcfae459cc5eadfc4f6f9 Since our default cipher is 'aes-256-cbc', key length for which is 32 bytes, limit the length of key being passed to Encryptor to 32 bytes. This continues to support backwards compat with any existing signed data, already encrupted and signed with 32+ byte keys. Also fixes the passing of this value in multiple tests.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-2/+2
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-21/+21
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in actionpack/libXavier Noria2016-08-061-14/+14
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Join values using '; ' as per RFC specAndrew White2016-02-161-1/+1
| | | | | | | Multiple cookie values should be separated by '; ' according to RFC 6265, section 5.4.4[1]. [1]: https://tools.ietf.org/html/rfc6265#section-5.4
* Add require and move escape to private methodAndrew White2016-02-161-1/+6
|
* Escape cookie's key and value in ActionController::TestCaseTakayuki Matsubara2015-12-301-1/+1
| | | | | Get an incorrect cookie value in controller action method if cookie value contains an escapable string.
* Stop violating law of demeter in response cookie_jareileencodes2015-12-061-0/+6
| | | | | | | | | | | This adds a new method to request and response so we don't need to violate the law of demeter. We are changing `Request` and `Response` so that they always have a `cookie_jar` This is a continuation on work to combine integration and controller test code bases in Rails.
* Add missing example for cookies.encrypted [ci skip]Nicolas Cavigneaux2015-11-201-0/+7
|
* Don't set a nil Set-Cookie header when there aren't any cookies. Omit the ↵Jeremy Daer2015-10-011-1/+3
| | | | header.
* build the Set-Cookie header functionallyAaron Patterson2015-09-241-5/+18
| | | | | Use the Rack utility methods for functional header manipulation. This helps to eliminate coupling on the header hash
* Push key_generator into SerializedCookieJarsKasper Timm Hansen2015-09-081-4/+4
| | | | It's only used there.
* Move the request method in to the AbstractCookieJarKasper Timm Hansen2015-09-081-4/+3
| | | | | `CookieJar` is only at the start of the chain and has its own request method, so we don't need it in the module.
* Pull up parse to the legacy upgrading moduleKasper Timm Hansen2015-09-081-10/+5
| | | | It was the same in both legacy versions of the signed and encrypted cookie jars.
* Call super to remove the decrypt_and_verify methodKasper Timm Hansen2015-09-081-8/+4
| | | | The `EncryptedCookieJar` already calls it for us, so just delegate to its `parse` implementation.
* Call super to remove the verify methodKasper Timm Hansen2015-09-081-8/+2
| | | | | `SignedCookieJar`'s parse method already attempts to verify the message, so we can just call super and try the old verifier if it fails.
* Add parse method to share deserialization logic.Kasper Timm Hansen2015-09-081-19/+12
| | | | Cuts down on the duplicated reading parts.
* Add commit in the EncryptedCookieJarKasper Timm Hansen2015-09-081-17/+7
| | | | Gets rid of the option parsing and makes what the encryptor does stand out.
* Use commit in the SignedCookieJarKasper Timm Hansen2015-09-081-15/+6
| | | | Lets us avoid worrying about parsing the options and doing just what we need.
* Add commit method to share option normalizationKasper Timm Hansen2015-09-081-4/+12
| | | | Remove the clutter to make PermanentCookieJar's one change stand out.
* Add AbstractCookieJar class.Kasper Timm Hansen2015-09-081-1/+3
| | | | Eventually this will be the superclass of all the chained jars.
* stop inheriting from Rack::RequestAaron Patterson2015-09-041-2/+2
| | | | | | Just include the modules necessary in the Request object to implement the things we need. This should make it easier to build delegate request objects because the API is smaller
* Fix bug where cookies mutated by request were not persistedeileencodes2015-09-011-0/+7
| | | | | | | | | | | | | | | With changes made in 8363b8 and ae29142 cookies that are mutated on the request like `cookies.signed = x` were not retained in subsequent tests, breaking cookie authentiation in controller tests. The test added demonstrates the issue. The reason we need to select from non-deleted cookies is because without checking the `@delete_cookies` the `cookie_jar` `@cookies` will send the wrong cookies to be updated. The code must check for `@deleted_cookies` before sending an `#update` with the requests cookie_jar cookies. This follows how the cookie_jar cookies from the request were updated before these changes.
* Remove unused requiresMarcin Olichwirowicz2015-08-251-2/+0
| | | | They are already required in `actionpack/lib/action_dispatch.rb` (L25-L26)
* Remove unused block argumentsamitkumarsuroliya2015-08-251-1/+1
|
* convert more `@env` access to get / set headerAaron Patterson2015-08-231-11/+13
|
* remove dead codeAaron Patterson2015-08-061-5/+0
| | | | | we don't recycle requests anymore, so we shouldn't need to recycle cookie jars
* ask the request for the cookie jarAaron Patterson2015-08-061-1/+8
| | | | this prevents the middleware from knowing the specific key for the jar
* add a setter for the cookie jarAaron Patterson2015-08-061-1/+7
|
* remove request reference from chained jarsAaron Patterson2015-08-061-22/+25
| | | | | This changes the chained jars to ask the parent jar for the request object which should eventually call back up to the original jar
* remove `@host` ivarAaron Patterson2015-08-051-6/+4
|
* remove @secure ivarAaron Patterson2015-08-051-5/+3
|
* CookieJar does not need the key_generator parameter anymoreAaron Patterson2015-08-051-3/+2
|
* eliminate key_generator ivarAaron Patterson2015-08-051-11/+14
|
* sop passing host and secure to the build methodAaron Patterson2015-08-051-2/+4
| | | | | eventually we will make the cookie jar derive these values from the request object rather than save a reference to the values
* stop using an options hash with the cookie jarAaron Patterson2015-08-051-38/+30
| | | | | | | | The cookie jar can just ask the request object for the information it needs. This allows us to stop allocating hashes for options, and also allows us to delay calculating values in advance. Generating the options hash forced us to calculate values that we may never have needed at runtime
* move env access to the request object.Aaron Patterson2015-08-051-13/+45
| | | | | | Accessing a request object has nice advantages over accessing a hash. If you use a missing method name, you'll get an exception rather than a `nil` (is one nice feature)
* Send cookies with requesteileencodes2015-07-071-0/+4
|