Skip to content

ci(security): propagate least-privilege tokens to docouture workflows - #298

Merged
viodid merged 1 commit into
mainfrom
fix/propagate-workflow-hardening
Oct 5, 2026
Merged

viodid merged 1 commit into
mainfrom
fix/propagate-workflow-hardening

Conversation

@ivanasabi

Copy link
Copy Markdown
Contributor

Resumen

Propaga a este repo el hardening de los workflows docouture-* ya validado en InditexTech/internal-ops#768 (y aplicado en InditexTech/cerbia#20): resuelve los alertos Scorecard Token-Permissions heredados del scaffold (contents: write top-level / job-level sin acotar).

Qué cambia (los 6 workflows)

  • permissions: {} a nivel de workflow; permisos por job limitados a lo que cada job necesita (contents: read, pull-requests: write solo en los jobs que comentan).
  • Los pushes a gh-pages, tags docs/* y el bump de docs/.release-version autentican con el App token ya existente, ahora acotado (owner/repositories/permission-contents: write); GITHUB_TOKEN queda read-only y persist-credentials: false.
  • APP_PRIVATE_KEY pasa al reusable como secret explícito (nada de secrets: inherit).
  • Sin caches de dependencias ni de imágenes Kroki en las lanes que publican (vector de cache-poisoning).
  • Sustituido dorny/paths-filter por un diff git local.
  • Bonus: release ya no dispara con pre-releases de código y el guard de ref usa env (sin template injection).

Nota: el sitio de docs de este repo no tiene Kroki activado, así que el pull en frío no afecta.

Verificación

  • zizmor 1.29.0 sobre los 6: 0 hallazgos.
  • YAML válido en los 6 ficheros.
  • Misma matriz probada en producción: internal-ops ejecuta el publish encadenado con éxito desde el 10-02 y kumoss cortó una release de docs completa el 10-05 con la variante equivalente.

Adopts the hardened docouture workflow set from InditexTech/internal-ops#768:
workflow-level permissions {}, job permissions limited to what each job needs,
gh-pages/tag pushes via an App token narrowed to this repository with
contents: write, APP_PRIVATE_KEY passed explicitly to docouture-publish.yml
instead of secrets: inherit, no dependency or Kroki image caches on the lanes
that publish, and no third-party path filter (plain git diff instead).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 10:16
@ivanasabi
ivanasabi requested a review from a team as a code owner October 5, 2026 10:16
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

  • .github/workflows/docouture-release-preview.yml
  • .github/workflows/docouture-release.yml

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

❗ This Pull Request will not trigger a docs release

A Pull Request with no docs/release label will not trigger a docs site release — label it docs/release if you want this merge to release the docs site.

@sonarqubecloud

sonarqubecloud Bot commented Oct 5, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Oct 5, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The six workflows consistently implement the stated least-privilege model without identified functional regressions.

Review effort: Balanced
Findings: None

What changed in this PR

Hardens Docouture workflows with least-privilege authentication and safer publishing behavior.

Changes:

  • Uses job-scoped permissions and repository-scoped GitHub App tokens for writes.
  • Disables credential persistence and publishing caches.
  • Replaces third-party path filtering and prevents prereleases from moving stable documentation tags.
File Description
.github/​workflows/​docouture-release.yml Secures release tagging, version bumps, and reusable publishing.
.github/​workflows/​docouture-release-preview.yml Uses scoped API access for path checks, tag lookup, and comments.
.github/​workflows/​docouture-publish.yml Publishes using an explicitly passed, scoped App credential.
.github/​workflows/​docouture-publish-prerelease.yml Replaces path filtering with a local diff and scopes permissions.
.github/​workflows/​docouture-pr-verify.yml Applies job-level read access and disables persisted credentials.
.github/​workflows/​docouture-kroki-cache-warm.yml Restricts permissions and safely handles Docker image arguments.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@viodid
viodid merged commit 386d94f into main Oct 5, 2026
@viodid
viodid deleted the fix/propagate-workflow-hardening branch October 5, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants