forgejo_backup/modules/git
Gusted b55c72828e feat(sec): Add SSH signing support for instances (#6897)
- Add support to set `gpg.format` in the Git config, via the new `[repository.signing].FORMAT` option. This is to tell Git that the instance would like to use SSH instead of OpenPGP to sign its commits. This is guarded behind a Git version check for v2.34.0 and a check that a `ssh-keygen` binary is present.
- Add support to recognize the public SSH key that is given to `[repository.signing].SIGNING_KEY` as the signing key by the instance.
- Thus this allows the instance to use SSH commit signing for commits that the instance creates (e.g. initial and squash commits) instead of using PGP.
- Technically (although I have no clue how as this is not documented) you can have a different PGP signing key for different repositories; this is not implemented for SSH signing.
- Add unit and integration testing.
  - `TestInstanceSigning` was reworked from `TestGPGGit`, now also includes testing for SHA256 repositories. Is the main integration test that actually signs commits and checks that they are marked as verified by Forgejo.
  - `TestParseCommitWithSSHSignature` is a unit test that makes sure that if a SSH instnace signing key is set, that it is used to possibly verify instance SSH signed commits.
  - `TestSyncConfigGPGFormat` is a unit test that makes sure the correct git config is set according to the signing format setting. Also checks that the guarded git version check and ssh-keygen binary presence check is done correctly.
  - `TestSSHInstanceKey` is a unit test that makes sure the parsing of a SSH signing key is done correctly.
  - `TestAPISSHSigningKey` is a integration test that makes sure the newly added API route `/api/v1/signing-key.ssh` responds correctly.

Documentation PR: forgejo/docs#1122

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6897
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-04-11 13:25:35 +00:00
..
foreachref chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
internal Refactor git command package to improve security and maintainability (#22678) 2023-02-04 10:30:43 +08:00
pipeline chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
pushoptions Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
tests/repos [PERFORMANCE] git check-attr on bare repo if supported 2024-03-28 10:52:51 +01:00
url Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
batch.go [PORT] Refactor the usage of batch catfile (gitea#31754) 2024-08-26 03:48:51 +02:00
batch_reader.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
blame.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
blame_sha256_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v1.64.6 (forgejo) (#7118) 2025-03-04 21:38:35 +00:00
blame_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v1.64.6 (forgejo) (#7118) 2025-03-04 21:38:35 +00:00
blob.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
blob_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
command.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
command_race_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
command_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
commit.go feat: sync forks (#2364) 2025-04-07 07:00:38 +00:00
commit_info.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
commit_info_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v1.64.6 (forgejo) (#7118) 2025-03-04 21:38:35 +00:00
commit_reader.go Enable more revive linter rules (#30608) 2024-04-28 15:39:00 +02:00
commit_sha256_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
commit_test.go feat: sync forks (#2364) 2025-04-07 07:00:38 +00:00
diff.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
diff_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
error.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
git.go feat(sec): Add SSH signing support for instances (#6897) 2025-04-11 13:25:35 +00:00
git_test.go feat(sec): Add SSH signing support for instances (#6897) 2025-04-11 13:25:35 +00:00
grep.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
grep_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v1.64.6 (forgejo) (#7118) 2025-03-04 21:38:35 +00:00
hook.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
last_commit_cache.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
log_name_status.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
notes.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
notes_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
object_format.go Enable unparam linter (#31277) 2024-06-16 13:42:58 +02:00
object_id.go chore: fix typos identified by mispell 2024-05-25 09:43:50 +02:00
object_id_test.go fix: hook post-receive for sha256 repos 2024-05-15 16:43:16 +02:00
object_signature.go Rename CommitGPGSignature to ObjectSignature 2024-03-26 08:09:36 +00:00
parse.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
parse_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
README.md move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364) 2019-03-27 17:33:00 +08:00
ref.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
ref_test.go Fix mirror bug (#33224) 2025-01-19 09:42:57 +01:00
remote.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_archive.go Fix archive creating LFS hooks and breaking pull requests (#28848) 2024-01-19 05:49:18 +00:00
repo_attribute.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_attribute_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo_base.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_base_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo_blame.go Remove git.FileBlame (#25841) 2023-07-12 19:07:29 +02:00
repo_blob_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
repo_branch.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_branch_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo_commit.go feat: sync forks (#2364) 2025-04-07 07:00:38 +00:00
repo_commit_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo_commitgraph.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
repo_compare.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_compare_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
repo_gpg.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_hook.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
repo_index.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_language_stats.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo_language_stats_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo_object.go Improve ObjectFormat interface (#28496) 2023-12-19 07:20:47 +00:00
repo_ref.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo_ref_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
repo_stats.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_stats_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo_tag.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_tag_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v1.64.6 (forgejo) (#7118) 2025-03-04 21:38:35 +00:00
repo_tree.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
signature.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
signature_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
submodule.go Enable more revive linter rules (#30608) 2024-04-28 15:39:00 +02:00
submodule_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
tag.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
tag_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
tree.go Use gitrepo.GetTreePathLatestCommit to get file lastest commit instead from latest commit cache (#32987) 2025-01-05 12:13:48 +00:00
tree_blob.go [CHORE] Drop go-git support 2024-08-12 19:11:09 +02:00
tree_entry.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
tree_entry_mode.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
tree_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
utils.go chore: Remove LimitedReaderCloser 2025-01-31 10:43:29 +01:00
utils_test.go [CHORE] Drop go-git support 2024-08-12 19:11:09 +02:00

Git Module

This module is merged from https://github.com/go-gitea/git which is a Go module to access Git through shell commands. Now it's a part of gitea's main repository for easier pull request.