# Where to store session

Rails default is **CookieStore**

> There are definitely security concerns when using CookieStore. The main problem is that a CookieStore session can't be killed on the server side. If someone gains access to your cookies, he can easily login as you. Even if you logout and start a new session with a new cookie.
>
> ActiveRecordStore at least gives you the ability to invalidate a session by removing it from the database.
>
> This is a good blog post about it. <https://www.bryanrite.com/ruby-on-rails-cookiestore-security-concerns-lifetime-pass/>

<https://stackoverflow.com/questions/7014458/rails-cookies-or-active-record-store-for-sessions?rq=1>

{% embed url="<https://www.youtube.com/watch?v=xZS5QnrkSZI>" %}
another example explain session store
{% endembed %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kohhepeace.gitbook.io/rails-authentication-guide/session-authentication/where-to-store-session.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
