How do you give CI read access to a private submodule or private dependency repo?
IntermediateProductionSecurity: secrets, signing, access and supply chain
Answer
<details> <summary><b>Answer</b></summary>
Use a GitHub App installation token minted per run (actions/create-github-app-token) with read access to the specific repos, instead of a PAT. For checkout, pass the token and enable submodules.
- uses: actions/create-github-app-token@v1
id: app
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_KEY }}
- uses: actions/checkout@v4
with: { token: "${{ steps.app.outputs.token }}", submodules: recursive }
More on Security: secrets, signing, access and supply chain
What are the first things you do when a secret is committed to a repo?BeginnerHow do you prevent secrets from entering the repo in the first place?IntermediateWalk through purging a leaked secret from a 5 GB repo with 200 contributors.AdvancedWhy use OIDC federation for cloud credentials from GitHub Actions instead of stored keys?IntermediateWhat is your policy on signed commits and how do you enforce it?IntermediateWhat do signed commits not protect against, and what supply chain controls complement them?Advanced