Skip to content

Restrict default-branch-pr-guard workflow to minimum required permissions and apply Zizmor fixes - #401

Merged
DougReeder merged 2 commits into
Hubs-Foundation:masterfrom
Exairnous:restrict-default-branch-pr-guard-permissions
Jul 7, 2026
Merged

Restrict default-branch-pr-guard workflow to minimum required permissions and apply Zizmor fixes#401
DougReeder merged 2 commits into
Hubs-Foundation:masterfrom
Exairnous:restrict-default-branch-pr-guard-permissions

Conversation

@Exairnous

@Exairnous Exairnous commented Jun 27, 2026

Copy link
Copy Markdown
Member

What?

Sets the permissions of the default-branch-pr-guard workflow to none and replaces direct use of the GitHub variables in the shell execution with indirect usage via shell variables.

Why?

To increase its security and in preparation to globally restrict permissions for all Hubs Foundation workflows.

Examples

N/A

How to test

  1. Add the changes from this PR to your master branch and push it to your fork.
  2. Create a new branch (based off of the updated master branch) with a minor change and push that to your fork.
  3. Create a pull request from the new branch on your fork to the updated master branch on your fork.
  4. See that the workflow still works as expected with the new changes.

In the short term (and if you have the required permissions), you can just check a recent run of the updated workflow from this PR, e.g.: https://github.com/Hubs-Foundation/hubs-cloud/actions/runs/28285184986/job/83807817462

To verify that all the Zizmor issues have been addressed, run the following command from the repository folder and see that Zizmor reports no issues (that we care about) for the default-branch-pr-guard workflow.

docker run --rm --name zizmor -v .:/usr/repo ghcr.io/zizmorcore/zizmor --fix=all /usr/repo

Documentation of functionality

This doesn't change the functionality of the workflow, so no documentation update is needed.

Limitations

None

Alternative implementations considered

None

Open questions

What is the best way to apply this to both the master branch and the development branch, since we can't currently merge the development branch into master?

  • Merge this PR to master and then rebase the development branch?
  • Merge the PR and then merge the master branch into the development branch?
  • Something else?

Note: for the roadmap auto commenter it looks like I merged the PR and then merged the master branch into the development branch. Should I just do that again?

UPDATE: It was initially decided at the 2026-07-07 Hubs Dev Meetup that we would rebase the development branch, however that resulted in the loss of the merge commits that were present on the development branch, so it was decided at the 2026-07-14 Hubs Dev Meetup that we would instead merge the master branch into the development branch.

Additional details or related context

Part of Hubs-Foundation/.github#13

This doesn't touch any of the workflows in the services folder since GitHub doesn't pick them up.

…ions

What: sets the permissions of the default-branch-pr-guard workflow to none.

Why: to increase its security and in preparation to globally restrict permissions for all Hubs Foundation workflows.

Note: part of Hubs-Foundation/.github#13
@github-actions

Copy link
Copy Markdown

Thank you for the pull request.

ROADMAP STATUS: This pull request isn't currently on any roadmap. Updates will be conveyed here as its place on/off a roadmap changes.

You can view the roadmaps here: Roadmaps Google Drive folder.

For more information on how the roadmaps work, see our roadmaps policy on GitHub.

@Exairnous Exairnous added the Roadmap: Programming Indicates that this issue/pull request is on the Programming Team roadmap label Jun 27, 2026
@Exairnous

Copy link
Copy Markdown
Member Author

Updated the description.

…uard workflow

What: replaces direct use of the GitHub variables in the shell execution with indirect usage via shell variables.

Why: According to Zizmor, this prevents code injection via template expansion.  Essentially, this should ensure an attacker can't manipulate data in GitHub to achieve remote code execution when the workflow is run.
@Exairnous Exairnous changed the title Restrict default-branch-pr-guard workflow to minimum required permissions Restrict default-branch-pr-guard workflow to minimum required permissions and apply Zizmor fixes Jun 27, 2026
@Exairnous

Copy link
Copy Markdown
Member Author

Updated PR with fixes from Zizmor that I'd missed.

@DougReeder DougReeder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM; variables have proper values

@DougReeder
DougReeder merged commit a7c4f40 into Hubs-Foundation:master Jul 7, 2026
0 of 5 checks passed
@Exairnous

Copy link
Copy Markdown
Member Author

Updated PR description with the decision on how the development branch should be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Roadmap: Programming Indicates that this issue/pull request is on the Programming Team roadmap

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants