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

proposal: x/crypto/ssh: export structured disconnect message / reason error #39259

Open
jayschwa opened this issue May 26, 2020 · 0 comments
Open
Labels
Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Milestone

Comments

@jayschwa
Copy link
Contributor

jayschwa commented May 26, 2020

What version of Go are you using (go version)?

$ go version
go version go1.14.3 linux/amd64

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jayschwa/.cache/go-build"
GOENV="/home/jayschwa/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jayschwa/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/5759"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/5759/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jayschwa/golang-crypto/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build549371117=/tmp/go-build -gno-record-gcc-switches"

Proposal

The SSH protocol defines disconnect reason codes in section 11.1 of RFC 4253. I have an application where I want to inspect the disconnect reason code. I currently do this by checking the error string, but this is considered a bad practice.

Internally, the x/crypto/ssh package contains a disconnectMsg error type that is the structured form of the disconnect reason data. However, that type is not exposed externally for use with a function such as errors.As. I propose that disconnectMsg (or something like it) be exported so that users may unwrap the error and inspect the reason code.

@gopherbot gopherbot added this to the Proposal milestone May 26, 2020
@rsc rsc added the Proposal-Crypto Proposal related to crypto packages or other security issues label Jun 10, 2020
@rsc rsc moved this to Incoming in Proposals Aug 10, 2022
@rsc rsc added this to Proposals Aug 10, 2022
@julieqiu julieqiu removed this from Go Security Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Projects
Status: Incoming
Development

No branches or pull requests

3 participants