refactor(auth): standardize session management and security

- Centralize secret retrieval using `getAdminSessionSecret`
- Replace manual session parsing with `verifyRequestAdminSession` utility
- Tighten API validation and improve security headers handling
- Enforce environment variable security for production deployments
This commit is contained in:
Team Dark Devil committed 2026-11-18 05:18:55 +06:00
1 parent 34519c07df
commit 177ed4a844
78 files changed
+6748 -3157

No files matched your search

+17 -10
View File
@@ -1,16 +1,23 @@
# DataStack Environment Variables Configuration
# NOTE: In production (NODE_ENV=production), replace all placeholder values below with strong 32+ char secrets.
# Administrator Account (defaults to admin@datastack.dev / admin12345678 if omitted)
DATASTACK_ADMIN_EMAIL=admin@datastack.dev
DATASTACK_ADMIN_PASSWORD=admin12345678
# Security & Session Secrets (REQUIRED in production, min 32 characters)
DATASTACK_ADMIN_SESSION_SECRET=replace-with-32-plus-char-admin-session-secret
DATASTACK_JWT_SECRET=replace-with-32-plus-char-client-jwt-secret
DATASTACK_ADMIN_SETUP_KEY=replace-with-32-plus-char-admin-setup-key
DATASTACK_INTERNAL_SECRET=replace-with-32-plus-char-internal-service-secret
# Security & Session Secrets (min 32 characters)
DATASTACK_ADMIN_SESSION_SECRET=datastack-admin-session-default-secret-32-chars
DATASTACK_JWT_SECRET=datastack-jwt-default-secret-key-32-chars-long
DATASTACK_ADMIN_SETUP_KEY=datastack-default-setup-key-32-chars
# Administrator Account (development/in-memory bootstrap; production uses /vcon/setup)
DATASTACK_ADMIN_EMAIL=admin@example.com
# DATASTACK_ADMIN_PASSWORD=replace-with-strong-password
# DATASTACK_ALLOW_DEMO_ADMIN=false
# PostgreSQL Database (optional - in-memory fallback active when not configured)
# PostgreSQL Database (recommended for production persistence)
# DATABASE_URL=postgresql://datastack:password@localhost:5432/datastack_db
# Ingestion Engine Port (defaults to 4000)
PORT_SOCKET=4000
# Shared Redis Buffer (optional; enables cross-process buffering & distributed flush locks)
# REDIS_URL=redis://127.0.0.1:6379
# Service Networking
PORT_SOCKET=4000
INGESTION_INTERNAL_URL=http://127.0.0.1:4000