Empty string clears a required WireGuard private key #137
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Medium to High. Found in the code review of the commits from 2026-11-04 to 2026-11-11 (
mainat6076be32). Still present onmainatadbeb2f4. Checked in the code; the review agent confirmed it with a test on a copy.Context
SecretKeep) or a new value.required(it must stay set) andnonempty. Today only the BGP password usesnonempty.Problem
pkg/models/secret_input.go:125–141correctly rejectsnullfor arequiredfield."", however, reachescheckSecretInput(:118), which only rejectsSecretKeep.internal/service/wireguard.go:452skips the key check when the key is empty.Impact
PUT /vpn/wireguardwith"private_key":""on an existing tunnel:private_key is required. The VPN stays down and the key is lost for good.nullwas covered,""was forgotten.Proposed change
requiredsecret fields, reject a present""likenull(400). In effect,requiredimpliesnonempty.requiredsecret field first, so that none legitimately accepts"".openapi.yaml.Validation
PUT /vpn/wireguardwith"private_key":""returns 400, and the stored key is unchanged.go veton the changed packages.References
849af24c, ADR 0021 and 0022.