Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ai-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# AI code review, delegated to klein-cli's reusable workflow.
#
# Trust model: this uses `on: pull_request` (NOT pull_request_target) and the
# job is gated to same-repository branches below, so the API-key secret is only
# ever exposed to code from contributors who already have push access. Fork PRs
# get no secrets and are skipped.
name: AI Review

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read
pull-requests: write

jobs:
review:
if: github.event.pull_request.head.repo.full_name == github.repository
uses: fpt/klein-cli/.github/workflows/ai-review-reusable.yml@main

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[major] Pin the reusable workflow to an immutable commit SHA (and update that SHA deliberately, ideally with an automated dependency-update process) instead of @main.

Rationale

Verified this is the only implementation of the new review job, and it receives OPENAI_API_KEY plus pull-requests: write. Because @main is mutable, a change or compromise in the external repository can alter the workflow that runs with this repository's secret and write token, allowing secret exfiltration or unauthorized PR mutations without any change here.

with:
language: en
secrets:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
Loading