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 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 {
		keyBytes := strfmt.Base64(pub[i])
		sigBytes := strfmt.Base64([]byte(sig.Sig))
		env.Signatures = append(env.Signatures, &models.IntotoV002SchemaContentEnvelopeSignaturesItems0{
			Keyid:     sig.KeyID,
			Sig:       &sigBytes,
			PublicKey: &keyBytes,
		})
	}

	return env
}