Skip to content

[uk-ai-resilience] [security] Review CWE-78 command injection in upgrade_command.go and runner_guard.go (Sighthound #46729, Tier [Content truncated due to length] #46882

Description

@github-actions

Summary

Sighthound identified critical CWE-78 Command Injection findings in two pkg/cli/ files. These are Tier C — Restricted Pending Review under the UK AI Open Code Governance assessment.

Findings

1. pkg/cli/upgrade_command.go:482relaunchWithSameArgs

newArgs := append(append([]string(nil), os.Args[1:]...), extraFlag)
exe, _ := os.Executable()
cmd := exec.Command(exe, newArgs...)

exe comes from os.Executable() (safe), but newArgs derives from os.Args[1:] which may be attacker-influenced in some execution contexts. The Sighthound finding flags dynamic data in newArgs.

Remediation: Constrain newArgs explicitly — only pass known-safe flags rather than forwarding raw os.Args. Add a validation allowlist for permitted arguments.


2. pkg/cli/runner_guard.go:68 — Docker volume mount with scanPath

// #nosec G204 -- gitRoot comes from git rev-parse (trusted source) and is validated as absolute path.
cmd := exec.Command("docker", "run", "--rm", "-v", gitRoot+":/workdir", "-w", "/workdir", RunnerGuardImage, "scan", scanPath, ...)

The #nosec G204 annotation covers gitRoot but scanPath may be derived from user-supplied relative directory paths. A crafted scanPath containing : or path separators could alter the Docker volume mount syntax.

Remediation: Explicitly validate scanPath as a clean relative path (no :, no ..). Consider filepath.Clean + a character allowlist before interpolation.

Risk Scoring (UK AI Governance)

Dimension Score
Exposure amplification (AI-authored exec paths) 4/5
Patchability 2/5
Detectability 3/5
Operational fragility 4/5
Ownership confidence 3/5
Overall 3.2 — Tier C

SLA

High — resolve within 7 days.

Discussion

Full governance report: [uk-ai-resilience] Risk & Resilience Governance Report — 2026-07-20

References

Generated by UK AI Operational Resilience · 100.9 AIC · ⌖ 5.86 AIC · ⊞ 5.2K ·

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions