From e4eda79b5ac852ad478a38bf2493ae1663d56e07 Mon Sep 17 00:00:00 2001 From: dantecatalfamo Date: Thu, 19 Dec 2024 10:34:20 -0500 Subject: [PATCH] Remove unnecessary validation before secret expandion --- server/service/apple_mdm.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/server/service/apple_mdm.go b/server/service/apple_mdm.go index 60095583958f..f1415ab1bc82 100644 --- a/server/service/apple_mdm.go +++ b/server/service/apple_mdm.go @@ -380,14 +380,10 @@ func (svc *Service) NewMDMAppleConfigProfile(ctx context.Context, teamID uint, r }) } - if err := svc.ds.ValidateEmbeddedSecrets(ctx, []string{string(b)}); err != nil { - return nil, fleet.NewInvalidArgumentError("profile", err.Error()) - } - - // Expand secrets in profile for validation + // Expand and validate secrets in profile expanded, err := svc.ds.ExpandEmbeddedSecrets(ctx, string(b)) if err != nil { - return nil, ctxerr.Wrap(ctx, err, "expanding secrets in profile for parsing") + return nil, ctxerr.Wrap(ctx, fleet.NewInvalidArgumentError("profile", err.Error())) } cp, err := fleet.NewMDMAppleConfigProfile([]byte(expanded), &teamID)