Skip to content

Prevent PII leakage in PR descriptions and add structured formatting#12

Open
galel12 wants to merge 1 commit into
flightctl:masterfrom
galel12:fix-pr-description
Open

Prevent PII leakage in PR descriptions and add structured formatting#12
galel12 wants to merge 1 commit into
flightctl:masterfrom
galel12:fix-pr-description

Conversation

@galel12
Copy link
Copy Markdown

@galel12 galel12 commented Feb 9, 2026

Problem

The bot's generated PR descriptions expose internal PII (Red Hat email addresses, internal Jira URLs) on public GitHub repositories, and the unstructured raw dump of Jira ticket content makes PRs difficult to review.

Root Cause

The PR body was constructed by directly embedding ticket.Fields.Description, ticket.Fields.Assignee.EmailAddress, and config.Jira.BaseURL into a fmt.Sprintf call with no sanitization or formatting. There was no scrubbing layer and no structured output — the AI-generated code changes were committed, but the PR description was always a static template filled with raw Jira data.

Solution

  • Updated all three AI prompt templates (claude_prompt.tmpl, gemini_prompt.tmpl, ticket_prompt.tmpl) to instruct the AI to output a structured ## PR Description section with Problem / Root Cause / Solution subsections.
  • Added parsePRDescription() to extract that section from the AI's response and use it as the PR body.
  • Added scrubPII() to strip email addresses and internal URLs before anything reaches GitHub.
  • Removed direct embedding of assignee emails and internal Jira links from the PR body.
  • Added unit tests for parsing, scrubbing, and the end-to-end PR body construction.

@galel12 galel12 self-assigned this Feb 9, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants