microsoft / microsoft/python-environment-tools

Make quality snapshot comments safe for fork PRs

Abierto
#522 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug needs PR
Lenguaje dominante
Rust
Estrellas
207
Forks
45
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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: read and Secret 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 without metrics.json or lcov.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_target to 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_request workflows 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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con los workflows performance y coverage pull_request, especialmente con sus pasos in-progress y final marocchino/sticky-pull-request-comment. Usa PR #521 y las ejecuciones vinculadas de performance y coverage para reproducir el fallo del token del fork. Se considera terminado cuando los trabajos de los forks se completen con acceso de solo lectura mientras los gates sigan siendo fail-closed, los comentarios en el mismo repositorio continúen funcionando y los informes sigan disponibles en los resúmenes y artefactos.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
github-actions
Área
ci-cd, security
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
65/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.