Language: Go
Label: vulnerable
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 createRekorEnvelope(dsseEnv *dsse.Envelope, pub [][]byte) *models.IntotoV002SchemaContentEnvelope {
	env := &models.IntotoV002SchemaContentEnvelope{}
	b64 := strfmt.Base64([]byte(dsseEnv.Payload))
	env.Payload = b64
	env.PayloadType = &dsseEnv.PayloadType

	for i, sig := range dsseEnv.Signatures {
		env.Signatures = append(env.Signatures, &models.IntotoV002SchemaContentEnvelopeSignaturesItems0{
			Keyid:     sig.KeyID,
			Sig:       strfmt.Base64([]byte(sig.Sig)),
			PublicKey: strfmt.Base64(pub[i]),
		})
	}

	return env
}