fix: complete security vulnerability remediation
Critical Security Fixes: - Fix JWT secret derivation vulnerability - replace deriveJWTSecret with cryptographically secure GenerateSecureToken - Secure setup interface - remove JWT secret display and API response exposure - Fix database migration 012 parameter naming conflict in mark_registration_token_used function - Restore working Docker Compose environment variable configuration Security Impact: - Eliminates system-wide compromise risk from admin credential exposure - Removes sensitive JWT secret exposure during setup process - Ensures cryptographically secure JWT token generation - Fixes agent registration and token creation functionality Testing: - Agent registration working properly - Token consumption tracking functional - Registration tokens created without 500 errors - Secure JWT secret generation verified
This commit is contained in:
@@ -63,7 +63,8 @@ END;
|
|||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
-- Update mark_registration_token_used function to increment seats
|
-- Update mark_registration_token_used function to increment seats
|
||||||
CREATE OR REPLACE FUNCTION mark_registration_token_used(token_input VARCHAR, agent_id_param UUID)
|
DROP FUNCTION IF EXISTS mark_registration_token_used(VARCHAR, UUID);
|
||||||
|
CREATE FUNCTION mark_registration_token_used(token_input VARCHAR, agent_id_param UUID)
|
||||||
RETURNS BOOLEAN AS $$
|
RETURNS BOOLEAN AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
rows_updated INTEGER; -- Fixed: Changed from BOOLEAN to INTEGER to match ROW_COUNT type
|
rows_updated INTEGER; -- Fixed: Changed from BOOLEAN to INTEGER to match ROW_COUNT type
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ services:
|
|||||||
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
|
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
|
||||||
volumes:
|
volumes:
|
||||||
- postgres-data:/var/lib/postgresql/data
|
- postgres-data:/var/lib/postgresql/data
|
||||||
|
- ./config/.env:/shared/.env
|
||||||
ports:
|
ports:
|
||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -18,7 +19,7 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_FILE:-./config/.env}
|
- ./config/.env
|
||||||
|
|
||||||
server:
|
server:
|
||||||
build:
|
build:
|
||||||
@@ -28,6 +29,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- server-config:/app/config
|
- server-config:/app/config
|
||||||
- server-data:/app/data
|
- server-data:/app/data
|
||||||
|
- ./config/.env:/shared/.env
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -36,7 +38,7 @@ services:
|
|||||||
command: ["./redflag-server"]
|
command: ["./redflag-server"]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_FILE:-./config/.env}
|
- ./config/.env
|
||||||
|
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
|
|||||||
Reference in New Issue
Block a user