Allow entering a bucket name not returned by ListBuckets - #782
Open
kojiwell wants to merge 1 commit into
Open
Conversation
The bucket picker only offers buckets from ListBuckets, which returns only the buckets the credentials own. A bucket shared from another account is therefore unselectable even when it is fully accessible. The save endpoint does not cross-check that listing -- it validates with HeadBucket and GetBucketLocation -- so it already accepts such a bucket. Add a checkbox below the grid that reveals a text field and writes the typed name into the existing `selected` observable, reusing the current submission path. While the field is empty `selected` stays null, so the Save button remains hidden. Scope is limited to s3compatsigv4. s3, s3compat and s3compatb3 share the same picker structure and could take the same change.
hide24
approved these changes
Sep 9, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
The bucket picker in the S3 Compatible Storage (SigV4) add-on only offers buckets returned by
ListBuckets, andListBucketsreturns only the buckets that the configured credentials own. A bucket shared from another account is therefore impossible to select through the UI, even when the credentials have full access to it.The save endpoint, however, never cross-checks the submitted name against that listing.
set_configinaddons/base/generic_views.pypassesrequest.json['selected']straight toset_folder, and validation consists ofbucket_exists()(HeadBucket) andget_bucket_location_or_error()(GetBucketLocation);get_bucket_names()is reached only fromget_folders()and is not on the save path. We confirmed this by calling the endpoint directly:PUT /api/v1/project/<pid>/s3compatsigv4/settings/{"selected":{"id":"<bucket shared from another account>"}}200,folder.name = "<bucket> (us-east-1)"{"selected":{"id":"<bucket owned by the credentials>"}}(positive control)200{"selected":{"id":"<name that does not exist>"}}(negative control)500 InvalidFolderErrorThe negative control fails, so the success is not validation being bypassed — the bucket is genuinely found reachable. The server already accepts such a bucket; the UI simply has no way to send its name. This PR adds that input path, with no server-side change.
We hit this while testing GakuNin RDM. The test plan calls for a second authorizer accessing the same bucket. On AWS you would add a second IAM user or a second access key for the same identity, and the bucket owner would be unchanged, so the bucket would still be listed. Our S3-compatible storage enforces one key per identity, so the second authorizer had to be an account with a different owner. Cross-owner sharing itself works — a bucket policy grants reads, writes and deletes — and the only remaining obstacle was that the UI could not select the bucket.
Note that this is not specific to any storage vendor:
ListBucketsreturning owned buckets only is the same on AWS S3, so the identical configuration on AWS is equally unselectable today.Changes
Four files, +50 / −0 — purely additive. No server-side code, no model or API change, and the base ViewModel (
website/static/js/folderPickerNodeConfig.js) is untouched.addons/s3compatsigv4/static/s3compatsigv4NodeConfig.js— addsuseManualBucketNameandmanualBucketNameobservables, and wrapsonPickFolder.addons/s3compatsigv4/templates/s3compatsigv4_node_settings.mako— adds a checkbox below the bucket grid that reveals a text input.addons/translations/en/LC_MESSAGES/messages.po— new msgidEnter bucket name.addons/translations/ja/LC_MESSAGES/messages.po— Japanese translationバケット名を入力.Behaviour:
selectedobservable as{id, name, path}, so it reuses the current submission path unchanged —_serializeSettings()isko.toJS(this)and sends the whole ViewModel, exactly as a grid selection does.selectedis leftnull. The confirmation block and its Save button are already bound tovisible: currentDisplay() == PICKER && selected(), so the Save button simply does not render until a name is typed. No separate disable logic was needed.Screenshots
The grid lists only
rdm-exatest2, the bucket these credentials own. The bucket shared from the other account,rdm-test, is absent — this is the problem. The new checkbox is shown unticked, and with nothing selected there is no Save button:Ticked and filled in. The existing confirmation block and Save button appear, exactly as they would for a bucket picked from the grid:
Saved:
QA Notes
Does this change require a data migration? No. Nothing about the stored
NodeSettingschanges — a manually named bucket is persisted exactly the same way a picked one is.Level of risk: low. The diff is additive only (+50 / −0). No permissions code is touched, and no server-side, model, or API code is touched. The only change to the pre-existing path is that picking a bucket from the grid now additionally sets
useManualBucketName(false); with the checkbox left unticked, the pane behaves as it does today.How can QA verify? Through the UI: a project's Add-ons → S3 Compatible Storage (SigV4) → Change.
Quick check — needs only one ordinary S3 account:
Connect "<name>"?and the Save button appear; saving succeeds exactly as picking the row does.InvalidFolderError) and the existing setting is unchanged.Full scenario — needs two S3 accounts with different owners:
What features or workflows might this change impact? Only the bucket selection pane of this add-on. The Files tab, WaterButler, and the stored settings are unaffected.
How will this impact performance? Not at all. No new requests are issued; the
HeadBucket/GetBucketLocationvalidation already ran on save.Tests. No unit test is included. This repository has no per-provider ViewModel test suite —
website/static/js/tests/addons/covers the base classes (folderPickerNodeConfig,oauthAddonNodeConfig, …) but no provider-specific config — so there was no existing suite to extend. We are happy to add one if you would like, and glad to follow a pattern you prefer.Documentation
No API change and no API versioning, so no developer.osf.io changelog entry is needed.
The change introduces one new user-facing string, and the Japanese translation is included in this PR. If there is user-facing documentation describing the bucket selection pane, it may be worth a line about the new option — please point us at it and we will propose the wording.
Side Effects
None known.
The one behavioural change to the pre-existing path is that choosing a bucket from the grid now also clears the checkbox, which is required for the two inputs to be mutually exclusive.
Worth stating explicitly: this change makes a bucket selectable; it does not grant any permission. Using a bucket shared from another account still requires a grant on the storage side. The change cannot widen access — the same
HeadBucketandGetBucketLocationvalidation applies to a typed name as to a picked one, and both run with the credentials the user already supplied.Related providers (not included)
Three other providers use the same picker structure and would take the identical change:
addons/s3/static/s3NodeConfig.js,addons/s3/templates/s3_node_settings.makoaddons/s3compat/static/s3compatNodeConfig.js,addons/s3compat/templates/s3compat_node_settings.makoaddons/s3compatb3/static/s3compatb3NodeConfig.js,addons/s3compatb3/templates/s3compatb3_node_settings.mako(
s3compatinstitutionsis not applicable — it has no node-level picker and is configured from the admin console.)We limited this PR to
s3compatsigv4because the back ends for the others are not available in our test environment and we could not exercise the change against them. We would rather demonstrate it on one provider than ship edits we have not run. If you would like the other three included, please let us know and we will add them to this PR.Ticket
None. This is an external contribution, arising from GakuNin RDM interoperability testing rather than from a tracked ticket.