[crypto] ssh: report verified signature format to callback

4 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
Jul 14, 2026, 5:38:31 PM (3 days ago) Jul 14
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gerrit Bot has uploaded the change for review

Commit message

ssh: report verified signature format to callback

I was advised to create a pull request to fix the following issue:
https://issuetracker.google.com/issues/534434075

Since it may be a security vulnerability, I am not sure if I should
create an issue at golang/go, but I can do that if needed.
Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
GitHub-Last-Rev: 1a4acd4e639361be1f2948a4aef1013436a75ecf
GitHub-Pull-Request: golang/crypto#364

Change diff

diff --git a/ssh/server.go b/ssh/server.go
index 07d2405..e090262 100644
--- a/ssh/server.go
+++ b/ssh/server.go
@@ -229,7 +229,9 @@
// Permissions object can be the same object, optionally modified, or a
// completely new object. If VerifiedPublicKeyCallback is non-nil,
// PublicKeyCallback is not allowed to return a PartialSuccessError, which
- // can instead be returned by VerifiedPublicKeyCallback.
+ // can instead be returned by VerifiedPublicKeyCallback. The
+ // signatureAlgorithm argument is the format of the signature that was
+ // successfully verified.
//
// VerifiedPublicKeyCallback does not affect which authentication methods
// are included in the list of methods that can be attempted by the client.
@@ -891,7 +893,7 @@
// Only call VerifiedPublicKeyCallback after the key has been accepted
// and successfully verified. If authErr is non-nil, the key is not
// considered verified and the callback must not run.
- perms, authErr = config.VerifiedPublicKeyCallback(s, pubKey, perms, algo)
+ perms, authErr = config.VerifiedPublicKeyCallback(s, pubKey, perms, sig.Format)
}
}
case "gssapi-with-mic":
diff --git a/ssh/server_test.go b/ssh/server_test.go
index 0f84616..7116ad4 100644
--- a/ssh/server_test.go
+++ b/ssh/server_test.go
@@ -544,6 +544,62 @@
<-done
}

+func TestVerifiedPublicKeyCallbackSignatureFormat(t *testing.T) {
+ c1, c2, err := netPipe()
+ if err != nil {
+ t.Fatalf("netPipe: %v", err)
+ }
+ defer c1.Close()
+ defer c2.Close()
+
+ var gotSignatureAlgorithm string
+ serverConf := &ServerConfig{
+ PublicKeyCallback: func(conn ConnMetadata, key PublicKey) (*Permissions, error) {
+ return nil, nil
+ },
+ VerifiedPublicKeyCallback: func(conn ConnMetadata, key PublicKey, permissions *Permissions, signatureAlgorithm string) (*Permissions, error) {
+ gotSignatureAlgorithm = signatureAlgorithm
+ return permissions, nil
+ },
+ }
+ serverConf.AddHostKey(testSigners["rsa"])
+
+ serverDone := make(chan error, 1)
+ go func() {
+ conn, _, _, err := NewServerConn(c1, serverConf)
+ if err == nil {
+ conn.Close()
+ }
+ serverDone <- err
+ }()
+
+ clientConf := &ClientConfig{
+ User: "user",
+ Auth: []AuthMethod{
+ // The selected algorithm and signature format differ for
+ // compatibility with old RSA clients.
+ configurablePublicKeyCallback{
+ signer: testSigners["rsa"].(AlgorithmSigner),
+ signatureAlgo: KeyAlgoRSASHA256,
+ signatureFormat: KeyAlgoRSA,
+ },
+ },
+ HostKeyCallback: InsecureIgnoreHostKey(),
+ }
+
+ clientConn, _, _, clientErr := NewClientConn(c2, "", clientConf)
+ if clientErr == nil {
+ clientConn.Close()
+ }
+ serverErr := <-serverDone
+ if clientErr != nil || serverErr != nil {
+ t.Fatalf("connection failed: client error: %v; server error: %v", clientErr, serverErr)
+ }
+ if gotSignatureAlgorithm != KeyAlgoRSA {
+ t.Errorf("signature algorithm = %q; want verified signature format %q", gotSignatureAlgorithm, KeyAlgoRSA)
+ }
+}
+
func TestVerifiedPublicCallbackPartialSuccess(t *testing.T) {
c1, c2, err := netPipe()
if err != nil {

Change information

Files:
  • M ssh/server.go
  • M ssh/server_test.go
Change size: M
Delta: 2 files changed, 60 insertions(+), 2 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: crypto
Gerrit-Branch: master
Gerrit-Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
Gerrit-Change-Number: 800740
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
Jul 14, 2026, 5:38:35 PM (3 days ago) Jul 14
to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gopher Robot added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Gopher Robot . unresolved

I spotted some possible problems with your PR:

  1. You usually need to reference a bug number for all but trivial or cosmetic fixes. For the crypto repo, the format is usually 'Fixes golang/go#12345' or 'Updates golang/go#12345' at the end of the commit message. Should you have a bug reference?

Please address any problems by updating the GitHub PR.

When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above. These findings are based on heuristics; if a finding does not apply, briefly reply here saying so.

To update the commit title or commit message body shown here in Gerrit, you must edit the GitHub PR title and PR description (the first comment) in the GitHub web interface using the 'Edit' button or 'Edit' menu entry there. Note: pushing a new commit to the PR will not automatically update the commit message used by Gerrit.

For more details, see:

(In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: crypto
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
    Gerrit-Change-Number: 800740
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Comment-Date: Tue, 14 Jul 2026 21:38:29 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Gopher Robot (Gerrit)

    unread,
    Jul 14, 2026, 5:42:53 PM (3 days ago) Jul 14
    to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Message from Gopher Robot

    Congratulations on opening your first change. Thank you for your contribution!

    Next steps:
    A maintainer will review your change and provide feedback. See
    https://go.dev/doc/contribute#review for more info and tips to get your
    patch through code review.

    Most changes in the Go project go through a few rounds of revision. This can be
    surprising to people new to the project. The careful, iterative review process
    is our way of helping mentor contributors and ensuring that their contributions
    have a lasting impact.

    During May-July and Nov-Jan the Go project is in a code freeze, during which
    little code gets reviewed or merged. If a reviewer responds with a comment like
    R=go1.11 or adds a tag like "wait-release", it means that this CL will be
    reviewed as part of the next development cycle. See https://go.dev/s/release
    for more details.

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: crypto
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
    Gerrit-Change-Number: 800740
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Comment-Date: Tue, 14 Jul 2026 21:42:49 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Gerrit Bot (Gerrit)

    unread,
    Jul 14, 2026, 8:46:48 PM (3 days ago) Jul 14
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Nicola Murino

    Gerrit Bot uploaded new patchset

    Gerrit Bot uploaded patch set #2 to this change.
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Nicola Murino
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: crypto
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
    Gerrit-Change-Number: 800740
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Nicola Murino <nicola...@gmail.com>
    Gerrit-CC: Filippo Valsorda <fil...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Roland Shoemaker <rol...@golang.org>
    Gerrit-Attention: Nicola Murino <nicola...@gmail.com>
    unsatisfied_requirement
    open
    diffy

    Vinicius Akira Imaizumi (Gerrit)

    unread,
    Jul 15, 2026, 8:58:35 AM (3 days ago) Jul 15
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Nicola Murino, Filippo Valsorda, Roland Shoemaker, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Nicola Murino

    Vinicius Akira Imaizumi added 1 comment

    Patchset-level comments
    File-level comment, Patchset 1:
    Gopher Robot . resolved

    I spotted some possible problems with your PR:

      1. You usually need to reference a bug number for all but trivial or cosmetic fixes. For the crypto repo, the format is usually 'Fixes golang/go#12345' or 'Updates golang/go#12345' at the end of the commit message. Should you have a bug reference?

    Please address any problems by updating the GitHub PR.

    When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above. These findings are based on heuristics; if a finding does not apply, briefly reply here saying so.

    To update the commit title or commit message body shown here in Gerrit, you must edit the GitHub PR title and PR description (the first comment) in the GitHub web interface using the 'Edit' button or 'Edit' menu entry there. Note: pushing a new commit to the PR will not automatically update the commit message used by Gerrit.

    For more details, see:

    (In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

    Vinicius Akira Imaizumi

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Nicola Murino
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crypto
      Gerrit-Branch: master
      Gerrit-Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
      Gerrit-Change-Number: 800740
      Gerrit-PatchSet: 2
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Nicola Murino <nicola...@gmail.com>
      Gerrit-CC: Filippo Valsorda <fil...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Roland Shoemaker <rol...@golang.org>
      Gerrit-CC: Vinicius Akira Imaizumi <vinicius...@gmail.com>
      Gerrit-Attention: Nicola Murino <nicola...@gmail.com>
      Gerrit-Comment-Date: Wed, 15 Jul 2026 12:58:29 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Gopher Robot <go...@golang.org>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Nicola Murino (Gerrit)

      unread,
      Jul 16, 2026, 5:13:46 AM (yesterday) Jul 16
      to Gerrit Bot, goph...@pubsubhelper.golang.org, Vinicius Akira Imaizumi, Filippo Valsorda, Roland Shoemaker, Gopher Robot, golang-co...@googlegroups.com

      Nicola Murino voted Code-Review+2

      Code-Review+2
      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crypto
      Gerrit-Branch: master
      Gerrit-Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
      Gerrit-Change-Number: 800740
      Gerrit-PatchSet: 2
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Nicola Murino <nicola...@gmail.com>
      Gerrit-CC: Filippo Valsorda <fil...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Roland Shoemaker <rol...@golang.org>
      Gerrit-CC: Vinicius Akira Imaizumi <vinicius...@gmail.com>
      Gerrit-Comment-Date: Thu, 16 Jul 2026 09:13:39 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Nicola Murino (Gerrit)

      unread,
      Jul 16, 2026, 5:28:09 AM (yesterday) Jul 16
      to Gerrit Bot, goph...@pubsubhelper.golang.org, Vinicius Akira Imaizumi, Filippo Valsorda, Roland Shoemaker, Gopher Robot, golang-co...@googlegroups.com

      Nicola Murino voted Commit-Queue+1

      Commit-Queue+1
      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crypto
      Gerrit-Branch: master
      Gerrit-Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
      Gerrit-Change-Number: 800740
      Gerrit-PatchSet: 2
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Nicola Murino <nicola...@gmail.com>
      Gerrit-CC: Filippo Valsorda <fil...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Roland Shoemaker <rol...@golang.org>
      Gerrit-CC: Vinicius Akira Imaizumi <vinicius...@gmail.com>
      Gerrit-Comment-Date: Thu, 16 Jul 2026 09:28:02 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Michael Pratt (Gerrit)

      unread,
      2:47 PM (8 hours ago) 2:47 PM
      to Gerrit Bot, goph...@pubsubhelper.golang.org, Michael Pratt, golang...@luci-project-accounts.iam.gserviceaccount.com, Nicola Murino, Vinicius Akira Imaizumi, Filippo Valsorda, Roland Shoemaker, Gopher Robot, golang-co...@googlegroups.com

      Michael Pratt voted

      Auto-Submit+1
      Code-Review+1
      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: crypto
        Gerrit-Branch: master
        Gerrit-Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
        Gerrit-Change-Number: 800740
        Gerrit-PatchSet: 2
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-CC: Filippo Valsorda <fil...@golang.org>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-CC: Roland Shoemaker <rol...@golang.org>
        Gerrit-CC: Vinicius Akira Imaizumi <vinicius...@gmail.com>
        Gerrit-Comment-Date: Fri, 17 Jul 2026 18:47:01 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        David Chase (Gerrit)

        unread,
        6:40 PM (5 hours ago) 6:40 PM
        to Gerrit Bot, goph...@pubsubhelper.golang.org, Michael Pratt, golang...@luci-project-accounts.iam.gserviceaccount.com, Nicola Murino, Vinicius Akira Imaizumi, Filippo Valsorda, Roland Shoemaker, Gopher Robot, golang-co...@googlegroups.com

        David Chase voted Code-Review+1

        Code-Review+1
        Open in Gerrit

        Related details

        Attention set is empty
        Submit Requirements:
          • requirement satisfiedCode-Review
          • requirement satisfiedNo-Unresolved-Comments
          • requirement satisfiedReview-Enforcement
          • requirement satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: crypto
          Gerrit-Branch: master
          Gerrit-Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
          Gerrit-Change-Number: 800740
          Gerrit-PatchSet: 2
          Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
          Gerrit-Reviewer: David Chase <drc...@google.com>
          Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
          Gerrit-Reviewer: Nicola Murino <nicola...@gmail.com>
          Gerrit-CC: Filippo Valsorda <fil...@golang.org>
          Gerrit-CC: Gopher Robot <go...@golang.org>
          Gerrit-CC: Roland Shoemaker <rol...@golang.org>
          Gerrit-CC: Vinicius Akira Imaizumi <vinicius...@gmail.com>
          Gerrit-Comment-Date: Fri, 17 Jul 2026 22:40:00 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          open
          diffy

          Gopher Robot (Gerrit)

          unread,
          6:41 PM (5 hours ago) 6:41 PM
          to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, David Chase, Michael Pratt, golang...@luci-project-accounts.iam.gserviceaccount.com, Nicola Murino, Vinicius Akira Imaizumi, Filippo Valsorda, Roland Shoemaker, golang-co...@googlegroups.com

          Gopher Robot submitted the change

          Change information

          Commit message:
          ssh: report verified signature format to callback

          VerifiedPublicKeyCallback currently receives the public-key algorithm
          declared in the outer authentication request. For RSA authentication,
          that value can differ from the format of the signature that was
          successfully verified because compatible RSA algorithm combinations are
          accepted.

          This can cause post-verification policy or audit decisions to use the
          request algorithm instead of the signature format actually verified.

          Pass sig.Format to VerifiedPublicKeyCallback so signatureAlgorithm
          identifies the successfully verified signature format. Clarify the
          callback documentation and add a regression test covering compatible
          but different RSA request algorithms and signature formats.

          Fixes golang/go#80411
          Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
          GitHub-Last-Rev: 1a4acd4e639361be1f2948a4aef1013436a75ecf
          GitHub-Pull-Request: golang/crypto#364
          Files:
          • M ssh/server.go
          • M ssh/server_test.go
          Change size: M
          Delta: 2 files changed, 60 insertions(+), 2 deletions(-)
          Branch: refs/heads/master
          Submit Requirements:
          Open in Gerrit
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: merged
          Gerrit-Project: crypto
          Gerrit-Branch: master
          Gerrit-Change-Id: Ib405378d75367a90536e0814c9d26d4dec9aaa25
          Gerrit-Change-Number: 800740
          Gerrit-PatchSet: 3
          Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
          Gerrit-Reviewer: David Chase <drc...@google.com>
          Gerrit-Reviewer: Gopher Robot <go...@golang.org>
          Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
          Gerrit-Reviewer: Nicola Murino <nicola...@gmail.com>
          Gerrit-CC: Filippo Valsorda <fil...@golang.org>
          open
          diffy
          satisfied_requirement
          Reply all
          Reply to author
          Forward
          0 new messages