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

importinto: check access of cloud storage uri #47206

Merged
merged 6 commits into from
Sep 22, 2023

Conversation

D3Hunter
Copy link
Contributor

@D3Hunter D3Hunter commented Sep 22, 2023

What problem does this PR solve?

Issue Number: ref #46704

Problem Summary:

What is changed and how it works?

add check of put&delete to br/storage
check permission of cloud_storage_uri for importinto

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    create a bucket on cloud without any permission, do precheck with that bucket, return access denied
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Sep 22, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 22, 2023

Hi @D3Hunter. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@D3Hunter
Copy link
Contributor Author

/label ok-to-test
/remove-label needs-ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Sep 22, 2023
@tiprow
Copy link

tiprow bot commented Sep 22, 2023

Hi @D3Hunter. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@D3Hunter
Copy link
Contributor Author

/retest

Copy link
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

maybe do a manually test as well

AccessBuckets: checkS3Bucket,
ListObjects: listObjects,
GetObject: getObject,
PutAndDeleteObject: PutAndDeleteObjectCheck,
Copy link
Contributor

Choose a reason for hiding this comment

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

naming style is slightly different 🤔 and seems no need to be public

Copy link
Contributor Author

Choose a reason for hiding this comment

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

seems no need to be public

the test is in a package named as storage_test

@@ -486,25 +520,30 @@ func (rs *S3Storage) IsObjectLockEnabled() bool {
return false
}

// WriteFile writes data to a file to storage.
func (rs *S3Storage) WriteFile(ctx context.Context, file string, data []byte) error {
func getPutObjectInput(options *backuppb.S3, file string, data []byte) *s3.PutObjectInput {
Copy link
Contributor

Choose a reason for hiding this comment

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

getXXX makes me think it's a read action. Maybe buildPutObjectInput

@lance6716
Copy link
Contributor

rest lgtm

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Merging #47206 (f972e26) into master (4e82952) will decrease coverage by 0.3067%.
Report is 1 commits behind head on master.
The diff coverage is 93.6708%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #47206        +/-   ##
================================================
- Coverage   72.9807%   72.6740%   -0.3067%     
================================================
  Files          1340       1361        +21     
  Lines        400018     406368      +6350     
================================================
+ Hits         291936     295324      +3388     
- Misses        89176      92276      +3100     
+ Partials      18906      18768       -138     
Flag Coverage Δ
integration 32.3153% <0.0000%> (?)
unit 72.9812% <93.6708%> (+0.0005%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9913% <ø> (ø)
parser 84.9484% <ø> (+0.0118%) ⬆️
br 48.7544% <95.1219%> (-4.2772%) ⬇️

@D3Hunter
Copy link
Contributor Author

maybe do a manually test as well

already done

@D3Hunter
Copy link
Contributor Author

@lance6716

br/pkg/storage/s3.go Outdated Show resolved Hide resolved
br/pkg/storage/s3.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@Benjamin2037 Benjamin2037 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 22, 2023
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 22, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 22, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-22 13:07:10.409904456 +0000 UTC m=+21020.128246674: ☑️ agreed by Benjamin2037.
  • 2023-09-22 14:29:46.381280599 +0000 UTC m=+25976.099622816: ☑️ agreed by tangenta.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 22, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Benjamin2037, lance6716, tangenta, zanmato1984

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Sep 22, 2023
@ti-chi-bot ti-chi-bot bot merged commit 9d29580 into pingcap:master Sep 22, 2023
20 of 27 checks passed
@D3Hunter D3Hunter deleted the check-priv branch September 23, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants