> For the complete documentation index, see [llms.txt](https://fabco.gitbook.io/dappy-spec/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fabco.gitbook.io/dappy-spec/sections-specific-to-browser-and-web-applications/cookies.md).

# Cookies

The implementation of cookies is close to recent browser's implementations (`Set-Cookie` header). Dappy only does HTTP+TLS therefore all cookies are forced to `secure: true`. Javascript have no access to cookies in any circumstances: all cookies also are forced to `httpOnly: true`. Only possible values for `sameSite` are `strict` or `lax`.

### **Cookies isolation**

Cookies are always tied to two scopes. The first scope is the host into which the page has been loaded (first level navigation). The second scope is the host of the web request.

Examples of scopes:

```
// (1) image loaded from https://amazoonimgs in amazoon tab
amazoon.amazoonimgs
// (2) XHR call to from https://microsooftdata in amazoon tab
amazoon.microsooftdata
// (3) XHR call to from https://microsooftdata in pinterost tab
pinterost.microsooftdata
```

Cross-scope cookie sharing is forbidden, in the above examples, cookies set at (2) and (3) are not shared. `microsooftdata`'s web server will receive either the cookies set under the navigation (scopes) on `amazoon`, or the cookies set under the navigation (scope) of `pinterost`.

Cookies are scoped instead of being not scoped. Many web services use cookies for authentication, a front-end attack on `pinterost` or any random websites will never be able to send requests that include cookies that were set on `amazoon`.

**Cookies isolation prevents 95%+ of** [**CRSF attacks**](https://owasp.org/www-community/attacks/csrf)**.**

[HTTP Working Group's take on cookies, sameSite and XSS requests (2016)](https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://fabco.gitbook.io/dappy-spec/sections-specific-to-browser-and-web-applications/cookies.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
