Skip to content

Commit

Permalink
Add support for Cloudflare R2 Buckets (#6701)
Browse files Browse the repository at this point in the history
It is currently not possible to add a Cloudflare R2 Bucket as a Cloud
Storage source, since the Secret access key of R2 has a length of 64 but
the ui/serializer restricts the length to 44.

[This issue](#5512) addresses the
same problem when using STORJ but with a max length of `128`.

For me it would make the most sense to completely remove the max length,
but this PR currently only fixes the R2 compatibility by increasing the
max length to `64`.
  • Loading branch information
JonasHiltl authored Oct 16, 2023
1 parent b7ea8d1 commit 021e58c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Changed

- Increased max length of secret access key to 64
(<https://github.com/opencv/cvat/pull/6701>)
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export default function CreateCloudStorageForm(props: Props): JSX.Element {
{...internalCommonProps}
>
<Input.Password
maxLength={44}
maxLength={64}
visibilityToggle={secretKeyVisibility}
onChange={() => setSecretKeyVisibility(true)}
onFocus={() => onFocusCredentialsItem('secretKey', 'secret_key')}
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/engine/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ class CloudStorage(models.Model):
# AWS bucket name, Azure container name - 63, Google bucket name - 63 without dots and 222 with dots
# https://cloud.google.com/storage/docs/naming-buckets#requirements
# AWS access key id - 20, Oracle OCI access key id - 40
# AWS secret access key - 40, Oracle OCI secret key id - 44
# AWS secret access key - 40, Oracle OCI secret access key - 44, Cloudflare R2 secret access key - 64
# AWS temporary session token - None
# The size of the security token that AWS STS API operations return is not fixed.
# We strongly recommend that you make no assumptions about the maximum size.
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/engine/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ class CloudStorageWriteSerializer(serializers.ModelSerializer):
owner = BasicUserSerializer(required=False)
session_token = serializers.CharField(max_length=440, allow_blank=True, required=False)
key = serializers.CharField(max_length=40, allow_blank=True, required=False)
secret_key = serializers.CharField(max_length=44, allow_blank=True, required=False)
secret_key = serializers.CharField(max_length=64, allow_blank=True, required=False)
key_file = serializers.FileField(required=False)
account_name = serializers.CharField(max_length=24, allow_blank=True, required=False)
manifests = ManifestSerializer(many=True, default=[])
Expand Down
4 changes: 2 additions & 2 deletions cvat/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6632,7 +6632,7 @@ components:
maxLength: 40
secret_key:
type: string
maxLength: 44
maxLength: 64
connection_string:
type: string
maxLength: 440
Expand Down Expand Up @@ -8586,7 +8586,7 @@ components:
maxLength: 40
secret_key:
type: string
maxLength: 44
maxLength: 64
connection_string:
type: string
maxLength: 440
Expand Down

0 comments on commit 021e58c

Please sign in to comment.