jojo/models/asymkey
0ko 1ef5496055 feat: use AppDomain for key verification (#10429)
Fixes #10416
Followup to a hardcoded string in [gitea#17743](https://github.com/go-gitea/gitea/pull/17743)

* instead of using a hardcoded namespace, use the configured application domain
    * `ssh-keygen` refuses to work with empty namespace, but `Domain` falls back to `localhost`:
    95dca7ff57/modules/setting/server.go (L192)
    * since `VerifySSHKey` verifies the namespace, I think that using a mostly-unique string instead of a hardcoded one doesn't hurt. Here's what `man ssh-keygen` says on the topic:
      > An additional signature namespace, used to prevent signature confusion across different domains of use (e.g. file signing vs email signing) must be provided  via  the  -n  flag.   Namespaces  are  arbitrary strings,  and  may  include:  “file”  for file signing, “email” for email signing.  For custom uses, it is recommended to use
names following a NAMESPACE@YOUR.DOMAIN pattern to generate unambiguous namespaces.

## Testing

There's a test `TestFromOpenSSH` but it uses a hardcoded default namespace `file`:
95dca7ff57/models/asymkey/ssh_key_test.go (L334)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10429
Reviewed-by: Beowulf <beowulf@beocode.eu>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
2025-12-17 17:01:14 +01:00
..
asymkey.go feat: consider WebAuthn & SSH for instance signing (#7693) 2025-04-29 10:34:07 +00:00
asymkey_test.go feat: consider WebAuthn & SSH for instance signing (#7693) 2025-04-29 10:34:07 +00:00
error.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
gpg_key.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
gpg_key_add.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
gpg_key_commit_verification.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
gpg_key_common.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
gpg_key_import.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
gpg_key_list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
gpg_key_object_verification.go feat(build): improve lint-locale-usage further (#8736) 2025-08-27 23:47:34 +02:00
gpg_key_tag_verification.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
gpg_key_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
gpg_key_verify.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
main_test.go chore: do not require empty fixtures to clean tables (#8353) 2025-06-30 23:04:16 +02:00
ssh_key.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
ssh_key_authorized_keys.go feat: ensure only expected ssh public keys are in authorized_keys file (#10010) 2025-11-09 01:06:04 +01:00
ssh_key_authorized_keys_test.go feat: ensure only expected ssh public keys are in authorized_keys file (#10010) 2025-11-09 01:06:04 +01:00
ssh_key_authorized_principals.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
ssh_key_deploy.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
ssh_key_fingerprint.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
ssh_key_object_verification.go feat(sec): Add SSH signing support for instances (#6897) 2025-04-11 13:25:35 +00:00
ssh_key_object_verification_test.go feat(sec): Add SSH signing support for instances (#6897) 2025-04-11 13:25:35 +00:00
ssh_key_parse.go Update module golang.org/x/crypto to v0.39.0 (forgejo) (#8091) 2025-06-06 15:19:05 +02:00
ssh_key_principals.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
ssh_key_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
ssh_key_verify.go feat: use AppDomain for key verification (#10429) 2025-12-17 17:01:14 +01:00