Skip to content

Commit aba0323

Browse files
Copilothotlong
andcommitted
security: use explicit INSECURE_DEV_ONLY secret naming and add warning callouts
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent aa1c4e2 commit aba0323

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

apps/studio/src/mocks/createKernel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ export async function createKernel(options: KernelOptions) {
4444
console.log('[KernelFactory] Protocol service will be registered by ObjectQLPlugin');
4545

4646
// Register AuthPlugin for MSW/mock mode (gracefully skips HTTP route registration)
47+
// WARNING: This secret is for local development only — never use in production
4748
await kernel.use(new AuthPlugin({
48-
secret: 'mock-dev-secret-at-least-32-characters-long',
49+
secret: 'INSECURE_DEV_ONLY_mock_secret_do_not_use_in_production',
4950
baseUrl: 'http://localhost:5173',
5051
}));
5152

content/docs/guides/authentication.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,13 +615,15 @@ await kernel.use(new DriverPlugin(new InMemoryDriver(), 'memory'));
615615

616616
// AuthPlugin works without HonoServerPlugin — no HTTP server needed
617617
await kernel.use(new AuthPlugin({
618-
secret: 'mock-dev-secret-at-least-32-characters-long',
618+
secret: 'INSECURE_DEV_ONLY_mock_secret_do_not_use_in_production',
619619
baseUrl: 'http://localhost:5173',
620620
}));
621621

622622
await kernel.bootstrap();
623623
```
624624

625+
> ⚠️ **Warning:** The secret above is for **local development only**. In production, always use a strong random secret from an environment variable (`process.env.AUTH_SECRET`).
626+
625627
### Mock Fallback Endpoints
626628

627629
When no auth service handler or broker is available, `HttpDispatcher.handleAuth()` automatically provides mock responses for:
@@ -643,8 +645,9 @@ The Studio app's `createKernel()` factory includes AuthPlugin by default:
643645

644646
```typescript
645647
// apps/studio/src/mocks/createKernel.ts
648+
// WARNING: This secret is for local development only
646649
await kernel.use(new AuthPlugin({
647-
secret: 'mock-dev-secret-at-least-32-characters-long',
650+
secret: 'INSECURE_DEV_ONLY_mock_secret_do_not_use_in_production',
648651
baseUrl: 'http://localhost:5173',
649652
}));
650653
```

0 commit comments

Comments
 (0)