Watch
1
0
Fork
You've already forked RedFlag
0

sanitize: remove internal audit tracker from public branch

This commit is contained in:
Fimeg 2026-05-22 16:15:37 -04:00
commit 2c3551c639

View file

@ -1,49 +0,0 @@
# Pre-v0.2.0 Security & Integrity Audit
Found during the v0.2.0 version-string fix session (2026-05-21).
## 1. Zero-UUID signed packages
**File:** `server/internal/services/signing.go:203`
**Status:** Fixed
**Issue:** `SignFile` never set `ID` on `AgentUpdatePackage`, so all 4 platform entries collided on `00000000-0000-0000-0000-000000000000`. 3 of 4 platforms silently failed to get signed agent binaries.
**Fix:** Added `ID: uuid.New()` before binary path.
## 2. Split-brain `UpdateAgentUpdatingStatus`
**Files:** `server/internal/database/queries/agents.go:318` vs `agent_updates.go:178`
**Status:** Fixed (switched handler to `agentUpdateQueries`)
**Issue:** Two implementations with different rollback behavior — `agents.go` NULLs `update_initiated_at`, `agent_updates.go` preserves it. Handler (`agent_updates.go:119`) was calling the wrong one.
**Fix:** All callers switched to `agentUpdateQueries.UpdateAgentUpdatingStatus`. The `agents.go` version is now dead code and should be removed.
## 3. `update_initiated_at` type mismatch
**File:** `server/internal/database/queries/agents.go:337`
**Status:** Fixed
**Issue:** Go `time.Time` passed as `$3` into a CASE expression confused PostgreSQL's type inference → `pq: column "update_initiated_at" is of type timestamp but expression is of type text`.
**Fix:** Both implementations now use `NOW()` in SQL instead of passing Go time.
## 4. `security_settings` missing `created_at` column
**Files:** `security_settings` migration + `security_settings_service.go`
**Status:** Unresolved
**Issue:** Code references `created_at` but the migration never added the column. Causes `failed to initialize default security settings` at startup.
**Impact:** Security settings fall back to hardcoded defaults instead of DB values.
## 5. ETHOS: Fragmented time handling — no universal clock
**Files:** Multiple
**Status:** Unresolved
**Issue:** Time is set in at least 3 different ways across the codebase, violating ETHOS consistency:
- Go `time.Now()` passed as query params (agents.go, agent_updates.go — caused the type mismatch bug #3)
- SQL `NOW()` in some queries (agent_updates.go after fix)
- Trigger `ON UPDATE` for `updated_at` on `agent_commands` (but no default on INSERT)
- Manual `.UpdatedAt = time.Now()` assignment in `subsystems.go:52`
**Impact:** Inconsistent timestamps, NULL scan errors, unclear source of truth for when things happened. Should be one canonical mechanism.
## 6. `agent_commands.updated_at` NULL on scan
**File:** `server/internal/models/command.go:24`, `agent_commands` table
**Status:** Partially fixed (model changed to `*time.Time`)
**Issue:** `updated_at` column has no DEFAULT, trigger only fires on UPDATE. Old rows (or rows never updated) have NULL. Go `time.Time` can't scan NULL → `sql: Scan error on column index 17`.
**Fix (partial):** Changed model to `*time.Time`. Still need DB migration to add DEFAULT and backfill.
## 7. `-dirty` version string root cause (resolved)
**File:** `server/Dockerfile`
**Status:** Fixed
**Issue:** `.git/index` inside Docker build context referenced files outside the build context (partial checkout), causing `git describe --tags --dirty --always` to always return dirty.
**Fix:** Version now computed on host via `BUILD_VERSION` build arg instead of inside Docker.