π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Enable Claude Code Review for fork PRs with security controls
Manav Rathicc56bd370707
diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.ymlindex 653bfbcdfc..18ec266156 100644--- a/.github/workflows/claude-code-review.yml+++ b/.github/workflows/claude-code-review.yml@@ -1,22 +1,17 @@name: Claude Code Reviewon:- pull_request:+ pull_request_target:types: [opened, synchronize]- # Optional: Only run on specific file changes- paths:- - "**/*.ts"- - "**/*.tsx"- # - "src/**/*.js"- # - "src/**/*.jsx"jobs:claude-review:- # Optional: Filter by PR author- # if: |- # github.event.pull_request.user.login == 'external-contributor' ||- # github.event.pull_request.user.login == 'new-developer' ||- # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'+ # Only run for: owners, members, collaborators, and whitelisted contributors+ if: |+ github.event.pull_request.author_association == 'OWNER' ||+ github.event.pull_request.author_association == 'MEMBER' ||+ github.event.pull_request.author_association == 'COLLABORATOR' ||+ contains(fromJSON('["neeraj-pilot"]'), github.event.pull_request.user.login)runs-on: ubuntu-latestpermissions:@@ -29,7 +24,8 @@ jobs:- name: Checkout repositoryuses: actions/checkout@v4with:- fetch-depth: 0+ # IMPORTANT: Checkout the PR head ref from the fork for security+ ref: ${{ github.event.pull_request.head.sha }}- name: Run Claude Code Reviewid: claude-reviewdiff --git a/.github/workflows/claude.yml b/.github/workflows/claude.ymlindex 61dbc9f983..6de8177e5d 100644--- a/.github/workflows/claude.yml+++ b/.github/workflows/claude.yml@@ -28,7 +28,8 @@ jobs:- name: Checkout repositoryuses: actions/checkout@v4with:- fetch-depth: 0+ # For PR comments, checkout the PR head; otherwise checkout default branch+ ref: ${{ github.event.issue.pull_request && format('refs/pull/{0}/head', github.event.issue.number) || github.ref }}- name: Run Claude Codeid: claudediff --git a/.github/workflows/security-check-workflows.yml b/.github/workflows/security-check-workflows.ymlnew file mode 100644index 0000000000..0538f475de--- /dev/null+++ b/.github/workflows/security-check-workflows.yml@@ -0,0 +1,62 @@+name: Security - Check Workflows++on:+ pull_request:+ paths:+ - '.github/workflows/**'++jobs:+ check-pull-request-target:+ runs-on: ubuntu-latest+ environment:+ name: workflow-security-review+ # This requires admin approval in repository settings+ steps:+ - name: Checkout PR+ uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Check for pull_request_target in modified workflows+ run: |+ # Get list of modified workflow files+ MODIFIED_WORKFLOWS=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '^\.github/workflows/.*\.yml$' || true)++ if [ -z "$MODIFIED_WORKFLOWS" ]; then+ echo "No workflow files modified"+ exit 0+ fi++ echo "Checking modified workflows: $MODIFIED_WORKFLOWS"++ # Check if any modified workflow introduces pull_request_target+ VIOLATIONS=""+ for file in $MODIFIED_WORKFLOWS; do+ if git show HEAD:$file | grep -q "pull_request_target:"; then+ # Check if it existed in base branch+ if git show origin/${{ github.base_ref }}:$file 2>/dev/null | grep -q "pull_request_target:"; then+ echo "β $file: pull_request_target already existed (allowed)"+ else+ echo "β $file: NEW pull_request_target trigger detected!"+ VIOLATIONS="$VIOLATIONS\n- $file"+ fi+ fi+ done++ if [ -n "$VIOLATIONS" ]; then+ echo ""+ echo "β ERROR: New pull_request_target triggers detected in:$VIOLATIONS"+ echo ""+ echo "pull_request_target is a security-sensitive trigger that:"+ echo "- Runs in the context of the base repository"+ echo "- Has access to repository secrets"+ echo "- Can be exploited by malicious PRs"+ echo ""+ echo "If you need to add pull_request_target, please:"+ echo "1. Discuss with maintainers first"+ echo "2. Ensure proper security measures are in place"+ echo "3. Get explicit approval before merging"+ exit 1+ fi++ echo "β No new pull_request_target triggers detected"