Skip to content

[Hermes] Harden CI workflow security and add .gitattributes#13

Merged
Coding-Dev-Tools merged 1 commit into
masterfrom
hermes/apighost/harden-ci-security-add-gitattributes
May 19, 2026
Merged

[Hermes] Harden CI workflow security and add .gitattributes#13
Coding-Dev-Tools merged 1 commit into
masterfrom
hermes/apighost/harden-ci-security-add-gitattributes

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Summary

Harden CI workflow security and add .gitattributes for consistent line endings.

Why this change

  • actions/checkout persists the GitHub token in .git/config by default, allowing any later step to exfiltrate it. Non-push workflows should use persist-credentials: false.
  • publish.yml had no top-level permissions: block, granting overly broad default permissions.
  • No .gitattributes file existed, risking cross-platform line-ending corruption (CRLF/LF mismatches).

What changed

  • .gitattributes: Added with * text=auto eol=lf for consistent line endings
  • publish.yml: Added permissions: contents: read and persist-credentials: false on checkout
  • pages.yml: Added persist-credentials: false on checkout

Validation

  • All 71 tests pass (pytest tests/ -v)
  • ruff check clean (ruff check src/ tests/)
  • pyflakes clean (no undefined names or unused imports)
  • YAML syntax valid for both modified workflows

Risks

  • Minimal — persist-credentials: false only affects token storage in .git/config, not the checkout itself. Publish workflow still uses TWINE_PASSWORD from secrets for PyPI upload. Pages workflow still has pages: write and id-token: write permissions for deployment.

Follow-ups

  • Consider adding dependabot.yml updates for gitleaks or other security scanning (already has pip + actions dependabot)

- Add .gitattributes for consistent LF line endings across platforms
- Add persist-credentials: false to pages.yml checkout step
- Add permissions: contents: read to publish.yml
- Add persist-credentials: false to publish.yml checkout step

Prevents credential exfiltration from non-push workflows and
stops cross-platform line-ending corruption.
@Coding-Dev-Tools Coding-Dev-Tools merged commit b264414 into master May 19, 2026
5 checks passed
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