
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
encrypted-cookie-store
Advanced tools
= Encrypted Cookie Store
== Important Notice
+encrypted-cookies+ has breaking changes in v1.0. Session cookies written with v0.3.* will no be able to be read by v1.0. Fix your version of +encrypted-cookie-store+ to v0.3.2 if you don't want to make the switch. See +encrypted-cookies+ if you want more information about the change.
== Description
Encrypted cookie based session for Rails 3.
== Summary
There are times when one must store things in a session that are not necessarily meant for anyone's eyes. Database or memcache sessions should be used for highly confidential information, however, for information that is not mission critical but still could benefit from a little discretion, an encrypted session cookie might be a good option. EncryptedCookieStore is a drop in replacement for the built in ActionDispatch::Session::CookieStore. +encrypted-cookie-store+ uses the +encrypted-cookies+ gem to store the session information in an encrypted and signed cookie, instead of only using a signed cookie, as ActionDispatch::Session::CookieStore does.
== Usage
Enabling an EncryptedCookieStore is easy. Just add the gem requirement to your +Gemfile+:
gem 'encrypted-cookie-store'
Then update then session store you are using in +config/initializers/session_store.rb+:
AppName::Application.config.session_store :encrypted_cookie_store, :key => '_app_name_session'
Writing and reading from the session is the same:
session[:tid_bit] = "of information"
session[:tid_bit] # => "of information"
== Disclaimer
This is provided as is. No guarantee is given for the security of the data written or read by this software. This has not been tested for cryptographic rigor. Use at your own discretion and risk. This should not be only level of security you use for your data. It uses ActiveSupport::MessageEncryptor to encrypt and ActiveSupport::MessageVerifier to sign the cookie values, so it is at best as secure as these two libraries. Be sure to keep your AppName::Application.config.secret_token safe and secret, as both of the above libraries use it in your Rails application.
== License
Copyright (c) 2011 Les Fletcher
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.