Specify default permissions for `codeql.yml`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Open .github/workflows/codeql.yml and first review its on: triggers and jobs: section. Add the specified workflow-level permissions block immediately before jobs:, then trigger the workflow in a personal test environment and verify it completes without permission errors. If it succeeds, include the test log when submitting the pull request.
Written by the indexing model from the issue text.
Description
Prerequisites
- Be a member of Hack for LA. (There are no fees to join.) If you have not joined yet, please follow the steps on our Getting Started page and attend an onboarding session.
- You have already read our How to Contribute to Hack for LA Guide.
Overview
We need to update the default permissions for the GitHub workflow specified in codeql.yml, so that it does not have more permissions than it needs.
Details
To align with GitHub security best practices, we want to specify the minimum required permissions for each workflow via a top-level permissions: block to ensure that workflows only have the access they need by default.
Every GitHub Actions workflow automatically receives a GITHUB_TOKEN with a set of default repository permissions defined in the repo settings which may result in the workflow having more permissions than it needs to complete its job. By explicitly defining minimum default permissions at the workflow level, we can ensure that workflow has only the permissions it needs. Then if a job or step requires more access, those permissions can be explicitly granted using job-level permissions statements or step-level tokens (PATs).
We performed an audit to identify the minimum top-level permissions required for each workflow. The goal of this and related issues is to verify that each workflow continues to function correctly with the explicitly defined permissions. This approach helps minimize unnecessary privileges and strengthen overall repository security.
For additional info, see issue #8178 and GitHub's recommendation for security best practice.
Action Items
Note that this issue involves testing GitHub Actions. See "Resources/Instructions" below for how to set up your personal environment for testing.
Refer to codeql.yml.
- Review the file to understand how the workflow is triggered. This is specified near the top of the YML in the
on:section. - Near the top of the file immediately before the line
jobs:insert:permissions: actions: read contents: read security-events: write - Use clean formatting: make sure there is one line separation above and one below the permissions block.
- If the workflow includes line(s) similar to the following, you will need to change these to match your situation before the workflow will run correctly:
orif: github.repository == 'hackforla/website'branches: - 'gh-pages' - Create the event to trigger the workflow and confirm whether it runs successfully with no further changes to the permissions.
- If there are errors:
- Try to determine the nature of the error, and whether it is occurring due to a mismatched repo or branch name.
- If you cannot track down the error, consult with the team via Slack or the weekly meetings to report your findings and get additional direction.
- If there are no errors, submit the PR like usual. Include a link to your test log.
Resources/Instructions
- Refer to https://github.com/hackforla/website/issues/6537#issuecomment-2041147335, especially Tips 6, 7, and 8, if you have not already created you personal environment for testing.
- How to Test GitHub Actions
- Additional Notes for GitHub Actions
- Tokens, Secrets, Scopes, & Permissions
- Dominant language
- JavaScript
- Stars
- 364
- Forks
- 873
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 12
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hackforla/website
-
Complexity: Small Feature: Infrastructure Ready for Prioritization role: back end/devOps role: front end size: 0.25pt
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Complexity: Small P-Feature: Project Info and Page ready for merge team role: front end size: 0.25pt
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
-
good first issue P-Feature: Project Info and Page Ready for Prioritization role: back end/devOps role: front end size: 0.25pt time sensitive
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Complexity: Medium Feature: Administrative ready for merge team role: back end/devOps role: front end size: 0.5pt
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Complexity: See issue making label ER Feature: Infrastructure Issue Making: Level 2 non-PR contribution ready for merge team role: back end/devOps role: front end size: 0.25pt
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
All issues in hackforla/website
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·