diff --git a/post-policy.go b/post-policy.go index 6d42488e5..4cc9e24d5 100644 --- a/post-policy.go +++ b/post-policy.go @@ -19,12 +19,14 @@ package minio import ( "encoding/base64" + "errors" "fmt" "net/http" "strings" "time" "github.com/minio/minio-go/v7/pkg/encrypt" + "github.com/minio/minio-go/v7/pkg/tags" ) // expirationDateFormat date format for expiration key in json policy. @@ -157,6 +159,10 @@ func (p *PostPolicy) SetTagging(tagging string) error { if strings.TrimSpace(tagging) == "" || tagging == "" { return errInvalidArgument("No tagging specified.") } + _, err := tags.ParseObjectXML(strings.NewReader(tagging)) + if err != nil { + return errors.New("The XML you provided was not well-formed or did not validate against our published schema.") + } policyCond := policyCondition{ matchType: "eq", condition: "$tagging",