forked from CenterForOpenScience/osf.io
-
Notifications
You must be signed in to change notification settings - Fork 28
feat(s3): S3アドオンにSigV4署名を追加 #746
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
Open
tishin-endou
wants to merge
19
commits into
RCOSDP:develop
Choose a base branch
from
tishin-endou:feature/s3-sigv4-clean
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7f5f67b
feat(s3): support SigV4 in addon
tishin-endou 271d354
test(s3): fix nose残骸 in test_view.py (problem A)
tishin-endou ebbc92e
fix(s3): update stale _mock_folder_result to SigV4 get_folders format
tishin-endou 6018edc
test(s3): add test_set_folder_nonexistent_bucket for InvalidFolderErr…
tishin-endou 62bea9f
test(s3): add provider_id format and dedup tests (GRDM-53044, G5)
tishin-endou 971bc6c
fix(s3): use context managers for G5 tests to avoid decorator/setUp p…
tishin-endou 3d3211d
fix(s3): G5 tests rely on setUp mocks to avoid webtest_plus patch con…
tishin-endou 5cd292a
fix(s3): convert json= kwarg to post_json/put_json; add G1/G2/G4/G5/G…
tishin-endou 1d8b8f0
fix(s3): catch IntegrityError with savepoint in s3_add_user_account (…
tishin-endou 591f338
fix(s3): fix get_user_info mock in setUp — use return_value kwarg (G5)
tishin-endou 48d4202
fix(s3): query ExternalAccount by provider_id not oauth_key (JWE non-…
tishin-endou 6378126
test(s3): add ClientError and InvalidAuthError exception path tests
tishin-endou bcbce3a
fix(s3): revert MAX_UPLOAD_SIZE to 50GB (multipart supports up to 5TB)
tishin-endou fdd7b51
fix(s3): restore i18n gettext wrappers in 3 mako templates
tishin-endou b6c9d18
fix(s3): restore empty requirements.txt for Dockerfile COPY compatibi…
tishin-endou 9309e4d
fix(s3): tolerate missing owner display name
tishin-endou b754f78
fix(s3): preserve bucket names in settings checks
tishin-endou 3ee195c
test(s3): avoid pytest parametrization in TestCase
tishin-endou 679d331
fix(admin): preserve s3 owner response shape
tishin-endou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| boto==2.38.0 | ||
| # boto (v2) was removed as part of SigV4 migration. | ||
| # boto3/botocore are declared in the root requirements.txt. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,46 @@ | ||
| var Rubeus = require('rubeus'); | ||
| var Rubeus = require('rubeus'); | ||
|
|
||
| Rubeus.cfg.s3 = { | ||
| Rubeus.cfg.s3 = { | ||
|
|
||
| uploadMethod: 'PUT', | ||
| uploadUrl: null, | ||
| uploadAdded: function(file, item) { | ||
| var self = this; | ||
| var parent = self.getByID(item.parentID); | ||
| var name = file.name; | ||
| // Make it possible to upload into subfolders | ||
| while (parent.depth > 1 && !parent.isAddonRoot) { | ||
| name = parent.name + '/' + name; | ||
| parent = self.getByID(parent.parentID); | ||
| } | ||
| file.destination = name; | ||
| file.signedUrlFrom = parent.urls.upload; | ||
| }, | ||
| uploadMethod: 'PUT', | ||
| uploadUrl: null, | ||
| uploadAdded: function (file, item) { | ||
| var self = this; | ||
| var parent = self.getByID(item.parentID); | ||
| var name = file.name; | ||
| // Make it possible to upload into subfolders | ||
| while (parent.depth > 1 && !parent.isAddonRoot) { | ||
| name = parent.name + '/' + name; | ||
| parent = self.getByID(parent.parentID); | ||
| } | ||
| file.destination = name; | ||
| file.signedUrlFrom = parent.urls.upload; | ||
| }, | ||
|
|
||
| uploadSending: function(file, formData, xhr) { | ||
| xhr.setRequestHeader('Content-Type', file.type || 'application/octet-stream'); | ||
| xhr.setRequestHeader('x-amz-acl', 'private'); | ||
| }, | ||
| uploadSending: function (file, formData, xhr) { | ||
| xhr.setRequestHeader('Content-Type', file.type || 'application/octet-stream'); | ||
| xhr.setRequestHeader('x-amz-acl', 'private'); | ||
| }, | ||
|
|
||
| uploadSuccess: function(file, row) { | ||
| var self = this; | ||
| var parent = this.getByID(row.parentID); | ||
| row.urls = { | ||
| 'delete': parent.nodeApiUrl + 's3/' + file.destination + '/', | ||
| 'download': parent.nodeUrl + 's3/' + file.destination + '/download/', | ||
| 'view': parent.nodeUrl + 's3/' + file.destination + '/' | ||
| }; | ||
| row.permissions = parent.permissions; | ||
| this.updateItem(row); | ||
| var updated = Rubeus.Utils.itemUpdated(row, parent); | ||
| if (updated) { | ||
| self.changeStatus(row, Rubeus.Status.UPDATED); | ||
| self.delayRemoveRow(row); | ||
| } else { | ||
| self.changeStatus(row, Rubeus.Status.UPLOAD_SUCCESS, null, 2000, | ||
| function(row) { | ||
| self.showButtons(row); | ||
| }); | ||
| } | ||
| uploadSuccess: function (file, row) { | ||
| var self = this; | ||
| var parent = this.getByID(row.parentID); | ||
| row.urls = { | ||
| 'delete': parent.nodeApiUrl + 's3/' + file.destination + '/', | ||
| 'download': parent.nodeUrl + 's3/' + file.destination + '/download/', | ||
| 'view': parent.nodeUrl + 's3/' + file.destination + '/' | ||
| }; | ||
| row.permissions = parent.permissions; | ||
| this.updateItem(row); | ||
| var updated = Rubeus.Utils.itemUpdated(row, parent); | ||
| if (updated) { | ||
| self.changeStatus(row, Rubeus.Status.UPDATED); | ||
| self.delayRemoveRow(row); | ||
| } else { | ||
| self.changeStatus(row, Rubeus.Status.UPLOAD_SUCCESS, null, 2000, | ||
| function (row) { | ||
| self.showButtons(row); | ||
| }); | ||
| } | ||
| }; | ||
|
|
||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| { | ||
| "s3_bucket_linked" : "A user linked an Amazon S3 bucket to a project", | ||
| "s3_bucket_unlinked" : "A user unselected an Amazon S3 bucket in a project", | ||
| "s3_file_added" : "A user added a file to an Amazon S3 bucket in a project", | ||
| "s3_file_removed" : "A user removed a file in an Amazon S3 bucket in a project", | ||
| "s3_file_updated" : "A user updated a file in an Amazon S3 bucket in a project", | ||
| "s3_folder_created" : "A user created a folder in an Amazon S3 in a project", | ||
| "s3_node_authorized" : "A user authorized the Amazon S3 addon for a project", | ||
| "s3_node_deauthorized" : "A user deauthorized the Amazon S3 addon for a project", | ||
| "s3_node_deauthorized_no_user" : "Amazon S3 addon for a project deauthorized" | ||
| } | ||
| "s3_bucket_linked": "A user linked an Amazon S3 bucket to a project", | ||
| "s3_bucket_unlinked": "A user unselected an Amazon S3 bucket in a project", | ||
| "s3_file_added": "A user added a file to an Amazon S3 bucket in a project", | ||
| "s3_file_removed": "A user removed a file in an Amazon S3 bucket in a project", | ||
| "s3_file_updated": "A user updated a file in an Amazon S3 bucket in a project", | ||
| "s3_folder_created": "A user created a folder in an Amazon S3 in a project", | ||
| "s3_node_authorized": "A user authorized the Amazon S3 addon for a project", | ||
| "s3_node_deauthorized": "A user deauthorized the Amazon S3 addon for a project", | ||
| "s3_node_deauthorized_no_user": "Amazon S3 addon for a project deauthorized" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| { | ||
| "s3_bucket_linked" : "${user} linked the Amazon S3 bucket ${bucket} to ${node}", | ||
| "s3_bucket_unlinked" : "${user} unselected the Amazon S3 bucket ${bucket} in ${node}", | ||
| "s3_file_added" : "${user} added file ${path} to Amazon S3 bucket ${bucket} in ${node}", | ||
| "s3_file_removed" : "${user} removed ${path} in Amazon S3 bucket ${bucket} in ${node}", | ||
| "s3_file_updated" : "${user} updated file ${path} in Amazon S3 bucket ${bucket} in ${node}", | ||
| "s3_folder_created" : "${user} created folder ${path} in Amazon S3 bucket ${bucket} in ${node}", | ||
| "s3_node_authorized" : "${user} authorized the Amazon S3 addon for ${node}", | ||
| "s3_node_deauthorized" : "${user} deauthorized the Amazon S3 addon for ${node}", | ||
| "s3_node_deauthorized_no_user" : "Amazon S3 addon for ${node} deauthorized" | ||
| } | ||
| "s3_bucket_linked": "${user} linked the Amazon S3 bucket ${bucket} to ${node}", | ||
| "s3_bucket_unlinked": "${user} unselected the Amazon S3 bucket ${bucket} in ${node}", | ||
| "s3_file_added": "${user} added file ${path} to Amazon S3 bucket ${bucket} in ${node}", | ||
| "s3_file_removed": "${user} removed ${path} in Amazon S3 bucket ${bucket} in ${node}", | ||
| "s3_file_updated": "${user} updated file ${path} in Amazon S3 bucket ${bucket} in ${node}", | ||
| "s3_folder_created": "${user} created folder ${path} in Amazon S3 bucket ${bucket} in ${node}", | ||
| "s3_node_authorized": "${user} authorized the Amazon S3 addon for ${node}", | ||
| "s3_node_deauthorized": "${user} deauthorized the Amazon S3 addon for ${node}", | ||
| "s3_node_deauthorized_no_user": "Amazon S3 addon for ${node} deauthorized" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.