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

Large MC Update ( encryption flags, functional test suite, removal of session code, minor cleanup, vuln. updates ) #4882

Merged
merged 2 commits into from
Apr 15, 2024

Conversation

zveinn
Copy link
Contributor

@zveinn zveinn commented Mar 21, 2024

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers
under the terms of the Apache 2 license.
By creating this pull request I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 license.

Note

This is a rather large update to the mc so let's take our time to review and discuss

The test suite

The new test suite is created to run an mc binary against an endpoint. The idea is to be able to run any version of mc against any version of minio by just changing .env variables. Our ci pipeline is currently not set up for that, so the test suite will not run automatically for now.

The test suite is a replacement for the bash functional suite we had before and was hard to modify and maintain. The new suite covers all tests cases that the bash test suite used to cover, hence why it took so long to submit this PR.
Along with the old test cases we have a lot of new ones as well, especially regarding the new encryption flags.

MC updates

This PR contains a few items that needed a fix and have been sittin in the backlog.
Normally I would not bundle so many things together but since the core change
for this PR was to deprecate the --encrypt --encrypt-kms and --encrypt-s3 flags it
was a good chance to also include the new functional test suite to cover the changes.

During the update I discovered that some of the mc methods have documentation stating
that they can accept encryption flags, but in reality these methods do not need
encryption at all. This lead to a small refactor of certain methods.

Another change that kind of just happened during this refactor was the removal of the
--continue flag. This flag was behaving in an insecure way and after a discussion with
AB, we decided to completely remove this code from the mc client.

Things that were fixed/changed

  • Removes deprecated documentation and updated Readme.md
  • '--continue' flag has been deprecated
  • '--encrypt' flag is now called '--enc-c'
  • '--encrypt-s3' flag is now called '--enc-s3'
  • '--encrypt-kms' flag is now called '--enc-kms'
  • Previous encrypt flag parsing was broken and allowed for invalid keys to be accepted as valid ones.
  • Help menu documentaion on encryption flags (and some others) has been updated
  • Removed encryption flags/code from methods that do not need encryption to function

Changed encryption flag functionality

The new encryption flags (--enc-s3, --enc-kms, --enc-c) will only accept RawBase64 encoded keys and
the cli parameters are now '[]string' instead of 'string'. This allows us to properly parse the keys.

Deprecated flags

  • '--encrypt'
  • '--encrypt-key'
  • '--continue'

New flags

  • '--enc-c'
  • '--enc-kms'
  • '--enc-s3'

Types of changes

  • [ x ] Bug fix (non-breaking change which fixes an issue)
  • [ x ] New feature (non-breaking change which adds functionality)
  • [ x ] Optimization (provides speedup with no functional changes)
  • [ x ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [ x ] Unit tests added/updated
  • [ x ] Internal documentation updated
  • [ x ] Create a documentation update request here

@ravindk89
Copy link
Contributor

@zveinn is it a hard requirement for us to rename --encrypt<method> to --enc-<method> ?

@zveinn
Copy link
Contributor Author

zveinn commented Mar 21, 2024

@zveinn is it a hard requirement for us to rename --encrypt<method> to --enc-<method> ?

It's not a hard requirement, but even if we rename the flags they will not function the same. So it's better to change the name entirely to prevent confusion. Originally we were going to keep backwards compatibility on this, but we decided that was not a good idea.

But I am neutral on the renaming tbh, if we want to keep the old names then that's all good.

@ravindk89
Copy link
Contributor

🤔 @djwfyi @feorlen I'm not of a strong opinion - it's more important that we keep consistent moving forward.. We can document it either way.

@feorlen
Copy link
Contributor

feorlen commented Mar 21, 2024

🤔 @djwfyi @feorlen I'm not of a strong opinion - it's more important that we keep consistent moving forward.. We can document it either way.

Do we have a schedule to deprecate then remove for these? I'm fine with name changes as long as we are able to handle the transition in an orderly fashion.

@ravindk89
Copy link
Contributor

🤔 @djwfyi @feorlen I'm not of a strong opinion - it's more important that we keep consistent moving forward.. We can document it either way.

Do we have a schedule to deprecate then remove for these? I'm fine with name changes as long as we are able to handle the transition in an orderly fashion.

@kannappanr it might be nice to flesh out how exactly we want to time deprecations, this conversation is also at hand in minio/operator#2032 (comment)

@zveinn
Copy link
Contributor Author

zveinn commented Mar 21, 2024

🤔 @djwfyi @feorlen I'm not of a strong opinion - it's more important that we keep consistent moving forward.. We can document it either way.

Do we have a schedule to deprecate then remove for these? I'm fine with name changes as long as we are able to handle the transition in an orderly fashion.

I don't think we're doing a deprecation phase for this one.

Copy link
Contributor

@shtripat shtripat left a comment

Choose a reason for hiding this comment

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

initial minor ones

cmd/cp-main.go Outdated Show resolved Hide resolved
cmd/encryption-methods.go Outdated Show resolved Hide resolved
cmd/get-main.go Outdated Show resolved Hide resolved
cmd/mirror-main.go Outdated Show resolved Hide resolved
cmd/mv-main.go Outdated Show resolved Hide resolved
cmd/put-main.go Show resolved Hide resolved
cmd/rm-main.go Outdated Show resolved Hide resolved
cmd/typed-errors.go Outdated Show resolved Hide resolved
Copy link
Contributor

@klauspost klauspost left a comment

Choose a reason for hiding this comment

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

Just some minor stuff.

cmd/encryption-methods.go Outdated Show resolved Hide resolved
cmd/encryption-methods.go Show resolved Hide resolved
cmd/encryption-methods.go Outdated Show resolved Hide resolved
cmd/encryption-methods.go Show resolved Hide resolved
cmd/encryption-methods.go Outdated Show resolved Hide resolved
cmd/error.go Outdated Show resolved Hide resolved
cmd/error.go Outdated Show resolved Hide resolved
cmd/head-main.go Show resolved Hide resolved
cmd/pipe-main.go Outdated Show resolved Hide resolved
docs/MAINTAINERS.md Show resolved Hide resolved
@zveinn zveinn force-pushed the sse-adjustments branch 2 times, most recently from a33beaf to d7ea482 Compare April 10, 2024 12:50
@zveinn zveinn changed the title [ DRAFT ] Large MC Update Large MC Update ( encryption flags, functional test suite, removal of session code, minor cleanup, vuln. updates ) Apr 10, 2024
Copy link
Contributor

@klauspost klauspost left a comment

Choose a reason for hiding this comment

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

LGTM

cmd/encryption-methods.go Show resolved Hide resolved
cmd/encryption-methods_test.go Show resolved Hide resolved
cmd/error.go Outdated Show resolved Hide resolved
cmd/flags.go Outdated Show resolved Hide resolved
cmd/flags.go Outdated Show resolved Hide resolved
cmd/flags.go Outdated Show resolved Hide resolved
cmd/get-main.go Outdated Show resolved Hide resolved
cmd/get-main.go Outdated Show resolved Hide resolved
cmd/pipe-main.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@zveinn
Copy link
Contributor Author

zveinn commented Apr 11, 2024

Just did a small refactor for the encryption key parsing, there was a method that was forcing the use of only one type of key at a time. It's been removed and the code paths simplified.

@zveinn zveinn requested a review from jiuker April 11, 2024 12:29
Copy link
Contributor

@shtripat shtripat left a comment

Choose a reason for hiding this comment

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

few minor ones only

cmd/cat-main.go Show resolved Hide resolved
cmd/cp-main.go Outdated Show resolved Hide resolved
cmd/flags.go Show resolved Hide resolved
cmd/head-main.go Outdated Show resolved Hide resolved
cmd/mirror-main.go Outdated Show resolved Hide resolved
@harshavardhana harshavardhana merged commit fe58afc into minio:master Apr 15, 2024
7 checks passed
allanrogerr added a commit to minio/docs that referenced this pull request Oct 22, 2024
Change encrypt-key to enc-c
Keys cannot end in "="
See minio/mc#4882
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants