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

Configure Signed Commits #171

Open
1 task done
paulosgf opened this issue Nov 27, 2022 · 5 comments
Open
1 task done

Configure Signed Commits #171

paulosgf opened this issue Nov 27, 2022 · 5 comments
Assignees
Labels
ci-cd Continuous integration/continuous delivery enhancement New feature or request security Security related

Comments

@paulosgf
Copy link
Collaborator

Suggestion

The commits aren't signed with a trusted key

Enforce only signed commits

Implement this via GitHub Actions

Code of Conduct

  • I agree to follow this project's Code of Conduct
@paulosgf paulosgf added enhancement New feature or request security Security related ci-cd Continuous integration/continuous delivery labels Nov 27, 2022
@paulosgf paulosgf self-assigned this Nov 27, 2022
@paulosgf
Copy link
Collaborator Author

@Abdur-rahmaanJ, So, about the signed releases, we've to create a release branch and enforce signed commits policy on this.

First, create an admin GPG key pair:
gpg --full-gen-key
gpg --list-secret-keys --keyid-format long
gpg --armor --export YOUR_HEXKEY_AFTER_sec_rsa4096/ > file.asc
Paste in your GitHub profile -> Settings -> SSH and GPG keys -> New GPG Key
git config --global user.signingkey my_hex_key
git config --global tag.gpgSign true (automate signed tags)
Vide https://withblue.ink/2020/05/17/how-and-why-to-sign-git-commits.html
On GitHub, create the release repository and enforce sign use as:
https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule

Create a Branch protection rule = release
with constraints:

  • Require a pull request before merging
  • Require signed commits
    To release, commit on localhost:
    git commit -S -m "Honeybot Release 6.0.2"
    git tag -s release-6.0.2 -m "Honeybot Release 6.0.2" $(git rev-parse HEAD | cut -c1-7)
    git push origin my_branch

Then, in GitHub branches, create a "new pull request" as:
base:release <- compare:main

when merge, if this exits with non signed commit constraint, try this on localhost:
git checkout main
git pull origin release
git checkout release
git merge main
git push -u origin release
At end, to create a new release go to GitHub releases and create a new release with a tag from release branch.
*** the signed commits appear as verified on GitHub

@Abdur-rahmaanJ
Copy link
Member

@paulosgf I tried before but i cannot make it work

@paulosgf
Copy link
Collaborator Author

@paulosgf I tried before but i cannot make it work

What happened?

@Abdur-rahmaanJ
Copy link
Member

@paulosgf Idk it was just hanging.

@paulosgf
Copy link
Collaborator Author

@paulosgf Idk it was just hanging.
At which stage?

@paulosgf paulosgf reopened this Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-cd Continuous integration/continuous delivery enhancement New feature or request security Security related
Projects
None yet
Development

No branches or pull requests

2 participants