Skip to content

Conversation

@BlaineEXE
Copy link
Contributor

@BlaineEXE BlaineEXE commented Dec 15, 2025

From API review, make sure all APIs have documentation that allows users
to better interact with the API using kubectl explain. Ensure all
possible input and output values are noted with text explaining what
values mean.

Also ensure all API fields have validation that prevents abuse.

Relates to #199

Resolves #168

If merged, we should follow up to ensure returned bucket_id and account_id from RPC calls are validated to match the regex decided upon here.

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 15, 2025
@netlify
Copy link

netlify bot commented Dec 15, 2025

Deploy Preview for container-object-storage-interface ready!

Name Link
🔨 Latest commit 34aab12
🔍 Latest deploy log https://app.netlify.com/projects/container-object-storage-interface/deploys/6941d42907d6680009d85761
😎 Deploy Preview https://deploy-preview-208--container-object-storage-interface.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BlaineEXE

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

The pull request process is described here

Details 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 15, 2025
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 15, 2025
Comment on lines 30 to 44
// DriverName represents the name of a driver.
// Must be 63 characters or less, beginning and ending with an alphanumeric character
// ([a-z0-9A-Z]) with dashes (-), dots (.), and alphanumerics between.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([a-zA-Z0-9\-\.]{0,61}[a-zA-Z0-9])?$`
type DriverName string

// DriverResourceID represents a unique identifier for a driver bucket or access resource.
// To prevent misuse, a driver resource ID must be at most 2048 characters and consist only of
// alphanumeric characters ([a-z0-9A-Z]), dashes (-), dots (.), and underscores (_).
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=2048
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9._-]+$`
type DriverResourceID string
Copy link
Contributor Author

@BlaineEXE BlaineEXE Dec 15, 2025

Choose a reason for hiding this comment

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

driverName appears ~4 times, and bucketID/accountID ~4 times.

Initially, I extracted them to their own types for reuse, but I didn't want to have to update all code and tests to use cast to types (e.g., string(bucketID)).

We could always do this, but it seemed somewhat more straightforward to copy-paste the validation and stuff 4 times (not that many) rather than define a separate type.

@BlaineEXE BlaineEXE force-pushed the improve-api-docs branch 2 times, most recently from 434d010 to 6ad6c9a Compare December 15, 2025 22:05
Comment on lines 69 to 82
// +optional
// +listType=set
// +kubebuilder:validation:XValidation:message="protocols list is immutable",rule="self == oldSelf"
Protocols []ObjectProtocol `json:"protocols,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JoelSpeed you recommended MinProperties for maps. Is there an equivalent recommendation for MinItems for lists, or are maps more susceptible to concerns?

Copy link

@JoelSpeed JoelSpeed Dec 16, 2025

Choose a reason for hiding this comment

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

I'd recommend a minimum on both maps and lists yes, in fact, any type

What you want to avoid is someone persisting the empty object when semantically there is no difference between unset and empty, so in this case, adding a MinItems=1 would be advised

KAL has minlength which should point out where these are missing for you

Comment on lines 142 to 157
// bucketID is the unique identifier for the backend bucket known to the driver.
// Must be at most 2048 characters and consist only of alphanumeric characters ([a-z0-9A-Z]),
// dashes (-), dots (.), and underscores (_).
// +optional
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=2048
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9._-]+$`
// +kubebuilder:validation:XValidation:message="boundBucketName is immutable once set",rule="self == oldSelf"
BucketID string `json:"bucketID,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For bucket ID's, I'm trying to find the middle groud between a strong formal definition that might conflict with some edge cases between S3/Azure/GCS bucket naming -- versus totally unvalidated input.

Azure has the longest bucket ID limit at 1024 chars, and doubling that to 2048 seemed somewhat reasonable in case drivers want to add extra text based on other things.

Among the 3, the common character set is alphanums, dot, dash, and underscore. I opted to not get too complex here. Limiting chars to these should hinder any code injection type attacks a lot without risking unexpected compatibility in corner cases.

WDYT @JoelSpeed ? @shanduur ?

Choose a reason for hiding this comment

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

Are any of these case sensitive? Should we limit to lowercase alphanums? Otherwise that seems reasonable. Have you looked beyond the existing platforms to other future platforms at all?

Copy link
Contributor Author

@BlaineEXE BlaineEXE Dec 16, 2025

Choose a reason for hiding this comment

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

From what I can tell, most backends only want lower case chars for what directly correlates to Bucket/BucketAccess identifiers. However, I could easily foresee a driver wanting to do use compound identifiers for COSI that include a case-sensitive component.

My guess about case-sensitivity comes from the Azure spec which says paths are case sensitive. Being paths, they would also include the / character. I will add a / char to the allowed set, but please let me know if you foresee any issues allowing that char. I am aware that we should likely avoid & and ; to prevent implicit embedding of arbitrary chars like  . Backslash \ (e.g., \n) for a similar purpose. I don't know of any concern forward slash / would bring.

We don't have any future platforms in our mind at the moment beyond the Swift object store standard which we have had (and expect) near-zero interest in. A quick search suggests that Swift's rules are comparable to S3, so if we were to add Swift in the future, I don't anticipate needing a change to support it.

@BlaineEXE BlaineEXE marked this pull request as ready for review December 15, 2025 22:12
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 15, 2025
@BlaineEXE
Copy link
Contributor Author

/retest required

@k8s-ci-robot
Copy link
Contributor

@BlaineEXE: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

/test pull-container-object-storage-interface-build
/test pull-container-object-storage-interface-check-generated-files
/test pull-container-object-storage-interface-e2e
/test pull-container-object-storage-interface-lint
/test pull-container-object-storage-interface-unit

Use /test all to run all jobs.

Details

In response to this:

/retest required

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 16, 2025
@BlaineEXE BlaineEXE changed the title address Bucket API review changes Improve API docs and validation based on API review Dec 16, 2025
From API review, make sure all APIs have documentation that allows users
to better interact with the API using `kubectl explain`. Ensure all
possible input and output values are noted with text explaining what
values mean.

Also ensure all API fields have validation that prevents abuse.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Establish and validate driver name limitations

3 participants