You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: improve shared secrets documentation and harden security
Fixed 14 issues across Broker, Gateway, Bridge, and SDK:
- Hardened CORS configuration in Gateway (#12)
- Enforced shared STATE_KEY and ENCRYPTION_KEY across services (#13)
- Fixed duplicate route registration in Broker (#15)
- Optimized HTTP Client usage in Broker (#16)
- Fixed Open Redirect vulnerability in SaveCredential (#17)
- Corrected misleading indentation and fixed tests for chi router (#18, #24)
- Added proper seeding for math/rand in Bridge and SDK (#19)
- Implemented exponential backoff for Bridge reconnections (#20)
- Removed dead code in Gateway (#22)
- Fixed fragile URL path parsing in Gateway (#23)
- Fixed flaky tests and ensured proper cleanup (#28)
- Implemented Provider Name Cache in Gateway (#29)
- Captured and logged ignored json.Encoder errors (#32)
All tests passed successfully.
Copy file name to clipboardExpand all lines: README.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,17 @@
2
2
3
3
The Nexus Framework is a provider-agnostic, secure integration layer for managing OAuth 2.0 and OIDC connections. It abstracts away the complexity of managing tokens, refreshes, and provider quirks, allowing your agents and services to focus on business logic.
4
4
5
+
## ⚠️ Critical Configuration
6
+
7
+
The Nexus Framework requires two primary shared secrets to operate securely:
8
+
9
+
1.**`ENCRYPTION_KEY`**: A 32-byte key used by the Broker to encrypt tokens at rest.
10
+
2.**`STATE_KEY`**: A 32-byte key shared between the Broker and Gateway to sign and verify the OAuth `state` parameter.
11
+
12
+
**Both services will refuse to start if these variables are missing or invalid.** In distributed deployments, the `STATE_KEY`**must** be identical across all Broker and Gateway instances, or OAuth callbacks will fail with "Invalid state" errors.
13
+
14
+
Generate a secure key with: `openssl rand -base64 32`
15
+
5
16
## Quick Start
6
17
7
18
The fastest way to get started is with Docker Compose. This will spin up the Broker, Gateway, Postgres, and Redis.
Copy file name to clipboardExpand all lines: docs/deployment.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,20 @@ Required — the broker will not start without these:
21
21
-`STATE_KEY`**(REQUIRED)**: Same as Broker — must match exactly.
22
22
-`BROKER_API_KEY`: Key to authenticate with the Broker.
23
23
24
+
## Shared Secrets Management
25
+
26
+
The Nexus Framework relies on two primary symmetric keys. Proper management of these keys is critical for security and availability.
27
+
28
+
### 1. `ENCRYPTION_KEY` (AES-256-GCM)
29
+
Used to encrypt decrypted OAuth tokens before they are stored in the database.
30
+
-**Risk**: If this key is changed or lost, all existing connections in the database will become unreadable. You will be forced to rotate the key and ask all users to re-authenticate.
31
+
-**Guidance**: Store this in a secure vault (Azure Key Vault, AWS Secrets Manager, HashiCorp Vault). It should be stable across deployments.
32
+
33
+
### 2. `STATE_KEY` (HMAC-SHA256)
34
+
Used to sign the `state` parameter during the initial redirect and verify it on callback.
35
+
-**Risk**: If the Broker and Gateway have different keys, all OAuth callbacks will fail with "Invalid state" errors.
36
+
-**Guidance**: Both the Broker and Gateway instances must receive the exact same value. In orchestrated environments (Kubernetes, Docker Swarm), use a shared Secret object.
0 commit comments