Files
threshold/internal/errors/info.go
T
Louis Ruch 9b39345c7f bug(credential): Fix panic in credential Issue
Vault KV backend returns a nil secret and no error if the secret does not
exist. This caused a panic in during Issue:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x1388279]

goroutine 2639 [running]:
github.com/hashicorp/boundary/internal/credential/vault.(*Repository).Issue(0xc001222200, {0x3b932d0, 0xc001203350}, {0xc000dc6e90, 0xc}, {0xc0010e5e40, 0x0, 0x0})
        /home/louis/boundary/internal/credential/vault/repository_credentials.go:67 +0x2d9
github.com/hashicorp/boundary/internal/servers/controller/handlers/targets.Service.AuthorizeSession({{}, 0xc000cd4a38, 0xc000cd4840, 0xc000cd48d0, 0xc000cd4a50, 0xc000cd4870, 0xc000cd4858, 0xc000cd48b8, 0xc0001a8880}, {0x3b932d0, ...}, ...)
        /home/louis/boundary/internal/servers/controller/handlers/targets/target_service.go:1059 +0x1525
github.com/hashicorp/boundary/internal/gen/controller/api/services._TargetService_AuthorizeSession_Handler.func1({0x3b932d0, 0xc001203350}, {0x1a0dd40, 0xc000dc8880})
        /home/louis/boundary/internal/gen/controller/api/services/target_service_grpc.pb.go:631 +0x78
github.com/hashicorp/boundary/internal/servers/controller.auditResponseInterceptor.func1({0x3b932d0, 0xc001203350}, {0x1a0dd40, 0xc000dc8880}, 0x461279, 0x40d234)
        /home/louis/boundary/internal/servers/controller/interceptor.go:262 +0x4e
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x3b932d0, 0xc001203350}, {0x1a0dd40, 0xc000dc8880})
        /home/louis/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/hashicorp/boundary/internal/servers/controller.statusCodeInterceptor.func1({0x3b932d0, 0xc001203350}, {0x1a0dd40, 0xc000dc8880}, 0x203000, 0x203000)
        /home/louis/boundary/internal/servers/controller/interceptor.go:207 +0x34
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x3b932d0, 0xc001203350}, {0x1a0dd40, 0xc000dc8880})
        /home/louis/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/hashicorp/boundary/internal/servers/controller.errorInterceptor.func1({0x3b932d0, 0xc001203350}, {0x1a0dd40, 0xc000dc8880}, 0x18e2b40, 0x0)
        /home/louis/boundary/internal/servers/controller/interceptor.go:156 +0x4e
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x3b932d0, 0xc001203350}, {0x1a0dd40, 0xc000dc8880})
        /home/louis/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/hashicorp/boundary/internal/servers/controller.auditRequestInterceptor.func1({0x3b932d0, 0xc001203350}, {0x1a0dd40, 0xc000dc8880}, 0x1a1c860, 0xc0010e5280)
        /home/louis/boundary/internal/servers/controller/interceptor.go:248 +0x198
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x3b932d0, 0xc001203350}, {0x1a0dd40, 0xc000dc8880})
        /home/louis/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/hashicorp/boundary/internal/servers/controller.requestCtxInterceptor.func1({0x3b932d0, 0xc001203260}, {0x1a0dd40, 0xc000dc8880}, 0x18, 0xc0010e52a0)
        /home/louis/boundary/internal/servers/controller/interceptor.go:140 +0x5de
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x3b932d0, 0xc001203260}, {0x1a0dd40, 0xc000dc8880})
        /home/louis/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1({0x3b932d0, 0xc001203260}, {0x1a0dd40, 0xc000dc8880}, 0xc00331abb8, 0x18675e0)
        /home/louis/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:34 +0xbf
github.com/hashicorp/boundary/internal/gen/controller/api/services._TargetService_AuthorizeSession_Handler({0x1ada420, 0xc00093a180}, {0x3b932d0, 0xc001203260}, 0xc001200840, 0xc000465260)
        /home/louis/boundary/internal/gen/controller/api/services/target_service_grpc.pb.go:633 +0x138
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000cca540, {0x3bb4c58, 0xc0005a9c80}, 0xc001208480, 0xc0004a7440, 0x499e2b8, 0x0)
        /home/louis/go/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:1297 +0xccf
google.golang.org/grpc.(*Server).handleStream(0xc000cca540, {0x3bb4c58, 0xc0005a9c80}, 0xc001208480, 0x0)
        /home/louis/go/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:1626 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        /home/louis/go/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:941 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /home/louis/go/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:939 +0x294
2021-12-15 16:13:30 -08:00

248 lines
5.3 KiB
Go

package errors
// Info contains details of the specific error code
type Info struct {
// Kind specifies the kind of error (unknown, parameter, integrity, etc).
Kind Kind
// Message provides a default message for the error code
Message string
}
// errorCodeInfo provides a map of unique Codes (IDs) to their
// corresponding Kind and a default Message.
var errorCodeInfo = map[Code]Info{
Unknown: {
Message: "unknown",
Kind: Other,
},
InvalidParameter: {
Message: "invalid parameter",
Kind: Parameter,
},
InvalidAddress: {
Message: "invalid address",
Kind: Parameter,
},
InvalidPublicId: {
Message: "invalid public id",
Kind: Parameter,
},
InvalidFieldMask: {
Message: "invalid field mask",
Kind: Parameter,
},
EmptyFieldMask: {
Message: "empty field mask",
Kind: Parameter,
},
KeyNotFound: {
Message: "key/version not found",
Kind: Integrity,
},
TicketAlreadyRedeemed: {
Message: "ticket already redeemed",
Kind: Integrity,
},
TicketNotFound: {
Message: "ticket not found",
Kind: Integrity,
},
Io: {
Message: "error during io operation",
Kind: Integrity,
},
InvalidTimeStamp: {
Message: "invalid time stamp",
Kind: Integrity,
},
SessionNotFound: {
Message: "session not found",
Kind: Integrity,
},
InvalidSessionState: {
Message: "session state was not valid for the requested operation",
Kind: Integrity,
},
TokenMismatch: {
Message: "token mismatch",
Kind: Integrity,
},
TooShort: {
Message: "too short",
Kind: Integrity,
},
AuthMethodInactive: {
Message: "authentication method is inactive",
Kind: State,
},
AuthAttemptExpired: {
Message: "authentication attempt has expired",
Kind: State,
},
AccountAlreadyAssociated: {
Message: "account already associated with another user",
Kind: Parameter,
},
InvalidJobRunState: {
Message: "job run is already in a final run state",
Kind: Integrity,
},
JobAlreadyRunning: {
Message: "job already running",
Kind: State,
},
SubtypeAlreadyRegistered: {
Message: "subtype already registered",
Kind: Parameter,
},
InvalidDynamicCredential: {
Message: "dynamic credential for session is in an invalid state",
Kind: Integrity,
},
PasswordTooShort: {
Message: "too short",
Kind: Password,
},
PasswordUnsupportedConfiguration: {
Message: "unable to support the password config type",
Kind: Password,
},
PasswordInvalidConfiguration: {
Message: "invalid parameters in password configuration",
Kind: Password,
},
PasswordsEqual: {
Message: "old and new password are equal",
Kind: Password,
},
Encrypt: {
Message: "error occurred during encrypt",
Kind: Encryption,
},
Decrypt: {
Message: "error occurred during decrypt",
Kind: Encryption,
},
Encode: {
Message: "error occurred during encode",
Kind: Encoding,
},
Decode: {
Message: "error occurred during decode",
Kind: Encoding,
},
GenKey: {
Message: "error occurred during key generation",
Kind: Encryption,
},
GenCert: {
Message: "error occurred during certification generation",
Kind: Encryption,
},
Internal: {
Message: "internal error",
Kind: Other,
},
Forbidden: {
Message: "forbidden",
Kind: Other,
},
Unauthorized: {
Message: "unauthorized",
Kind: Other,
},
CheckConstraint: {
Message: "constraint check failed",
Kind: Integrity,
},
NotNull: {
Message: "must not be empty (null) violation",
Kind: Integrity,
},
NotUnique: {
Message: "must be unique violation",
Kind: Integrity,
},
NotSpecificIntegrity: {
Message: "Integrity violation without specific details",
Kind: Integrity,
},
MissingTable: {
Message: "missing table",
Kind: Integrity,
},
ColumnNotFound: {
Message: "column not found",
Kind: Integrity,
},
RecordNotFound: {
Message: "record not found",
Kind: Search,
},
MultipleRecords: {
Message: "multiple records",
Kind: Search,
},
Exception: {
Message: "db exception",
Kind: Integrity,
},
VersionMismatch: {
Message: "version mismatch",
Kind: Integrity,
},
MaxRetries: {
Message: "too many retries",
Kind: Transaction,
},
MigrationIntegrity: {
Message: "migration integrity",
Kind: Integrity,
},
MigrationLock: {
Message: "bad db lock",
Kind: Integrity,
},
Unavailable: {
Message: "external system unavailable",
Kind: External,
},
VaultTokenNotOrphan: {
Message: "vault token is not an orphan token",
Kind: VaultToken,
},
VaultTokenNotPeriodic: {
Message: "vault token is not a periodic token",
Kind: VaultToken,
},
VaultTokenNotRenewable: {
Message: "vault token is not renewable",
Kind: VaultToken,
},
VaultTokenMissingCapabilities: {
Message: "vault token is missing capabilities",
Kind: VaultToken,
},
VaultCredentialRequest: {
Message: "request for a new credential from vault failed",
Kind: External,
},
VaultEmptySecret: {
Message: "vault secret is empty",
Kind: Integrity,
},
OidcProviderCallbackError: {
Message: "oidc provider callback error",
Kind: External,
},
GracefullyAborted: {
Message: "purposefully aborted without error",
Kind: Other,
},
UnexpectedRowsAffected: {
Message: "unexpected number of rows affected",
Kind: Integrity,
},
}