Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH Actions: restrict access to certain GH Actions #2016

Merged
merged 19 commits into from
Sep 8, 2023

Conversation

yoomlam
Copy link
Contributor

@yoomlam yoomlam commented Sep 5, 2023

What was the problem?

Anyone on the current team are allowed to do potentially dangerous actions, such as deploy to prod, via GH Action workflows.

Associated tickets or Slack threads:

How does this fix it?

Only allow members of the VRO-RESTRICTED team to do potentially dangerous actions.

Affected workflows:

  • delete-old-releases.yml
  • delete-published-images.yml
  • delete-workflow-runs.yml
  • deploy-secrets.yml - restricted only when deploying to prod
  • update-deployment.yml - restricted only when deploying to prod

How to test this PR

If you are not in VRO-RESTRICTED, then the above GH Action workflows should fail (when run on this PR's branch yoom/restrict-access) with a Only VRO-RESTRICTED team members can run this action message.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2023

Test Results

100 tests  ±0   100 ✔️ ±0   47s ⏱️ +2s
  34 suites ±0       0 💤 ±0 
  34 files   ±0       0 ±0 

Results for commit fbd4de1. ± Comparison against base commit f21f439.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2023

JaCoCo Test Coverage

There is no coverage information present for the Files changed

Total Project Coverage 68.04%

@yoomlam
Copy link
Contributor Author

yoomlam commented Sep 5, 2023

@yoomlam yoomlam marked this pull request as ready for review September 5, 2023 21:39
@yoomlam yoomlam requested a review from a team as a code owner September 5, 2023 21:39
@yoomlam yoomlam force-pushed the develop branch 3 times, most recently from 35bd80a to 9cc027a Compare September 7, 2023 02:41
@chengjie8
Copy link
Contributor

Great!. I have verified all the workflows in Yoom's comments.

Copy link
Contributor

@chengjie8 chengjie8 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@tejans24 tejans24 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +39 to +48
runs-on: ubuntu-latest
steps:
- id: checkUserMember
# Only check for manual runs, not scheduled runs
if: github.event_name == 'workflow_dispatch'
uses: tspascoal/get-user-teams-membership@v2
with:
username: ${{ github.actor }}
team: 'vro-restricted'
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN_READ_TEAM }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be setup as a reusable block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered that, but there's 2 different versions. Maybe someone can refactor that later.

@yoomlam yoomlam merged commit 4b928b5 into develop Sep 8, 2023
1 check passed
@yoomlam yoomlam deleted the yoom/restrict-access branch September 8, 2023 17:10
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.

3 participants