Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Commit 9b786b1

Browse files
authored
docs: document domain setting, remove some trailing whitespaces (#23)
1 parent 7abc24d commit 9b786b1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The `nuxt-session` library provide many helpers to interact with the session fro
5757
- ✔️ Configurable session endpoints out of the box:
5858
- `GET /api/session`: Get the current session
5959
- `DELETE /api/session`: Delete the current session
60-
- `POST /api/session`: Overwrite the current session data
60+
- `POST /api/session`: Overwrite the current session data
6161
- `PATCH /api/session`: Add to the current session data
6262
- ✔️ Storage via [unjs/unstorage](https://github.com/unjs/unstorage) - use memory, redis, fs, cloudflare-kv, ... to store your session data
6363
- ✔️ Automatic session and storage cleanup on expiry
@@ -115,10 +115,10 @@ Allowing alteration of session-data with arbitrary data provided by the client (
115115
116116
On the client-side you can use the session like this:
117117
```ts
118-
const {
119-
session,
118+
const {
119+
session,
120120
refresh,
121-
remove,
121+
remove,
122122
reset,
123123
update,
124124
overwrite
@@ -195,7 +195,7 @@ In theory you can manipulate this data on the server side if you want to. If you
195195
196196
### Storage Backends
197197
198-
`nuxt-session` allows you to use different storage backends. A storage backend is something like your server memory, a redis database, the file-system of your server, ... Supporting these backend is possible by using [unjs/unstorage](https://github.com/unjs/unstorage) for storage management. This library connects to the different backends it supports with a unified interface.
198+
`nuxt-session` allows you to use different storage backends. A storage backend is something like your server memory, a redis database, the file-system of your server, ... Supporting these backend is possible by using [unjs/unstorage](https://github.com/unjs/unstorage) for storage management. This library connects to the different backends it supports with a unified interface.
199199
200200
You can configure the storage backend using the `session.session.storageOptions` configuration option of the `nuxt-session` module. By default `memory` is used to store the sessions. This has some advantages like speed and easy setup, but some disadvantages like missing persistency (if your server crashes, the sessions are gone!) and possible exploits like setting millions of sessions trying to exhaust your server-memory or saving large amounts of data into the session that your server cannot handle.
201201
@@ -219,6 +219,8 @@ Here's what the full _default_ module configuration looks like:
219219
cookieSameSite: 'lax',
220220
// In-memory storage is used (these are `unjs/unstorage` options)
221221
storageOptions: {}
222+
// The request-domain is strictly used for the cookie, no sub-domains allowed
223+
domain: null
222224
},
223225
api: {
224226
// The API is enabled
@@ -231,7 +233,7 @@ Here's what the full _default_ module configuration looks like:
231233
}
232234
```
233235
234-
### Security
236+
### Security
235237
236238
This section mostly contains a list of possible security problems and how to mitigate (some) of them. Note that the below flaws exist with many libraries and frameworks we use in our day-to-day when building and working with APIs. E.g., your vanilla-nuxt-app is not safe of some of them like the client sending malicious data. Missing in the below list are estimates of how likely it is that one of the list-items may occur and what impact it will have on your app. This is because that heavily depends on:
237239
- your app: Are you building a fun project? A proof of concept? The next fort-nox money management app?
@@ -251,7 +253,7 @@ Without further ado, here's some attack cases you can consider and take action a
251253
- use `redis` as a storage backend and set data to expire automatically
252254
3. guessing correct session ids
253255
- problems: session data can leak
254-
- possible mitigations:
256+
- possible mitigations:
255257
- disable reading of data on the client side by disabling the api or setting `api: { methods: [] }`
256258
- increase the default sessionId length (although with `64` characters it already is quite long, in 2022)
257259
4. stealing session id(s) of client(s)

0 commit comments

Comments
 (0)