Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject policy with comma in name #5091

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/admin-policy-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
package cmd

import (
"errors"
"fmt"
"os"
"strings"

"github.com/fatih/color"
"github.com/minio/cli"
Expand Down Expand Up @@ -126,6 +128,10 @@ func mainAdminPolicyCreate(ctx *cli.Context) error {
args := ctx.Args()
aliasedURL := args.Get(0)

if strings.Contains(args.Get(1), ",") {
fatalIf(probe.NewError(errors.New("policy name may not include comma")), "Only a single policy may be specified here.")
}

policy, e := os.ReadFile(args.Get(2))
fatalIf(probe.NewError(e).Trace(args...), "Unable to get policy")

Expand Down
Loading