fix: migration runner and scan logging fixes
- Fix migration conflicts and duplicate key errors - Remove duplicate scan logging from agents - Fix AgentHealth UI and Storage page triggers - Prevent scans from appearing on wrong pages Fixes duplicate key violations on fresh installs and storage scans appearing on Updates page.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
-- Add machine_id column to agents table for hardware fingerprint binding
|
||||
-- Ensure proper UNIQUE constraint on machine_id for hardware fingerprint binding
|
||||
-- This prevents config file copying attacks by validating hardware identity
|
||||
-- NOTE: Migration 016 already added the machine_id column, this ensures proper unique constraint
|
||||
|
||||
ALTER TABLE agents
|
||||
ADD COLUMN machine_id VARCHAR(64);
|
||||
-- Drop the old non-unique index if it exists
|
||||
DROP INDEX IF EXISTS idx_agents_machine_id;
|
||||
|
||||
-- Create unique index to prevent duplicate machine IDs
|
||||
CREATE UNIQUE INDEX idx_agents_machine_id ON agents(machine_id) WHERE machine_id IS NOT NULL;
|
||||
-- Create unique index to prevent duplicate machine IDs (allows multiple NULLs)
|
||||
CREATE UNIQUE INDEX CONCURRENTLY idx_agents_machine_id_unique ON agents(machine_id) WHERE machine_id IS NOT NULL;
|
||||
|
||||
-- Add comment for documentation
|
||||
COMMENT ON COLUMN agents.machine_id IS 'SHA-256 hash of hardware fingerprint (prevents agent impersonation via config copying)';
|
||||
|
||||
Reference in New Issue
Block a user