From da0183c12edfc359b09e5a07cf66d83c1de5c018 Mon Sep 17 00:00:00 2001 From: Rodin Date: Fri, 1 May 2026 21:16:16 -0700 Subject: [PATCH] fix: symlink traversal + worst-wins pre-check + user scoping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Security (MAJOR): - Add filepath.EvalSymlinks after Clean for system-prompt-file - Re-validate resolved path is still within workspace - Prevents symlink → /etc/shadow exfiltration via malicious repo Worst-wins: - Check BEFORE posting (not after) — no delete+repost dance - Identify sibling bots by ", *reviewerName) + + // Worst-wins: if we would APPROVE but a sibling bot review (same token, + // different role) already has REQUEST_CHANGES, escalate to REQUEST_CHANGES. + // We identify sibling bot reviews by the ", *reviewerName) - if !strings.Contains(r.Body, sentinelCheck) { - log.Printf("Sibling review %d has REQUEST_CHANGES; escalating to REQUEST_CHANGES", r.ID) - event = "REQUEST_CHANGES" - break - } + if !r.Stale && r.State == "REQUEST_CHANGES" && strings.Contains(r.Body, "", *reviewerName) if *updateExisting && *reviewerName != "" { reviews, err := giteaClient.ListReviews(ctx, owner, repoName, prNumber) if err != nil {