Skip to content

fix(ci): harden GitHub Actions workflows (#129) - #131

Merged
adithya-s-k merged 3 commits into
mainfrom
security/workflow-hardening/pr-129
Sep 15, 2026
Merged

adithya-s-k merged 3 commits into
mainfrom
security/workflow-hardening/pr-129

Conversation

@hf-security-analysis

@hf-security-analysis hf-security-analysis Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Release tag expressions were interpolated directly into shell scripts. A valid Git tag containing command substitution could execute shell code during tag validation. Pass tag, version and repository values through quoted environment variables instead, following GitHub guidance.

Use contents: read as the workflow default, including reusable-workflow callers. The PyPI job needs no GITHUB_TOKEN scopes because it downloads the same run's artifact and uses the existing PyPI API token; only the release-asset upload job retains contents: write. Disable checkout credential persistence and automatic Node package-manager caching in the release workflow.

Action references remain at their existing full commit SHAs. The version-comment updates do not fix previously unpinned actions; the original automated report overstated those findings.

Test plan

  • Actionlint 1.7.12 validates all three modified workflows.
  • Zizmor 1.30.1 offline audit: no medium/high findings in these workflows. Low/informational suggestions about local workflow references and trusted publishing remain separate.
  • Local harmless injection reproduction: the old script creates a marker from a crafted valid Git tag; the new script rejects the tag without executing it. A normal version tag still passes.
  • Verify all action references are unchanged, default/job permissions are consistent, and same-run artifact downloads do not require a GitHub API token.
  • CI on the final revision, including Windows and Linux Python 3.12–3.14, docs, runtime contracts and wheel installation.

Out of scope

No runtime, dataset, package-version or published-release changes. PyPI credentials and authentication mode remain unchanged; this review does not perform another live publication. This does not establish that an external PR could trigger the release-only shell path, or that any compromise occurred.

Closes huggingface/tracking-issues#943

@adithya-s-k

Copy link
Copy Markdown
Collaborator

reviewed this and reproduced the tag-handling issue locally. i completed the workflow defaults and disabled saved checkout credentials / automatic release cache use. the action SHAs were already pinned, so i corrected that part of the description. workflow lint and the offline security checks pass; waiting on final CI before merging. no dataset or package release changes needed.

@adithya-s-k adithya-s-k left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

validated the final changes and all CI checks pass. the release-tag issue is reproducible and fixed; token permissions and credential handling are now explicit. no action SHA or package behavior changes. good to merge.

@adithya-s-k
adithya-s-k merged commit 022d1bd into main Sep 15, 2026
11 checks passed
@adithya-s-k

Copy link
Copy Markdown
Collaborator

merged with the extra permission and credential hardening. all CI checks are green; the release scripts were also checked locally. no package release or dataset update needed.

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.

1 participant