#147·hetty

use keyDir variable instead of string literal in LoadOrCreateCA

Author: MS-0x404Created May 4, 2026Updated May 4, 2026

In pkg/proxy/cert.go, line 99, os.Stat("keyDir") uses a string literal instead of the keyDir variable. This means the directory check for the CA certificate path is never evaluated correctly, potentially causing os.Create(caCertFile) to fail if the directory doesn't exist yet. The first block (lines 88-95) handles the CA key file path correctly using the variable — the second block is inconsistent:

// Line 99 — bug: if _, err := os.Stat("keyDir"); os.IsNotExist(err) {