GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [ci] GitHub Workflows security hardening by sashashura · Pull Request #4130 · pmd/pmd

Conversation

@sashashura

@sashashura sashashura commented Sep 19, 2022

Copy link
Copy Markdown
Contributor

This PR adds explicit permissions section to workflows. This is a security best practice because by default workflows run with extended set of permissions (except from on: pull_request from external forks). By specifying any permission explicitly all others are set to none. By using the principle of least privilege the damage a compromised workflow can do (because of an injection or compromised third party tool or action) is restricted.
It is recommended to have most strict permissions on the top level and grant write permissions on job level case by case.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
sashashura added 2 commits September 19, 2022 21:02
@sashashura
build: harden build.yml permissions
600561e
Signed-off-by: Alex <[email protected]>
@sashashura
build: harden git-repo-sync.yml permissions
4966e99
Signed-off-by: Alex <[email protected]>
@oowekyala oowekyala changed the title GitHub Workflows security hardening [ci] GitHub Workflows security hardening Sep 21, 2022
@adangel adangel added this to the 6.50.0 milestone Sep 30, 2022
adangel
adangel reviewed Sep 30, 2022
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for the PR!

I think for the build.yml workflow, we need also write access for contents. We use currently this workflow for everything: building from PRs, building from pushes, building from pushes to tags. And that creates a new release. We also update the branch "gh-pages" during the build, that means, we do a git-push against the our repo.

I have some idea in mind to refactor the workflow to make it into smaller chunks, but that's out of scope for now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@adangel
[ci] Add permission contents:write for build job
81a8ba0
@ghost

ghost commented Sep 30, 2022

Copy link
Copy Markdown
1 Message
📖 No regression tested rules have been changed.

Generated by 🚫 Danger

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sashashura

sashashura commented Sep 30, 2022

Copy link
Copy Markdown
Contributor Author

I see, you are right.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@adangel
adangel merged commit 81a8ba0 into pmd:master Sep 30, 2022
adangel added a commit to adangel/pmd that referenced this pull request Sep 30, 2022
@adangel
[doc] Update release notes (pmd#4130)
8fa94cf
adangel added a commit to adangel/pmd that referenced this pull request Sep 30, 2022
@adangel
Merge pull request pmd#4130 from sashashura:patch-1
a46bea2
[ci] GitHub Workflows security hardening pmd#4130
@adangel adangel mentioned this pull request Jan 12, 2023
[ci] Improve Github Actions Workflows #4328
Closed
14 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adangel adangel adangel left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

6.50.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@sashashura @adangel
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.