Skip to content

GitHub Issue: Automated Quality Control Bypass in auto-pr-merge.yml #113267

@kuramaSeige-OFC

Description

@kuramaSeige-OFC

Security/Logic Bypass: Lack of Content Validation in auto-pr-merge.yml

Problem

The auto-pr-merge.yml workflow is designed to automate the merging of single-line additions to Contributors.md. However, the current implementation only validates the quantity of changes (1 line) and does not inspect the content of that line.

This creates a logic bypass where any user can automatically merge:

  • Non-formatted text that breaks the project's list structure.
  • Automated spam or malicious links.
  • Vandalism that bypasses human review.

Proof of Concept (PoC)

I have successfully demonstrated this vulnerability in PR #113266.

  • Action: I submitted a PR adding a line that did not follow the standard - [Name](Link) format.
  • Result: The github-actions[bot] automatically squashed and merged the commit 051acdc into main without any maintainer intervention.

Goal

The goal is to harden the automated contribution pipeline. By adding a content validation step, we can ensure that every auto-merged PR strictly adheres to the repository's formatting standards, protecting the project from spam while keeping the "first contribution" experience smooth for valid users.

Possible Solutions

The most effective fix is to introduce a Regex (Regular Expression) validation step in the GitHub Action. The workflow should extract the specific line added and verify it matches the required Markdown pattern before proceeding to the merge step.

Required Pattern: ^- \[.*\]\(https?://.*\)$

Suggested Validation Script (Bash):

# Extract the added line from the diff
ADDED_CONTENT=$(git diff HEAD^ HEAD -U0 | grep '^+' | grep -v '+++' | sed 's/^+//')

# Validate against the required format
if [[ "$ADDED_CONTENT" =~ ^-[[:space:]]\[.*\]\(https?://.*\) ]]; then
  echo "content_valid=true" >> $GITHUB_ENV
else
  echo "content_valid=false" >> $GITHUB_ENV
  echo "::error::Invalid format. Please use: - [Name](Link)"
  exit 1
fi

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions