mirror of
https://github.com/zitadel/zitadel.git
synced 2026-07-25 18:28:00 +00:00
# Which Problems Are Solved The payload in actions V2 is currently sent as JSON to the target endpoint. It might get exposed to intermediary infrastructure or logging systems. For these scenarios there needs to be an application-layer encryption, where the provider of the endpoint can define an key to be used for the encryption. # How the Problems Are Solved - Added an additional option to the target to specify the payload type: `JSON` (current and default), `JWT`, `JWE` (api and console) - added endpoints to upload and manage public keys (to be used for encryption) for a target - updated all action v2 executions (interceptors, oidc, saml, ...) to provide the `GetActiveSigningWebKey` from queries - implemented jwt and jwe in the exections incl. refactoring of code and tests - changes to the authn_keys table: - added a `fingerprint` column - dropped not null constraint on expiration - moved the `GetSignerOnce` into its own package to prevent circular dependencies # Additional Changes None # Additional Context closes #11061 --------- Co-authored-by: Marco A. <marco@zitadel.com> Co-authored-by: conblem <mail@conblem.me> Co-authored-by: Silvan <27845747+adlerhurst@users.noreply.github.com>
73 lines
1.8 KiB
Go
73 lines
1.8 KiB
Go
package target
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/zitadel/zitadel/internal/crypto"
|
|
)
|
|
|
|
type TargetType uint
|
|
|
|
const (
|
|
TargetTypeWebhook TargetType = iota
|
|
TargetTypeCall
|
|
TargetTypeAsync
|
|
)
|
|
|
|
type PayloadType uint
|
|
|
|
const (
|
|
PayloadTypeUnspecified PayloadType = iota
|
|
PayloadTypeJSON
|
|
PayloadTypeJWT
|
|
PayloadTypeJWE
|
|
)
|
|
|
|
type Target struct {
|
|
ExecutionID string `json:"execution_id,omitempty"`
|
|
TargetID string `json:"target_id,omitempty"`
|
|
TargetType TargetType `json:"target_type,omitempty"`
|
|
Endpoint string `json:"endpoint,omitempty"`
|
|
Timeout time.Duration `json:"timeout,omitempty"`
|
|
InterruptOnError bool `json:"interrupt_on_error,omitempty"`
|
|
SigningKey *crypto.CryptoValue `json:"signing_key,omitempty"`
|
|
PayloadType PayloadType `json:"payload_type,omitempty"`
|
|
EncryptionKey []byte `json:"encryption_key,omitempty"`
|
|
EncryptionKeyID string `json:"encryption_key_id,omitempty"`
|
|
}
|
|
|
|
func (e *Target) GetExecutionID() string {
|
|
return e.ExecutionID
|
|
}
|
|
func (e *Target) GetTargetID() string {
|
|
return e.TargetID
|
|
}
|
|
func (e *Target) IsInterruptOnError() bool {
|
|
return e.InterruptOnError
|
|
}
|
|
func (e *Target) GetEndpoint() string {
|
|
return e.Endpoint
|
|
}
|
|
func (e *Target) GetTargetType() TargetType {
|
|
return e.TargetType
|
|
}
|
|
func (e *Target) GetTimeout() time.Duration {
|
|
return e.Timeout
|
|
}
|
|
func (e *Target) GetSigningKey(alg crypto.EncryptionAlgorithm) (string, error) {
|
|
if e.SigningKey == nil {
|
|
return "", nil
|
|
}
|
|
return crypto.DecryptString(e.SigningKey, alg)
|
|
}
|
|
func (e *Target) GetPayloadType() PayloadType {
|
|
return e.PayloadType
|
|
}
|
|
func (e *Target) GetEncryptionKey() []byte {
|
|
return e.EncryptionKey
|
|
}
|
|
|
|
func (e *Target) GetEncryptionKeyID() string {
|
|
return e.EncryptionKeyID
|
|
}
|