-
Notifications
You must be signed in to change notification settings - Fork 560
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
set-json to fail on custom policies without .json #4745
set-json to fail on custom policies without .json #4745
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File extension shouldn't really matter IMO.
The previous code only validates the file ext, so i think only
|
cmd/access-perms.go
Outdated
@@ -28,12 +33,50 @@ func (b accessPerms) isValidAccessPERM() bool { | |||
return false | |||
} | |||
|
|||
type PolicyDocument struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why a new struct - can you not use pkg/policy
?
the file extension check can be relaxed though. |
Do you mean I should remove it? |
Yes @r-scheele |
@@ -52,7 +52,7 @@ var anonymousCmd = cli.Command{ | |||
|
|||
USAGE: | |||
{{.HelpName}} [FLAGS] set PERMISSION TARGET | |||
{{.HelpName}} [FLAGS] set-json TARGET FILE | |||
{{.HelpName}} [FLAGS] set-json FILE TARGET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the example below as well ?
Fix set-json command to fail on custom policies without .json
This commit addresses the bug where the
set-json
command incorrectlysucceeds for custom policies even when the policy file doesn't have a .json
extension. The fix ensures that the command fails as expected, prompting the user to use the correct file.
./mc anonymous set-json myminio/mydata ~/test/anonymous.json
Now,
set-json
will return an error message if the provided policy file is not a .json, aligning the behavior with the documented functionality.Related to the discussion with @kannappanr