Skip to content

Defense-in-depth: encodeURIComponent repo segments in github-issues.ts #110

Description

@serge-ivo

From the connector security audit (2026-08). Follow-up hardening.

The connector path-injection HIGH was fixed in connectors/github.ts by charset-validating owner/name in ownerOf (a58db6e), which gates all four connector tools. But lib/github-issues.ts (listIssues/readIssue) builds github.com/ghapi URLs with the repo string too, and it has other callers that don't go through the connector validation:

  • lib/coding-inspect.ts:87,95
  • routes/coding.ts:316,318,464,480

These pass repo.githubRepo read from the coding_repos table — trusted (set via the validated add-repo flow) — so this is not currently exploitable, just defense-in-depth so the helper is safe regardless of caller.

Action

  • In github-issues.ts, split repo into owner/name, validate each against ^[A-Za-z0-9._-]+$ (reuse/share the SEGMENT regex from connectors/github.ts), and encodeURIComponent each segment when building the path.
  • (Optional) Confirm the add-repo flow (routes/coding.ts) validates githubRepo shape on write.

Severity: LOW (defense-in-depth; no known exploit path).

Files: workers/api/src/lib/github-issues.ts, workers/api/src/lib/coding-inspect.ts, workers/api/src/routes/coding.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    connectorsConnector + tool frameworksecuritySecurity hardening / audit finding

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions