Skip to content

chore(ci): harden Gemini issue triage against prompt injection - #1772

Open
kikoso wants to merge 1 commit into
mainfrom
chore/harden-issue-triage
Open

chore(ci): harden Gemini issue triage against prompt injection#1772
kikoso wants to merge 1 commit into
mainfrom
chore/harden-issue-triage

Conversation

@kikoso

@kikoso kikoso commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Thank you for opening a Pull Request!


Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Edit the title of this pull request with a semantic commit prefix (e.g. "fix: "), which is necessary for automated release workflows to decide whether to generate a new release and what type it should be.
  • Will this cause breaking changes to existing Java or Kotlin integrations? If so, ensure the commit has a BREAKING CHANGE footer so when this change is integrated a major version update is triggered. See: https://www.conventionalcommits.org/en/v1.0.0/
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Description

We received an external security report noting that issue titles and bodies flow untrusted into the Gemini prompt used by the issue triage workflow, so a crafted issue can steer the model output that drives label application (prompt injection). The practical impact is limited (the workflow already only applies one priority:* label to the triggering issue), but this PR tightens the trust boundary:

  • Validate model output in triage_issue.py against an exact allowlist of the five priority labels. Non-strings are dropped, whitespace and newlines are collapsed before comparison, and anything outside the set is discarded.
  • Strip newlines from the script output before writing to GITHUB_OUTPUT, so untrusted output cannot inject additional output keys.
  • Wrap the untrusted issue content in <issue_content> delimiters and instruct the model to treat it as data only, ignoring any instructions inside it.
  • Add a per-issue concurrency group with cancel-in-progress: true, so rapid edit loops on a single issue cancel the in-flight run instead of stacking Gemini API calls (quota abuse).

No library code is touched, so no breaking changes and no release is needed (hence the chore(ci) prefix). This addresses a privately reported security concern, so there is no public tracking issue.

https://claude.ai/code/session_01DMAbzVdHqDdyoCKpub2bTC

Issue titles and bodies are untrusted input that flows into the Gemini
prompt, so a crafted issue can steer the model output that drives label
application. This change limits the blast radius:

- Validate model output against an exact allowlist of the five
  priority labels; drop anything else, including non-strings and
  labels containing newlines or extra whitespace.
- Strip newlines before writing to GITHUB_OUTPUT so script output
  cannot inject additional output keys.
- Wrap the untrusted issue content in delimiters and instruct the
  model to treat it as data only.
- Add a per-issue concurrency group with cancel-in-progress so rapid
  edit loops cannot stack Gemini API calls.

Claude-Session: https://claude.ai/code/session_01DMAbzVdHqDdyoCKpub2bTC
@googlemaps-bot

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 50.4% 🍏

There is no coverage information present for the Files changed

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.

3 participants