forgejo/modules/setting
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
..
config chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
actions.go fix: actions move to data.forgejo.org 2024-12-19 10:55:05 +01:00
actions_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
admin.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
admin_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
api.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
asset_dynamic.go Use a general approach to access custom/static/builtin assets (#24022) 2023-04-12 18:16:45 +08:00
asset_static.go Use a general approach to access custom/static/builtin assets (#24022) 2023-04-12 18:16:45 +08:00
attachment.go feat: Make AVIF Images work with Forgejo 2024-11-13 19:09:40 +01:00
attachment_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
badges.go [GITEA] Add support for shields.io-based badges 2024-02-05 16:09:42 +01:00
cache.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
camo.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
config.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
config_env.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
config_env_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
config_provider.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
config_provider_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
cors.go Fix settings not being loaded at CLI (#26402) 2025-01-05 12:13:48 +00:00
cron.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
cron_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
database.go feat: use XORM EngineGroup instead of single Engine connection (#7212) 2025-03-30 11:34:02 +00:00
database_sqlite.go
database_test.go feat: use XORM EngineGroup instead of single Engine connection (#7212) 2025-03-30 11:34:02 +00:00
disposable_email_domain_data.go feat: add setting to block disposable emails 2024-11-20 23:17:37 -06:00
f3.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
federation.go feat(activitiypub): enable HTTP signatures on all ActivityPub endpoints (#7035) 2025-04-03 15:24:15 +00:00
forgejo_storage_test.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 chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
git_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
highlight.go
i18n.go i18n: make Danish available in UI (#7287) 2025-03-22 16:18:54 +00:00
incoming_email.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
incoming_email_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
indexer.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
indexer_test.go
lfs.go chore(sec): unify usage of crypto/rand.Read (#7453) 2025-04-04 03:31:37 +00:00
lfs_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
log.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
log_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
mailer.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
mailer_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
markup.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
metrics.go
migrations.go
mime_type_map.go
mirror.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
oauth2.go chore(sec): unify usage of crypto/rand.Read (#7453) 2025-04-04 03:31:37 +00:00
oauth2_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
other.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
packages.go Alt Linux Apt-Rpm repository support for Forgejo packages. (#6351) 2025-01-22 14:01:49 +00:00
packages_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
path.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
path_test.go [BRANDING] alias {FORGEJO,GITEA}_{CUSTOM,WORK_DIR} 2024-02-05 16:05:01 +01:00
picture.go Fix all possible setting error related storages and added some tests (#23911) 2023-06-14 11:42:38 +08:00
project.go
proxy.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
queue.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
quota.go feat: Trivial default quota configuration 2024-08-26 13:25:34 +02:00
repository.go feat(sec): Add SSH signing support for instances (#6897) 2025-04-11 13:25:35 +00:00
repository_archive.go Fix all possible setting error related storages and added some tests (#23911) 2023-06-14 11:42:38 +08:00
repository_archive_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repository_test.go feat(sec): Add SSH signing support for instances (#6897) 2025-04-11 13:25:35 +00:00
security.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
server.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
server_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
service.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
service_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
session.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
setting.go Move ParseBool to optional (#33979) 2025-04-01 02:28:02 +02:00
setting_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
ssh.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
storage.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
storage_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
task.go
time.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
ui.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
webhook.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00