authenik8-core 1.0.38 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +48 -236
  3. package/THREAT_MODEL.md +162 -0
  4. package/dist/agent/agentIdentity.d.ts +68 -0
  5. package/dist/agent/agentIdentity.d.ts.map +1 -0
  6. package/dist/agent/agentIdentity.js +435 -0
  7. package/dist/agent/agentIdentity.js.map +1 -0
  8. package/dist/agent/types.d.ts +83 -0
  9. package/dist/agent/types.d.ts.map +1 -0
  10. package/dist/{oauth/brain → agent}/types.js.map +1 -1
  11. package/dist/audit/auditDispatcher.d.ts +13 -0
  12. package/dist/audit/auditDispatcher.d.ts.map +1 -0
  13. package/dist/audit/auditDispatcher.js +212 -0
  14. package/dist/audit/auditDispatcher.js.map +1 -0
  15. package/dist/audit/types.d.ts +40 -0
  16. package/dist/audit/types.d.ts.map +1 -0
  17. package/dist/{oauth/identity → audit}/types.js.map +1 -1
  18. package/dist/auth/guestModeService.d.ts +6 -4
  19. package/dist/auth/guestModeService.d.ts.map +1 -1
  20. package/dist/auth/guestModeService.js +27 -20
  21. package/dist/auth/guestModeService.js.map +1 -1
  22. package/dist/auth/jwk.d.ts +49 -0
  23. package/dist/auth/jwk.d.ts.map +1 -0
  24. package/dist/auth/jwk.js +319 -0
  25. package/dist/auth/jwk.js.map +1 -0
  26. package/dist/auth/jwtAuth.d.ts +60 -16
  27. package/dist/auth/jwtAuth.d.ts.map +1 -1
  28. package/dist/auth/jwtAuth.js +273 -59
  29. package/dist/auth/jwtAuth.js.map +1 -1
  30. package/dist/auth/refreshService.d.ts +40 -15
  31. package/dist/auth/refreshService.d.ts.map +1 -1
  32. package/dist/auth/refreshService.js +288 -51
  33. package/dist/auth/refreshService.js.map +1 -1
  34. package/dist/auth/requestIdentity.d.ts +4 -0
  35. package/dist/auth/requestIdentity.d.ts.map +1 -0
  36. package/dist/auth/requestIdentity.js +16 -0
  37. package/dist/auth/requestIdentity.js.map +1 -0
  38. package/dist/auth/sessionStore.d.ts +35 -0
  39. package/dist/auth/sessionStore.d.ts.map +1 -0
  40. package/dist/auth/sessionStore.js +174 -0
  41. package/dist/auth/sessionStore.js.map +1 -0
  42. package/dist/auth/tokenFingerprint.d.ts +3 -0
  43. package/dist/auth/tokenFingerprint.d.ts.map +1 -0
  44. package/dist/auth/tokenFingerprint.js +13 -0
  45. package/dist/auth/tokenFingerprint.js.map +1 -0
  46. package/dist/authorization/authorizationService.d.ts +22 -0
  47. package/dist/authorization/authorizationService.d.ts.map +1 -0
  48. package/dist/authorization/authorizationService.js +132 -0
  49. package/dist/authorization/authorizationService.js.map +1 -0
  50. package/dist/authorization/types.d.ts +10 -0
  51. package/dist/authorization/types.d.ts.map +1 -0
  52. package/dist/{types/admin.js → authorization/types.js} +1 -1
  53. package/dist/authorization/types.js.map +1 -0
  54. package/dist/createAuthenik8.d.ts.map +1 -1
  55. package/dist/createAuthenik8.js +144 -65
  56. package/dist/createAuthenik8.js.map +1 -1
  57. package/dist/index.d.ts +21 -0
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +16 -1
  60. package/dist/index.js.map +1 -1
  61. package/dist/middleware/adminService.d.ts +10 -3
  62. package/dist/middleware/adminService.d.ts.map +1 -1
  63. package/dist/middleware/adminService.js +25 -44
  64. package/dist/middleware/adminService.js.map +1 -1
  65. package/dist/oauth/adapters/memoryAdapter.d.ts +4 -19
  66. package/dist/oauth/adapters/memoryAdapter.d.ts.map +1 -1
  67. package/dist/oauth/adapters/memoryAdapter.js +47 -17
  68. package/dist/oauth/adapters/memoryAdapter.js.map +1 -1
  69. package/dist/oauth/adapters/redisAdapter.d.ts +2 -21
  70. package/dist/oauth/adapters/redisAdapter.d.ts.map +1 -1
  71. package/dist/oauth/adapters/redisAdapter.js +163 -84
  72. package/dist/oauth/adapters/redisAdapter.js.map +1 -1
  73. package/dist/oauth/brain/identityEngine.d.ts +13 -14
  74. package/dist/oauth/brain/identityEngine.d.ts.map +1 -1
  75. package/dist/oauth/brain/identityEngine.js +160 -74
  76. package/dist/oauth/brain/identityEngine.js.map +1 -1
  77. package/dist/oauth/brain/identityPolicy.d.ts +7 -4
  78. package/dist/oauth/brain/identityPolicy.d.ts.map +1 -1
  79. package/dist/oauth/brain/identityPolicy.js +15 -2
  80. package/dist/oauth/brain/identityPolicy.js.map +1 -1
  81. package/dist/oauth/callback.d.ts +3 -0
  82. package/dist/oauth/callback.d.ts.map +1 -0
  83. package/dist/oauth/callback.js +21 -0
  84. package/dist/oauth/callback.js.map +1 -0
  85. package/dist/oauth/core.d.ts +19 -17
  86. package/dist/oauth/core.d.ts.map +1 -1
  87. package/dist/oauth/core.js +73 -2
  88. package/dist/oauth/core.js.map +1 -1
  89. package/dist/oauth/identityValidation.d.ts +14 -0
  90. package/dist/oauth/identityValidation.d.ts.map +1 -0
  91. package/dist/oauth/identityValidation.js +90 -0
  92. package/dist/oauth/identityValidation.js.map +1 -0
  93. package/dist/oauth/providerSecurity.d.ts +13 -0
  94. package/dist/oauth/providerSecurity.d.ts.map +1 -0
  95. package/dist/oauth/providerSecurity.js +100 -0
  96. package/dist/oauth/providerSecurity.js.map +1 -0
  97. package/dist/oauth/providers/github.d.ts +5 -10
  98. package/dist/oauth/providers/github.d.ts.map +1 -1
  99. package/dist/oauth/providers/github.js +147 -64
  100. package/dist/oauth/providers/github.js.map +1 -1
  101. package/dist/oauth/providers/google.d.ts +6 -10
  102. package/dist/oauth/providers/google.d.ts.map +1 -1
  103. package/dist/oauth/providers/google.js +133 -71
  104. package/dist/oauth/providers/google.js.map +1 -1
  105. package/dist/oauth/state.d.ts +9 -0
  106. package/dist/oauth/state.d.ts.map +1 -0
  107. package/dist/oauth/state.js +55 -0
  108. package/dist/oauth/state.js.map +1 -0
  109. package/dist/oauth/types.d.ts +122 -1
  110. package/dist/oauth/types.d.ts.map +1 -1
  111. package/dist/redis/keyNamespace.d.ts +4 -0
  112. package/dist/redis/keyNamespace.d.ts.map +1 -0
  113. package/dist/redis/keyNamespace.js +34 -0
  114. package/dist/redis/keyNamespace.js.map +1 -0
  115. package/dist/redis/redisService.d.ts +2 -1
  116. package/dist/redis/redisService.d.ts.map +1 -1
  117. package/dist/redis/redisService.js +62 -34
  118. package/dist/redis/redisService.js.map +1 -1
  119. package/dist/risk/redisSessionRiskStore.d.ts +13 -0
  120. package/dist/risk/redisSessionRiskStore.d.ts.map +1 -0
  121. package/dist/risk/redisSessionRiskStore.js +29 -0
  122. package/dist/risk/redisSessionRiskStore.js.map +1 -0
  123. package/dist/risk/sessionRiskService.d.ts +31 -0
  124. package/dist/risk/sessionRiskService.d.ts.map +1 -0
  125. package/dist/risk/sessionRiskService.js +311 -0
  126. package/dist/risk/sessionRiskService.js.map +1 -0
  127. package/dist/risk/types.d.ts +50 -0
  128. package/dist/risk/types.d.ts.map +1 -0
  129. package/dist/{types/storage.js → risk/types.js} +1 -1
  130. package/dist/risk/types.js.map +1 -0
  131. package/dist/security/ipService.d.ts +27 -17
  132. package/dist/security/ipService.d.ts.map +1 -1
  133. package/dist/security/ipService.js +238 -85
  134. package/dist/security/ipService.js.map +1 -1
  135. package/dist/security/limiter.d.ts +15 -11
  136. package/dist/security/limiter.d.ts.map +1 -1
  137. package/dist/security/limiter.js +100 -60
  138. package/dist/security/limiter.js.map +1 -1
  139. package/dist/security/requestContext.d.ts +15 -0
  140. package/dist/security/requestContext.d.ts.map +1 -0
  141. package/dist/security/requestContext.js +156 -0
  142. package/dist/security/requestContext.js.map +1 -0
  143. package/dist/storage/RedisTokenStore.d.ts +8 -7
  144. package/dist/storage/RedisTokenStore.d.ts.map +1 -1
  145. package/dist/storage/RedisTokenStore.js +39 -32
  146. package/dist/storage/RedisTokenStore.js.map +1 -1
  147. package/dist/types/config.d.ts +50 -6
  148. package/dist/types/config.d.ts.map +1 -1
  149. package/dist/types/public.d.ts +51 -28
  150. package/dist/types/public.d.ts.map +1 -1
  151. package/dist/types/tokens.d.ts +8 -1
  152. package/dist/types/tokens.d.ts.map +1 -1
  153. package/dist/utility/safeString.d.ts +2 -0
  154. package/dist/utility/safeString.d.ts.map +1 -0
  155. package/dist/utility/safeString.js +13 -0
  156. package/dist/utility/safeString.js.map +1 -0
  157. package/docs/agent-service-identity.md +69 -0
  158. package/docs/api-overview.md +56 -0
  159. package/docs/architecture.md +41 -0
  160. package/docs/authorization-tenants-audit.md +53 -0
  161. package/docs/final-thought.md +9 -0
  162. package/docs/getting-started.md +57 -0
  163. package/docs/how-it-works-internally.md +15 -0
  164. package/docs/key-rotation.md +13 -0
  165. package/docs/refresh-token-rotation.md +15 -0
  166. package/docs/replay-attack-detection.md +16 -0
  167. package/docs/replay-attack-prevention.md +15 -0
  168. package/docs/repository-setup.md +13 -0
  169. package/docs/requirements.md +31 -0
  170. package/docs/secure-refresh-flow.md +21 -0
  171. package/docs/security-audit.md +133 -0
  172. package/docs/security-layer.md +54 -0
  173. package/docs/session-risk-quarantine.md +36 -0
  174. package/docs/stateful-session-control.md +16 -0
  175. package/docs/testing.md +37 -0
  176. package/docs/threats-addressed.md +25 -0
  177. package/docs/use-cases.md +12 -0
  178. package/docs/what-authenik8-does.md +17 -0
  179. package/docs/why-authenik8.md +15 -0
  180. package/docs/why-stateful-matters.md +11 -0
  181. package/package.json +27 -9
  182. package/dist/oauth/brain/identityResolver.d.ts +0 -7
  183. package/dist/oauth/brain/identityResolver.d.ts.map +0 -1
  184. package/dist/oauth/brain/identityResolver.js +0 -32
  185. package/dist/oauth/brain/identityResolver.js.map +0 -1
  186. package/dist/oauth/brain/types.d.ts +0 -9
  187. package/dist/oauth/brain/types.d.ts.map +0 -1
  188. package/dist/oauth/identity/types.d.ts +0 -37
  189. package/dist/oauth/identity/types.d.ts.map +0 -1
  190. package/dist/oauth/types/identity.d.ts +0 -16
  191. package/dist/oauth/types/identity.d.ts.map +0 -1
  192. package/dist/oauth/types/identity.js +0 -3
  193. package/dist/oauth/types/identity.js.map +0 -1
  194. package/dist/oauth/userStore.d.ts +0 -20
  195. package/dist/oauth/userStore.d.ts.map +0 -1
  196. package/dist/oauth/userStore.js +0 -46
  197. package/dist/oauth/userStore.js.map +0 -1
  198. package/dist/storage/userStorage.d.ts +0 -7
  199. package/dist/storage/userStorage.d.ts.map +0 -1
  200. package/dist/storage/userStorage.js +0 -17
  201. package/dist/storage/userStorage.js.map +0 -1
  202. package/dist/tests/con.test.d.ts +0 -2
  203. package/dist/tests/con.test.d.ts.map +0 -1
  204. package/dist/tests/con.test.js +0 -71
  205. package/dist/tests/con.test.js.map +0 -1
  206. package/dist/tests/full.intergration.test.d.ts +0 -2
  207. package/dist/tests/full.intergration.test.d.ts.map +0 -1
  208. package/dist/tests/full.intergration.test.js +0 -79
  209. package/dist/tests/full.intergration.test.js.map +0 -1
  210. package/dist/tests/oauth.intergration.test.d.ts +0 -2
  211. package/dist/tests/oauth.intergration.test.d.ts.map +0 -1
  212. package/dist/tests/oauth.intergration.test.js +0 -38
  213. package/dist/tests/oauth.intergration.test.js.map +0 -1
  214. package/dist/tests/oauth1.test.d.ts +0 -9
  215. package/dist/tests/oauth1.test.d.ts.map +0 -1
  216. package/dist/tests/oauth1.test.js +0 -126
  217. package/dist/tests/oauth1.test.js.map +0 -1
  218. package/dist/tests/oauth2.test.d.ts +0 -2
  219. package/dist/tests/oauth2.test.d.ts.map +0 -1
  220. package/dist/tests/oauth2.test.js +0 -145
  221. package/dist/tests/oauth2.test.js.map +0 -1
  222. package/dist/tests/oauth3.test.d.ts +0 -2
  223. package/dist/tests/oauth3.test.d.ts.map +0 -1
  224. package/dist/tests/oauth3.test.js +0 -148
  225. package/dist/tests/oauth3.test.js.map +0 -1
  226. package/dist/tests/testApp.d.ts +0 -7
  227. package/dist/tests/testApp.d.ts.map +0 -1
  228. package/dist/tests/testApp.js +0 -53
  229. package/dist/tests/testApp.js.map +0 -1
  230. package/dist/types/admin.d.ts +0 -5
  231. package/dist/types/admin.d.ts.map +0 -1
  232. package/dist/types/admin.js.map +0 -1
  233. package/dist/types/storage.d.ts +0 -14
  234. package/dist/types/storage.d.ts.map +0 -1
  235. package/dist/types/storage.js.map +0 -1
  236. /package/dist/{oauth/brain → agent}/types.js +0 -0
  237. /package/dist/{oauth/identity → audit}/types.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,110 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Added
6
+ - Human `requireRole()`, `requirePermission()`, `requireScope()`, and tenant-aware authorization middleware.
7
+ - Versioned structured audit events with application-owned sinks and configurable best-effort or strict delivery.
8
+ - Stateful session-risk signals for refresh replay, concurrent refresh use, IP/device changes, and suspicious agent activity.
9
+ - Automatic, TTL-bound human and agent session quarantine with an explicit release API.
10
+ - Stable, configurable Redis key namespaces derived from issuer and audience by
11
+ default.
12
+ - Explicit trusted-proxy CIDRs and right-to-left forwarding-chain validation.
13
+ - Configurable enforcing Helmet policy through `security.helmetOptions`.
14
+
15
+ ### Changed
16
+ - Reorganized the root README into a concise entry point with each detailed topic in a dedicated document under `docs/`.
17
+ - HMAC secrets now require 32-4096 bytes of material. Access, refresh, and agent
18
+ token lifetimes have explicit upper bounds.
19
+ - OAuth state stores must implement atomic `take()`, and identity adapters now
20
+ return explicit creation outcomes and resolve users by ID.
21
+ - IP allowlist entries are canonicalized, loopback requires an explicit entry,
22
+ and exact/CIDR expiry cleanup is enforced without N+1 Redis checks.
23
+ - SDK modules no longer call `dotenv.config()` at import time; environment
24
+ loading belongs to the host application.
25
+ - Removed obsolete deep-import in-memory identity/password stores and their
26
+ duplicate resolver; the hardened identity adapter is now the single OAuth
27
+ account-resolution path.
28
+ - Removed stateless `jwtSecret` fallbacks from internal admin and incognito
29
+ helpers. The instance always supplies purpose-bound, session-aware
30
+ verification functions.
31
+ - CI remains Redis-service-free and exercises Redis behavior with
32
+ `ioredis-mock`.
33
+ - Package exports are restricted to the reviewed root API; public identity,
34
+ token, session, and refresh types are exported from that entry point.
35
+
36
+ ### Security
37
+ - `incognito` now enforces active Redis session and quarantine state for authenticated users.
38
+ - Access and refresh bearer tokens are represented by SHA-256 fingerprints in Redis, with read migration support for existing raw records.
39
+ - Legacy HS256 verification now enforces issuer and audience.
40
+ - Token issuance and rotation roll back session state when a dependent security operation fails.
41
+ - OAuth state is consumed before token exchange and Redis uses atomic `GETDEL` where available.
42
+ - Closed an OAuth identity-create race that could issue tokens for an existing
43
+ same-email account.
44
+ - Closed a link-mode account-confusion path that could return the existing
45
+ provider owner's login instead of rejecting the link.
46
+ - OAuth state fallback consumption now uses an atomic Lua transaction; the
47
+ nonatomic `get()`/`del()` fallback was removed.
48
+ - Redis OAuth identity creation and linking now use atomic, cluster-slot-safe
49
+ transactions with post-link verification.
50
+ - Forwarding headers cannot affect allowlist, rate-limit, or risk context unless
51
+ the socket peer belongs to an explicit trusted proxy network.
52
+ - Audit metadata is detached, bounded, recursively cloned, and deeply frozen,
53
+ preventing a sink from mutating authorization requirements.
54
+ - Default CSP is enforcing and removes `unsafe-inline`, report-only behavior,
55
+ and placeholder domains.
56
+ - OTP rate limiting uses bounded, hashed identifiers and both IP and normalized
57
+ email buckets.
58
+ - Dependency lockfile updated to patched versions; `npm audit
59
+ --package-lock-only --audit-level=low` reports zero vulnerabilities.
60
+ - Refresh and lock keys use collision-resistant compound identifiers, and
61
+ refresh-family deletion uses bounded batches.
62
+ - OAuth provider JSON is bounded while streaming; state, identity records,
63
+ provider counts, and adapter index integrity are validated before token
64
+ issuance.
65
+ - Stored session/risk records and audit envelopes receive strict runtime
66
+ validation. Authorization claims are bounded at issuance and verification.
67
+ - Identity, delegation, and registry policy decisions require exact boolean
68
+ values instead of truthy coercion.
69
+ - Published JWKS fields use a public allowlist, local verification rejects
70
+ private/oversized key sets, and remote JWKS URLs require credential-free
71
+ HTTPS.
72
+
73
+ ### Upgrade notes
74
+
75
+ - Existing Redis sessions use earlier key names and will be treated as logged
76
+ out unless they are deliberately migrated. Set `redisKeyPrefix` explicitly
77
+ before rollout when coordinating a migration.
78
+ - Tokens without an exact `tokenUse` claim are rejected.
79
+ - `trustProxyHeaders: true` without `trustedProxyCidrs` now fails startup.
80
+ - Google link routes must pass `"link"` explicitly to `redirect()`; route-path
81
+ substring inference was removed.
82
+ - Numeric token lifetimes are relative seconds. Access tokens are limited to one
83
+ day, refresh tokens to 31 days, and agent tokens to one hour.
84
+ - Internal package deep imports are no longer supported. Import runtime APIs and
85
+ public types from `authenik8-core`.
86
+ - Refresh and lock Redis key shapes changed; existing refresh credentials are
87
+ intentionally invalidated during this security upgrade.
88
+
89
+ ## [2.0.0] - 2026-07-15
90
+ ### Added
91
+ - JOSE-based ES256 signing with explicit `kid`, issuer, audience, expiry, and token-purpose validation.
92
+ - Configurable key rings for safe verification during signing-key rotation.
93
+ - Public-only JWKS export, `generateSigningJwk()` key generation, and local/remote public-key verification through `verifyAccessTokenWithJwks()`.
94
+ - Public, Redis-backed `auth.requireAuth` middleware that enforces session revocation.
95
+ - Per-user refresh-family indexes so user-wide revocation also removes refresh sessions whose access-token records have expired.
96
+ - Optional agent/service identities with exact scopes, actor-chain claims, delegated-user tokens, Redis-backed M2M sessions, registry-aware verification, and agent/session revocation.
97
+ - Fail-closed delegation policies and separate agent middleware so human and machine token classes cannot be confused.
98
+
99
+ ### Changed
100
+ - `verifyToken()` and `guestToken()` are asynchronous because verification and signing use Web Crypto.
101
+ - Refresh and guest tokens now use JOSE and include purpose-bound claims.
102
+ - `jwtSecret` is deprecated and retained only as an HS256 migration path.
103
+
104
+ ### Fixed
105
+ - Invalid RS256 signing with a shared string secret.
106
+ - OAuth state and distributed-lock Redis operations that had drifted to incompatible hash commands.
107
+
3
108
  ## [0.1.2] - 2026-03-22
4
109
  ### Fixed
5
110
  - Patched a vulnerability allowing reuse of old refresh tokens.
package/README.md CHANGED
@@ -1,250 +1,62 @@
1
- # Authenik8-core [Beta]
1
+ <div align="center">
2
2
 
3
+ ![Authenik8-core logo](https://raw.githubusercontent.com/COD434/authenik8-core-Beta-/main/logo.svg)
3
4
 
5
+ # Authenik8-core [Beta]
4
6
 
5
7
  [![Pipeline status](https://gitlab.com/COD434/authenik8-core/badges/main/pipeline.svg)](https://gitlab.com/COD434/authenik8-core/-/pipelines)
6
8
  [![Coverage](https://gitlab.com/COD434/authenik8-core/badges/main/coverage.svg)](https://gitlab.com/COD434/authenik8-core/-/pipelines)
7
9
  [![NPM Version](https://img.shields.io/npm/v/authenik8-core.svg)](https://www.npmjs.com/package/authenik8-core)
8
10
 
9
- Most JWT authentication systems break under real-world attacks.
10
- Authenik8-core is built to handle them.
11
+ </div>
12
+
13
+ Authenik8-core is a stateful JWT authentication SDK with refresh-token replay
14
+ protection, Redis-backed revocation, authorization, audit events, risk
15
+ quarantine, and scoped agent identities.
16
+
17
+ Start with [Getting Started](docs/getting-started.md), then review the
18
+ [requirements](docs/requirements.md) and [threat model](THREAT_MODEL.md) before
19
+ deploying.
20
+
21
+ ## Documentation
22
+
23
+ ### Start Here
24
+
25
+ - [What Authenik8-core does](docs/what-authenik8-does.md)
26
+ - [Getting started](docs/getting-started.md)
27
+ - [Requirements](docs/requirements.md)
28
+ - [Why Authenik8-core?](docs/why-authenik8.md)
29
+ - [Use cases](docs/use-cases.md)
30
+ - [Final thought](docs/final-thought.md)
31
+
32
+ ### Authentication and Sessions
11
33
 
12
- ***
13
- ## What Authenik8-core Does
14
- Authenik8-core adds a security layer on top of JWT:
15
-
16
- •Refresh token rotation with replay protection (jti-based)
17
-
18
- •Stateful session control using Redis
19
-
20
- •Built-in security middleware (rate limiting, IP control)
21
-
22
- •Unified authentication + security logic
23
-
24
- ## Example: Replay Attack Prevention
25
- ```
26
- TypeScript
27
- // First request → valid
28
- await auth.refresh(token);
29
-
30
- // Reusing same token → blocked
31
- await auth.refresh(token); // rejected
32
- ```
33
- ***
34
-
35
- ## Getting started
36
- ```
37
- import { createAuthenik8 } from "authenik8";
38
-
39
- const auth = await createAuthenik8({
40
- jwtSecret: "ACCESS_SECRET",
41
- refreshSecret: "REFRESH_SECRET"
42
- });
43
-
44
- // generate tokens
45
- const refreshToken = await auth.generateRefreshToken({
46
- userId: "user_1",
47
- email: "test@test.com"
48
- });
49
-
50
- // refresh tokens
51
- const result = await auth.refresh(refreshToken);
52
- ```
53
- ***
54
-
55
- ## Why Authenik8-core?
56
-
57
-
58
- JWT makes authentication look simple…
59
- …but introduces hidden problems:
60
-
61
- Refresh token reuse (replay attacks)
62
- Stateless logout issues
63
- Broken token rotation
64
- Scattered security logic
65
-
66
- Authenik8 solves this with:
67
-
68
- Refresh token rotation (with uniqueness via jti)
69
- Stateful session control (Redis)
70
- Built-in security (rate limit, IP whitelist, helmet)
71
- Clean, unified API
72
-
73
- ***
74
- ## Secure Refresh Flow
75
- ```
76
- // first use → valid
77
- await auth.refresh(token);
78
-
79
- // reuse same token → rejected
80
- await auth.refresh(token); // ❌ throws
81
- ```
82
- ***
83
-
84
- ## API Overview
85
- ```
86
- const auth = await createAuthenik8(config);
87
-
88
- // auth
89
- auth.signToken(payload);
90
- auth.verifyToken(token);
91
-
92
- // refresh
93
- auth.refresh(refreshToken);
94
- auth.generateRefreshToken(payload);
95
-
96
- // security
97
- auth.rateLimit;
98
- auth.ipWhitelist;
99
- auth.helmet;
100
-
101
- // middleware
102
- auth.requireAdmin;
103
- ```
104
- ***
105
- ## Architecture
106
-
107
- ```
108
- ┌───────────────┐
109
- │ Client │
110
- │ (Web / Mobile)│
111
- └───────┬───────┘
112
- │
113
- ▼
114
- ┌─────────────────────┐
115
- │ API / Backend │
116
- └─────────┬───────────┘
117
- │
118
- ▼
119
- ┌─────────────────────┐
120
- │ Authenik8-core │
121
- │─────────────────────│
122
- │ JWT Service │
123
- │ - Sign / Verify │
124
- │ │
125
- │ Refresh Service │
126
- │ - Rotation │
127
- │ - Replay Detection │
128
- │ │
129
- │ Security Module │
130
- │ - Rate Limiting │
131
- │ - IP Controls │
132
- │ - Middleware │
133
- └─────────┬───────────┘
134
- │
135
- ▼
136
- ┌─────────────────────┐
137
- │ Redis │
138
- │─────────────────────│
139
- │ Session Store │
140
- │ Token State │
141
- │ Revocation Data │
142
- └─────────────────────┘
143
-
144
- ```
145
- ***
146
-
147
- ## Important
148
-
149
- Authenik8-core uses stateful JWT authentication.
150
- This means:
151
- Requires Redis (or compatible store)
152
- Provides stronger security and control than stateless JWT
153
-
154
- ## Add your files
155
-
156
- ```
157
- cd existing_repo
158
- git remote add origin https://gitlab.com/COD434/authenik8-core.git
159
- git branch -M main
160
- git push -uf origin main
161
- ```
162
-
163
- ***
164
- ## Built with Real Testing
165
-
166
- Authenik8-core includes integration-tested flows for:
167
-
168
- Token rotation
169
- Replay attack prevention
170
- Secure refresh logic
171
-
172
- ***
173
- ### Threats Addressed
174
-
175
- - Refresh token replay attacks
176
- - Concurrent token refresh abuse
177
- - Stateless session vulnerabilities
178
- - Basic rate limit bypass (IP rotation)
179
-
180
- ***
181
- ## How It Works Internally
182
- Authenik8-core is designed around stateful JWT authentication to address real-world attack scenarios.
183
- ## Refresh Token Rotation
184
-
185
- Each refresh token includes a unique identifier (jti).
186
- Flow:
187
-
188
- Token is issued with a jti
189
-
190
- jti is stored in Redis
191
- On refresh:
192
-
193
- Token is validated
194
- jti is checked against Redis
195
-
196
- If valid:
197
-
198
- Old token is invalidated
199
- New token is issued with a new jti
200
-
201
- ## Replay Attack Detection
202
-
203
- If a refresh token is reused:
204
-
205
- The jti no longer exists or is marked as used
206
- The request is rejected immediately
207
- This prevents:
208
-
209
- Token replay attacks
210
- Concurrent refresh abuse
211
-
212
- ## Stateful Session Control
213
- Unlike traditional JWT systems:
214
- Sessions are tracked in Redis
215
- Tokens can be revoked
216
- Logout is fully enforced
217
-
218
- ## Security Layer
219
- Authenik8-core includes built-in middleware for:
220
- Rate limiting
221
- IP-based controls
222
- Secure headers (Helmet)
223
- These operate alongside authentication to provide: 👉 a unified security layer
224
-
225
- ## Why Stateful Matters
226
- Stateless JWT:
227
- Cannot revoke tokens easily
228
- Cannot detect reuse
229
- Cannot track behavior
230
- Authenik8-core:
231
- Tracks token lifecycle
232
- Detects anomalies
233
- Enables real control over sessions
234
- ***
34
+ - [Replay-attack prevention example](docs/replay-attack-prevention.md)
35
+ - [Secure refresh flow](docs/secure-refresh-flow.md)
36
+ - [Key rotation](docs/key-rotation.md)
37
+ - [Session risk and quarantine](docs/session-risk-quarantine.md)
38
+ - [Agent and service identity](docs/agent-service-identity.md)
235
39
 
40
+ ### Authorization and API
236
41
 
237
- ## Use Cases
42
+ - [Authorization, tenants, and audit events](docs/authorization-tenants-audit.md)
43
+ - [API overview](docs/api-overview.md)
44
+ - [Security layer](docs/security-layer.md)
238
45
 
239
- SaaS backends
240
- APIs with authentication
241
- Secure admin systems
242
- Systems requiring session control
46
+ ### Design and Internals
243
47
 
244
- ***
48
+ - [Architecture](docs/architecture.md)
49
+ - [How it works internally](docs/how-it-works-internally.md)
50
+ - [Refresh-token rotation](docs/refresh-token-rotation.md)
51
+ - [Replay-attack detection](docs/replay-attack-detection.md)
52
+ - [Stateful session control](docs/stateful-session-control.md)
53
+ - [Why stateful authentication matters](docs/why-stateful-matters.md)
245
54
 
246
- ## Final Thought
55
+ ### Assurance and Project Information
247
56
 
248
- JWT alone is not an authentication system.
249
- Authenik8-core makes it one.
250
- ***
57
+ - [Testing](docs/testing.md)
58
+ - [Security audit](docs/security-audit.md)
59
+ - [Threats addressed](docs/threats-addressed.md)
60
+ - [Full threat model](THREAT_MODEL.md)
61
+ - [Repository setup](docs/repository-setup.md)
62
+ - [Changelog](CHANGELOG.md)
@@ -0,0 +1,162 @@
1
+ # Authenik8-core Threat Model
2
+
3
+ This document describes the controls implemented by the SDK and the security
4
+ responsibilities that remain with its operator. It is not a certification or a
5
+ claim of compliance with a military, government, or industry assurance scheme.
6
+ Those claims require independently defined requirements, accredited assessment,
7
+ deployment review, and operational evidence.
8
+
9
+ ## Assets
10
+
11
+ - Access, refresh, and agent signing keys.
12
+ - Human, guest, administrator, and agent identities.
13
+ - Active sessions, refresh families, revocation markers, and quarantine state.
14
+ - OAuth state, identity records, provider links, and email/provider indexes.
15
+ - Authorization claims, tenant boundaries, and audit-event integrity.
16
+ - Redis availability and integrity.
17
+
18
+ ## Adversaries
19
+
20
+ - Unauthenticated attackers sending malformed tokens, OAuth parameters,
21
+ forwarding headers, IP values, or high request volumes.
22
+ - Authenticated users attempting claim, tenant, role, permission, or account-link
23
+ escalation.
24
+ - Token thieves replaying access, refresh, guest, or agent bearer credentials.
25
+ - Concurrent attackers racing refresh, OAuth-state, identity-create, or
26
+ provider-link operations.
27
+ - Compromised agents attempting scope or delegation escalation.
28
+ - Attackers with partial infrastructure access, including an untrusted proxy or
29
+ the ability to submit data consumed by an audit sink.
30
+
31
+ ## Trust Boundaries
32
+
33
+ The application, its signing-key source, its identity adapter, and Redis are in
34
+ the trusted computing base. Redis compromise can alter sessions, OAuth indexes,
35
+ refresh state, rate limits, and quarantine records; it can therefore cause
36
+ account takeover, forced logout, policy bypass, or denial of service.
37
+
38
+ Google and GitHub responses are trusted only after HTTPS success checks and
39
+ provider-specific identity verification. Forwarding headers are trusted only
40
+ when the direct socket peer and each intervening hop match explicitly configured
41
+ proxy CIDRs.
42
+
43
+ ## Enforced Security Invariants
44
+
45
+ ### Tokens and sessions
46
+
47
+ - New deployments use ES256 P-256 JWKs with bounded key rings, unique `kid`
48
+ values, issuer, audience, expiry, and exact `tokenUse` verification.
49
+ - Published JWKS documents contain only allowlisted public EC fields. Local
50
+ verification rejects private or oversized key sets; remote JWKS URLs require
51
+ credential-free HTTPS.
52
+ - The HS256 migration path requires an independent secret containing at least 32
53
+ bytes. Refresh and access HMAC secrets may not be the same.
54
+ - Access tokens are limited to 24 hours, refresh tokens to 31 days, and agent
55
+ tokens to one hour. Compact JWT and signed-payload sizes are bounded.
56
+ - Stateful verification requires the token fingerprint to match the current
57
+ Redis session and rejects revoked or quarantined sessions.
58
+ - Refresh rotation uses a per-session lock plus atomic compare-and-set. Replay or
59
+ a lost rotation race revokes the refresh family.
60
+ - Redis stores SHA-256 token fingerprints rather than newly issued raw bearer
61
+ tokens. Read-only migration support remains for older access-session records.
62
+ - Compound refresh and lock keys use collision-resistant identifiers, and
63
+ persisted sessions must match the Redis hash field from which they were read.
64
+ - Authorization claim collections and values are bounded at issuance and again
65
+ after signature verification.
66
+
67
+ ### OAuth identity
68
+
69
+ - State is 256 random bits, expires within five minutes, has a strict shape, and
70
+ is atomically read and deleted before token exchange. Custom state stores must
71
+ implement the same one-time `take()` guarantee.
72
+ - Link mode must be explicit and is rejected before state creation unless an
73
+ authenticated user ID is present.
74
+ - A link callback can modify only the authenticated user recorded in state.
75
+ Provider-supplied email is never used to choose the link target.
76
+ - Redis identity creation atomically distinguishes `created`,
77
+ `existing-provider`, and `existing-email`. An email collision never authorizes
78
+ token issuance.
79
+ - Provider linking uses optimistic compare-and-set with bounded retries and
80
+ verifies the resulting link before success. Identity transaction keys share a
81
+ Redis Cluster hash slot.
82
+ - Identity indexes are cross-checked against resolved records. Adapter-returned
83
+ users are bounded and validated before any account decision or token
84
+ issuance.
85
+ - Automatic verified-email linking is disabled by default. If an application
86
+ explicitly enables it, policy and email-verification values must be actual
87
+ booleans and the adapter must persist and verify the link before tokens are
88
+ issued.
89
+ - OAuth provider requests time out and decompressed JSON responses are capped at
90
+ 64 KiB before strict response-shape validation.
91
+
92
+ ### Network and HTTP controls
93
+
94
+ - Client IP resolution starts at `socket.remoteAddress`; it never trusts
95
+ Express's already-processed `req.ip`.
96
+ - `X-Forwarded-For` is ignored unless `trustedProxyCidrs` is configured. The
97
+ chain is walked right-to-left and stops at the first untrusted hop. Malformed,
98
+ excessively long, or excessively deep chains fail closed.
99
+ - IPv4, IPv6, IPv4-mapped IPv6, and CIDR entries are canonicalized. Loopback is
100
+ not implicitly allowlisted.
101
+ - Exact IP allowlist membership and TTL are checked atomically. CIDR TTL cleanup
102
+ is batched instead of issuing one Redis request per entry.
103
+ - Rate-limit keys are bounded SHA-256 digests. OTP limiting applies both an
104
+ IP bucket and a normalized, bounded email bucket.
105
+ - Default CSP is enforcing and contains no `unsafe-inline` or placeholder
106
+ origins. HSTS, frame denial, MIME sniffing protection, and a no-referrer policy
107
+ are enabled.
108
+
109
+ ### State isolation and audit
110
+
111
+ - SDK Redis keys are isolated by an explicit prefix or a stable prefix derived
112
+ from issuer and audience. Caller-controlled identity index components are
113
+ hashed.
114
+ - Audit metadata is detached, bounded, recursively cloned, and deeply frozen.
115
+ One sink cannot mutate authorization state or the event delivered to another
116
+ sink.
117
+ - Audit envelope identifiers are bounded and control-character free. Stored
118
+ risk records, principals, counters, actions, and fingerprints are validated
119
+ before they influence quarantine decisions.
120
+ - Best-effort audit delivery contains synchronous and asynchronous sink
121
+ failures. Strict mode can deliberately fail the security operation.
122
+
123
+ ## Residual Risks and Operator Responsibilities
124
+
125
+ 1. Bearer credentials remain usable by a thief until expiry, revocation, or
126
+ quarantine. The SDK does not implement proof-of-possession or TLS channel
127
+ binding.
128
+ 2. Cookie authentication is disabled by default and has no built-in CSRF token
129
+ mechanism. Applications enabling it must enforce `Secure`, `HttpOnly`,
130
+ suitable `SameSite`, origin checks, and CSRF validation.
131
+ 3. Redis is security-critical. Use authenticated encrypted connections,
132
+ network isolation, least-privilege credentials, persistence, tested failover,
133
+ monitoring, protected backups, and a topology compatible with the Lua
134
+ operations used here.
135
+ 4. IP controls are defense in depth, not identity proof. NAT, mobile networks,
136
+ IPv6 privacy addresses, botnets, and IP rotation limit their effectiveness.
137
+ 5. The application must authenticate workloads before calling agent issuance.
138
+ Use mTLS, cloud workload identity, signed client assertions, or an equivalent
139
+ credential exchange.
140
+ 6. Offline JWKS verification cannot observe Redis revocation. Services that need
141
+ immediate revocation require a trusted online session/introspection boundary.
142
+ 7. Custom OAuth identity and state adapters are part of the trusted computing
143
+ base and must preserve uniqueness, atomicity, one-time consumption, and
144
+ authenticated-link invariants.
145
+ 8. The SDK does not replace TLS termination, secret-manager access controls,
146
+ host/container hardening, application input validation, CORS policy, XSS
147
+ prevention, durable audit storage, incident response, or supply-chain
148
+ controls.
149
+ 9. Fail-closed Redis behavior protects authorization but can reduce
150
+ availability. Capacity planning and failure-mode testing are required.
151
+ 10. CI intentionally uses `ioredis-mock` and starts no Redis service; operators must separately qualify
152
+ their exact Redis version, cluster/failover topology, and persistence
153
+ settings before production.
154
+
155
+ ## Verification Expectations
156
+
157
+ Every security fix should retain a regression test for its abuse case. Release
158
+ gates should include type checking, unit and mocked-Redis integration tests,
159
+ build verification, a lockfile-based dependency audit, secret scanning, static
160
+ analysis, and independent review of high-risk changes. Production qualification
161
+ should add real-topology Redis tests outside CI, penetration testing, deployment
162
+ configuration review, and recovery exercises.
@@ -0,0 +1,68 @@
1
+ import type { NextFunction, Request, Response } from "express";
2
+ import type { Authenik8JwkConfig } from "../auth/jwk";
3
+ import type { JwtPayload } from "../auth/jwtAuth";
4
+ import type { AuditEmitter } from "../audit/types";
5
+ import type { SessionRiskReporter } from "../risk/types";
6
+ import type { AgentIdentityApi, AgentIdentityConfig, AgentSessionMetadata, AgentTokenPayload, AgentTokenResult, IssueAgentTokenInput, IssueDelegatedAgentTokenInput } from "./types";
7
+ type AgentRedisClient = {
8
+ hget?: (key: string, field: string) => Promise<string | null>;
9
+ hgetall?: (key: string) => Promise<Record<string, string> | null>;
10
+ hset?: (key: string, field: string, value: string) => Promise<unknown>;
11
+ hdel?: (key: string, field: string) => Promise<unknown>;
12
+ expire?: (key: string, seconds: number) => Promise<unknown>;
13
+ exists?: (key: string) => Promise<number>;
14
+ set?: (key: string, value: string) => Promise<unknown>;
15
+ del?: (key: string) => Promise<unknown>;
16
+ };
17
+ export interface AgentIdentityServiceOptions {
18
+ config: AgentIdentityConfig;
19
+ redisClient: AgentRedisClient;
20
+ jwk?: Authenik8JwkConfig;
21
+ legacySecret?: string;
22
+ issuer: string;
23
+ audience: string | string[];
24
+ verifyHumanToken: (token: string) => Promise<JwtPayload | null>;
25
+ hasHumanSession: (userId: string, sessionId: string) => Promise<boolean>;
26
+ audit?: AuditEmitter;
27
+ risk?: SessionRiskReporter;
28
+ keyPrefix?: string;
29
+ }
30
+ export declare class AgentIdentityError extends Error {
31
+ readonly code: "AGENT_INVALID" | "AGENT_REVOKED" | "AGENT_SCOPE_DENIED" | "AGENT_DELEGATION_DENIED" | "AGENT_SESSION_REQUIRED";
32
+ constructor(code: "AGENT_INVALID" | "AGENT_REVOKED" | "AGENT_SCOPE_DENIED" | "AGENT_DELEGATION_DENIED" | "AGENT_SESSION_REQUIRED", message: string);
33
+ }
34
+ export declare class AgentIdentityService implements AgentIdentityApi {
35
+ private readonly config;
36
+ private readonly redis;
37
+ private readonly keyRing;
38
+ private readonly sessions;
39
+ private readonly verifyHumanToken;
40
+ private readonly hasHumanSession;
41
+ private readonly audit?;
42
+ private readonly risk?;
43
+ private readonly keyPrefix;
44
+ private readonly tokenExpirySeconds;
45
+ constructor(options: AgentIdentityServiceOptions);
46
+ issueToken(input: IssueAgentTokenInput): Promise<AgentTokenResult>;
47
+ issueDelegatedToken(input: IssueDelegatedAgentTokenInput): Promise<AgentTokenResult>;
48
+ verifyToken(token: string): Promise<AgentTokenPayload | null>;
49
+ requireAgent: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
50
+ requireScopes(...scopes: string[]): (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
51
+ listSessions(agentId: string): Promise<AgentSessionMetadata[]>;
52
+ revokeSession(agentId: string, sessionId: string): Promise<void>;
53
+ revokeAgent(agentId: string): Promise<void>;
54
+ activateAgent(agentId: string): Promise<void>;
55
+ private issue;
56
+ private resolveActiveAgent;
57
+ private authorizedScopes;
58
+ private claimsAreValid;
59
+ private authenticate;
60
+ private isRevoked;
61
+ private revokedKey;
62
+ private scoped;
63
+ private riskPrincipal;
64
+ private rejectVerifiedAgent;
65
+ private auditAgentRejection;
66
+ }
67
+ export {};
68
+ //# sourceMappingURL=agentIdentity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentIdentity.d.ts","sourceRoot":"","sources":["../../src/agent/agentIdentity.ts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