Skip to content

Harden project_command GraphQL construction against interpolation-based injection - #52758

Closed
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/uk-ai-resilience-verify-graphql-query
Closed

pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/uk-ai-resilience-verify-graphql-query

Conversation

Copilot AI commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Code scanning flagged workflow-go-graphql-injection-sprintf in pkg/cli/project_command.go for owner/project GraphQL lookups. This PR removes interpolation risk at those call sites by enforcing static GraphQL documents and variable-only input binding.

  • Query construction hardening

    • Owner/project GraphQL documents are defined as static constants (no Sprintf/string concat in query text).
    • Runtime values (login, number) are passed only via GraphQL variables in the JSON request body.
  • Call-site behavior

    • validateOwner, getOwnerNodeId, and getStatusField select from allow-listed static query templates by scope/type (org vs user) rather than constructing query strings dynamically.
  • Regression guardrails

    • Focused tests assert:
      • query text does not include user input,
      • variables carry user-controlled values as data,
      • required variable declarations remain present in query constants.
const validateOrgOwnerQuery = `query($login: String!) { organization(login: $login) { id login } }`

_, err := runProjectGraphQLQueryWithVariables(ctx, "Validating owner...", validateOrgOwnerQuery, map[string]any{
    "login": owner,
})

Copilot AI changed the title [WIP] Verify and parameterize GraphQL query construction in project_command.go Harden project_command GraphQL construction against interpolation-based injection Aug 14, 2026
Copilot AI requested a review from pelikhan August 14, 2026 16:35
@pelikhan pelikhan closed this Aug 14, 2026
@github-actions
github-actions Bot deleted the copilot/uk-ai-resilience-verify-graphql-query branch September 11, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[uk-ai-resilience] [UK AI Governance] Verify/parameterize GraphQL query construction in project_command.go (code scanning warnings)

2 participants