Installations
npm install koa-encrypted-session
Developer
nicokaiser
Developer Guide
Module System
CommonJS
Min. Node Version
>=16
Typescript Support
No
Node Version
18.12.1
NPM Version
8.19.2
Statistics
5 Stars
95 Commits
2 Watching
3 Branches
1 Contributors
Updated on 20 Jan 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
69,906
Last day
62.1%
295
Compared to previous day
Last week
11.9%
1,396
Compared to previous week
Last month
17.8%
5,569
Compared to previous month
Last year
140.5%
35,474
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
koa-encrypted-session
Encrypted session middleware for Koa. Uses cookie-based client sessions with libsodium's Secret key box encrypted cookies.
Using client sessions provides a scalable way to store state information in the client. This eliminates the need of a database on server-side and enables to run stateless server instances.
To avoid tampering (data readout and manipulation of the client-visible cookie), session data is encrypted.
However, as a cost, sessions can not be invalidated other than by the user, scenarios such as "log out all sessions of user" are not possible.
Installation
1npm install koa-encrypted-session
Usage
This library inherits from koa-session
, so all of its options can be used. An additional secretKey
option is introduced, which must be a high-entropy key. This key can be generated with:
./node_modules/.bin/koa-encrypted-session-gen-key
Alternatively, a secret
passphrase and (optional) a salt
can be used, which is at startup hashed.
Example
1import Koa from 'koa'; 2import encryptedSession from 'koa-encrypted-session'; 3 4const app = new Koa(); 5 6app.use(encryptedSession({ 7 key: 'session', 8 maxAge: 7 * 24 * 3600 * 1000, 9 secretKey: Buffer.from('EsAg64LMvGITBBz1ZGLfDNU/MYqGDpTzJ1u4BsvIfTw=', 'base64') 10 /** Additional options from koa-session can be used */ 11}, app));
Acknowledgements
The encryption parts of this code are ported to Koa from fastify-secret-session
.
License
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/nicokaiser/koa-encrypted-session/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/nicokaiser/koa-encrypted-session/ci.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:23
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
Found 0/19 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 11 are checked with a SAST tool
Score
3.4
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More