Skip to content

[uk-ai-resilience] [security] Fix REST API path injection in outcome_eval.go (Semgrep #641/#642, CWE-89) #45519

Description

@github-actions

Summary

Semgrep alerts #641 and #642 (created 2026-07-14) flag ownerRepo and endpoint variables derived from user-supplied input being interpolated into GitHub REST API path strings via fmt.Sprintf without URL-path encoding.

File: pkg/cli/outcome_eval.go
Rule: workflow-graphql-injection-unescaped-input (severity: warning)
Locations: lines 231 and 253

Tier & Risk Scoring

Dimension Score Notes
Exposure amplification 3 User-controlled repo argument; REST API path affected
Patchability 1 Easy — wrap path components with url.PathEscape
Detectability 3 Would surface as unexpected API response
Operational fragility 3 Could redirect API calls or cause path traversal
Ownership confidence 4 CODEOWNERS covers pkg/cli/
Tier C — Restricted Pending Review

SLA: High — fix within 7 days.

Recommended Fix

Apply url.PathEscape to all path components derived from user input:

import "net/url"

// outcome_eval.go:231
path := fmt.Sprintf("/repos/%s/%s", url.PathEscape(owner), url.PathEscape(repo))

// outcome_eval.go:253
path := fmt.Sprintf("/repos/%s/%s", url.PathEscape(ownerRepo), url.PathEscape(endpoint))

Alternatively, build paths using url.URL struct to avoid manual escaping.

Governance Context

Identified by the UK AI Open Code Risk & Resilience Governance weekly scan (2026-07-14). See weekly discussion report for full tier classification and remediation queue.

References: Semgrep alert #641 · Semgrep alert #642 · §29347299534

Generated by UK AI Operational Resilience · 55.3 AIC · ⌖ 8.2 AIC · ⊞ 5.1K ·

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions