Skip to content

API for checking object management permissions #2086

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

Closed
wants to merge 1 commit into from

Conversation

shtripat
Copy link
Contributor

@shtripat shtripat commented Apr 3, 2025

Check if given user's IAM policies allow s3:PutObject/s3:DeleteObject on given bucket

Check if given user's IAM policies allow s3:PutObject/s3:DeleteObject
on given bucket

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
@@ -1071,3 +1071,15 @@ func (c *Client) CredContext() *credentials.CredContext {
Endpoint: c.endpointURL.String(),
}
}

// GetCreds returns the access creds for the client
func (c *Client) GetCreds() (string, string, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Credentials are always 3 entities, you should return the value()

But what is the point of this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed with new changes. Will remove.

@@ -145,3 +145,32 @@ func (c *Client) getBucketPolicy(ctx context.Context, bucketName string) (string
policy := string(bucketPolicyBuf)
return policy, err
}

// CheckObjectManagePermissions verifies if user has object permissions for given bucket
func (c *Client) CheckObjectManagePermissions(ctx context.Context, bucket string, user string) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also why is this an S3 SDK API? This is specific to MinIO and must be in madmin-go

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This we are checking with replicated bucket target clients. We need to reach all targets of bucket replication and see target has got PutObject/DeleteObject etc. Is there a way to achieve it? I may be missing something here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add a new API in admin API for that not here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to implement a proper S3 API then implement GetAccessBlock()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in madmin-go

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will better move to madmin-go

@@ -145,3 +145,32 @@ func (c *Client) getBucketPolicy(ctx context.Context, bucketName string) (string
policy := string(bucketPolicyBuf)
return policy, err
}

// CheckObjectManagePermissions verifies if user has object permissions for given bucket
func (c *Client) CheckObjectManagePermissions(ctx context.Context, bucket string, user string) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to implement a proper S3 API then implement GetAccessBlock()

@shtripat
Copy link
Contributor Author

shtripat commented Apr 5, 2025

Closing as #2089 takes care creds and API is added as admin API.

@shtripat shtripat closed this Apr 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants