Make quality snapshot comments safe for fork PRs
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 65/100
Rechercherichtung
Beginne mit den performance- und coverage-pull_request-Workflows, insbesondere deren in-progress- und final-marocchino/sticky-pull-request-comment-Schritten. Verwende PR #521 und die verknüpften performance- und coverage-Läufe, um den Fork-Token-Fehler zu reproduzieren. Als abgeschlossen gilt die Änderung, wenn Fork-Jobs mit schreibgeschütztem Zugriff abgeschlossen werden, während die Gates fail-closed bleiben, Kommentare im selben Repository weiterhin funktionieren und Berichte in Zusammenfassungen und Artefakten verfügbar bleiben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Problem
Pull requests from forks receive a read-only GITHUB_TOKEN, even when a pull_request workflow declares pull-requests: write. The performance and coverage workflows currently invoke marocchino/sticky-pull-request-comment before running their substantive work.
PR #521 reproduced the failure across all performance and coverage jobs:
- the workflow token had
PullRequests: readandSecret source: None; - the initial sticky-comment step failed with
Resource not accessible by integration; - normal benchmark/coverage steps were then skipped because the preceding step failed;
always()upload/comparison steps ran withoutmetrics.jsonorlcov.info, producing cascading snapshot failures; and- the final sticky-comment step failed with the same permission error.
The regular build, test, lint, and environment jobs passed, confirming that this was a fork-permission failure rather than a problem with the action pins in PR #521.
Security constraint
Fork workflows must remain untrusted and read-only:
- do not grant fork pull requests write access or repository secrets;
- do not use
pull_request_targetto execute or otherwise consume untrusted pull-request code; and - do not weaken the fail-closed behavior of the actual performance and coverage gates.
Tasks
- Detect fork pull requests before invoking PR-comment-writing actions.
- Skip both in-progress and final sticky-comment steps when the token cannot write, while allowing the benchmark/coverage work and snapshot comparisons to continue.
- Ensure comment publishing itself is non-gating: a comment API failure must not suppress or replace the underlying quality-gate result.
- Preserve sticky performance and coverage comments for same-repository pull requests.
- Keep reports available to fork contributors through job summaries and uploaded artifacts.
- Audit other
pull_requestworkflows for write operations with the same fork-token assumption.
Acceptance criteria
- A fork PR runs the complete performance and coverage jobs using only a read-only token.
- Fork runs do not attempt to create or update PR comments and do not report
Resource not accessible by integration. - Performance or coverage regressions still fail their jobs for both fork and same-repository PRs.
- Missing or malformed benchmark/coverage output still fails closed.
- Same-repository PRs continue receiving sticky snapshot comments.
- Fork reports remain inspectable in the GitHub step summary and artifacts.
- The solution does not use
pull_request_target, expose secrets, or grant write permissions to untrusted fork code.
Reproduction
- PR: #521
- Performance run: https://github.com/microsoft/python-environment-tools/actions/runs/31991321814
- Coverage run: https://github.com/microsoft/python-environment-tools/actions/runs/31991321855
- Vorherrschende Sprache
- Rust
- Sterne
- 207
- Forks
- 45
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoft/python-environment-tools
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
microsoft/python-environment-tools#520 · 2 Kommentare · 1 zugewiesene Person ·
Alle Issues in microsoft/python-environment-tools
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
bug team:backend track:services-maintenance
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
cowprotocol/services#4950 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
gitbutlerapp/gitbutler#15998 · 1 Kommentar ·