Language: Go
Label: safe
CWE: CWE-617 \u2014 Reachable Assertion
The product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary.

Code:
func (v V002Entry) Insertable() (bool, error) {
	if v.IntotoObj.Content == nil {
		return false, errors.New("missing content property")
	}
	if v.IntotoObj.Content.Envelope == nil {
		return false, errors.New("missing envelope property")
	}
	if len(v.IntotoObj.Content.Envelope.Payload) == 0 {
		return false, errors.New("missing envelope content")
	}

	if v.IntotoObj.Content.Envelope.PayloadType == nil || len(*v.IntotoObj.Content.Envelope.PayloadType) == 0 {
		return false, errors.New("missing payloadType content")
	}

	if len(v.IntotoObj.Content.Envelope.Signatures) == 0 {
		return false, errors.New("missing signatures content")
	}
	for _, sig := range v.IntotoObj.Content.Envelope.Signatures {
		if sig == nil {
			return false, errors.New("missing signature entry")
		}
		if sig.Sig == nil || len(*sig.Sig) == 0 {
			return false, errors.New("missing signature content")
		}
		if sig.PublicKey == nil || len(*sig.PublicKey) == 0 {
			return false, errors.New("missing publicKey content")
		}
	}

	if v.env.Payload == "" || v.env.PayloadType == "" || len(v.env.Signatures) == 0 {
		return false, errors.New("invalid DSSE envelope")
	}

	return true, nil
}