department-of-veterans-affairs / va.gov-cms

Editor-centered management for Veteran-centered content.
https://prod.cms.va.gov
GNU General Public License v2.0
97 stars 69 forks source link

Investigate best practices for using external GitHub Actions. #10617

Closed ndouglas closed 1 year ago

ndouglas commented 2 years ago

Description

We had a rude awakening today about GitHub Actions, but this was in addition to some natural pre-existing concerns about GitHub Actions.

We should research and implement better practices.

Thoughts:

Acceptance Criteria

ndouglas commented 2 years ago

This might involve some changes to content-build as well.

See https://dsva.slack.com/archives/CU1E4CX9U/p1662129173118709

ndouglas commented 1 year ago

Copypasta from Slack:

I'm playing with a concept for improving this process in va.gov-cms. I did some work on GitHub Actions recently, and now I have another ticket that is "review best practices for GitHub Actions". There are substantial security considerations for using GHAs, and TBH I don't know if anyone has reviewed this stuff prior to or while working on our GHAs. (I know I haven't.) So I'm playing with the idea of having context-sensitive comments posted to the PR thread based on the code touched. Sort of like codeowners, but more "what should be checked based on what you touched."

For instance, if you touch any GHA workflow, did you check that:

  • the actions are up-to-date?
  • the actions are pinned to a commit, instead of a tag or not pinned at all?
  • no security vulnerabilities have been reported against the version?
  • the action doesn't inject unsanitized user input into trusted contexts?

Etc etc etc. I'm still in the very early stages of thinking about this, but given the burden of maintaining and updating codeowners and seeing that the subject-matter-expert load is distributed fairly, etc, it might be better if we can document in specific areas what needs to be checked and how.

EDIT: Of course, these instructions would only be posted if they're relevant to the specific files touched by the PR.

ndouglas commented 1 year ago

This document is great: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions

As mentioned in the previous commit, I'd like to post specific information in a comment on the PR thread corresponding to the areas of the codebase that are touched. I think I'll open a PR and test this out.