{"record":{"id":"3d57737a3c2f80ed","repo":"hyperledger/fabric","slug":"nil-arguments","errorCode":null,"errorMessage":"nil arguments","messagePattern":"nil arguments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/common/validation/msgvalidation.go","lineNumber":31,"sourceCode":"\t\"github.com/hyperledger/fabric-lib-go/common/flogging\"\n\t\"github.com/hyperledger/fabric-protos-go-apiv2/common\"\n\tpb \"github.com/hyperledger/fabric-protos-go-apiv2/peer\"\n\tmspmgmt \"github.com/hyperledger/fabric/msp/mgmt\"\n\t\"github.com/hyperledger/fabric/protoutil\"\n\t\"github.com/pkg/errors\"\n)\n\nvar putilsLogger = flogging.MustGetLogger(\"protoutils\")\n\n// given a creator, a message and a signature,\n// this function returns nil if the creator\n// is a valid cert and the signature is valid\nfunc checkSignatureFromCreator(creatorBytes, sig, msg []byte, ChannelID string, cryptoProvider bccsp.BCCSP) error {\n\tputilsLogger.Debugf(\"begin\")\n\n\t// check for nil argument\n\tif creatorBytes == nil || sig == nil || msg == nil {\n\t\treturn errors.New(\"nil arguments\")\n\t}\n\n\tmspObj := mspmgmt.GetIdentityDeserializer(ChannelID, cryptoProvider)\n\tif mspObj == nil {\n\t\treturn errors.Errorf(\"could not get msp for channel [%s]\", ChannelID)\n\t}\n\n\t// get the identity of the creator\n\tcreator, err := mspObj.DeserializeIdentity(creatorBytes)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"MSP error\")\n\t}\n\n\tputilsLogger.Debugf(\"creator is %s\", creator.GetIdentifier())\n\n\t// ensure that creator is a valid certificate\n\terr = creator.Validate()\n\tif err != nil {","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/common/validation/msgvalidation.go#L13-L49","documentation":"checkSignatureFromCreator validates that a transaction was signed by its declared creator. It requires the serialized creator identity, the signature, and the signed message bytes to all be non-nil. If any of these three inputs is nil, there is nothing to verify, so the function immediately returns this error without touching MSP or crypto.","triggerScenarios":"Calling checkSignatureFromCreator (directly or via ValidateTransaction) with creatorBytes == nil, sig == nil, or msg == nil — typically when a parsed Envelope has a nil Signature field or a nil Payload, or when a test passes partial byte slices.","commonSituations":"Hand-constructed envelopes in tests, protobuf unmarshalling that leaves optional fields nil (e.g. Envelope.Signature unset), or upstream code failing to check that payload/signature bytes were present before invoking validation.","solutions":["Ensure the submitted Envelope has both Payload and Signature populated before calling ValidateTransaction","Add a nil check on envelope.Signature / envelope.Payload in the submit path and reject the tx earlier with a clearer client-side message","In tests, pass non-empty byte slices for creatorBytes, sig, and msg, or assert this error is the expected outcome"],"exampleFix":"// before\nerr := validation.ValidateTransaction(&common.Envelope{Payload: payloadBytes}, cryptoProvider)\n// after\nif env.Signature == nil || env.Payload == nil {\n    return errors.New(\"envelope must contain payload and signature\")\n}\nerr := validation.ValidateTransaction(env, cryptoProvider)","handlingStrategy":"validation","validationCode":"func validEnvelope(env *common.Envelope) bool {\n    return env != nil && env.Payload != nil && env.Signature != nil\n}\n// call only if validEnvelope(env) before ValidateTransaction","typeGuard":"func hasSignatureAndPayload(env *common.Envelope) bool {\n    return env != nil && len(env.Payload) > 0 && len(env.Signature) > 0\n}","tryCatchPattern":"err := validation.ValidateTransaction(env, cryptoProvider)\nif err != nil && err.Error() == \"nil arguments\" {\n    // reject as MALFORMED_TX: envelope missing payload or signature\n}","preventionTips":["Always sign the payload bytes and attach Signature before validation","Check protobuf optional fields for nil after unmarshalling envelopes","Add early client-side structural validation of Envelope before submit"],"tags":["hyperledger-fabric","validation","nil-argument","transaction-signature"],"backgroundTag":"nil-argument-validation","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}