Просмотр исходного кода

Add provisionerName to webhook request for x509 and SSH

Yannik Sembritzki 8 месяцев назад
Родитель
Сommit
6e2315d8ca
2 измененных файлов с 12 добавлено и 0 удалено
  1. 6 0
      authority/ssh.go
  2. 6 0
      authority/tls.go

+ 6 - 0
authority/ssh.go

@@ -700,6 +700,9 @@ func (a *Authority) callEnrichingWebhooksSSH(ctx context.Context, prov provision
 	if whEnrichReq, err = webhook.NewRequestBody(
 		webhook.WithSSHCertificateRequest(cr),
 	); err == nil {
+		if prov != nil {
+			whEnrichReq.ProvisionerName = prov.GetName()
+		}
 		err = webhookCtl.Enrich(ctx, whEnrichReq)
 	}
 
@@ -716,6 +719,9 @@ func (a *Authority) callAuthorizingWebhooksSSH(ctx context.Context, prov provisi
 	if whAuthBody, err = webhook.NewRequestBody(
 		webhook.WithSSHCertificate(cert, certTpl),
 	); err == nil {
+		if prov != nil {
+			whAuthBody.ProvisionerName = prov.GetName()
+		}
 		err = webhookCtl.Authorize(ctx, whAuthBody)
 	}
 

+ 6 - 0
authority/tls.go

@@ -1053,6 +1053,9 @@ func (a *Authority) callEnrichingWebhooksX509(ctx context.Context, prov provisio
 		webhook.WithX509CertificateRequest(csr),
 		webhook.WithAttestationData(attested),
 	); err == nil {
+		if prov != nil {
+			whEnrichReq.ProvisionerName = prov.GetName()
+		}
 		err = webhookCtl.Enrich(ctx, whEnrichReq)
 	}
 
@@ -1077,6 +1080,9 @@ func (a *Authority) callAuthorizingWebhooksX509(ctx context.Context, prov provis
 		webhook.WithX509Certificate(cert, leaf),
 		webhook.WithAttestationData(attested),
 	); err == nil {
+		if prov != nil {
+			whAuthBody.ProvisionerName = prov.GetName()
+		}
 		err = webhookCtl.Authorize(ctx, whAuthBody)
 	}