Skip to content

fix(seaweedfs): enforce read-only bucket access by bumping cosi-driver to v0.3.1 - #3136

Merged
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/seaweedfs-cosi-readonly
Jun 30, 2026
Merged

fix(seaweedfs): enforce read-only bucket access by bumping cosi-driver to v0.3.1#3136
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/seaweedfs-cosi-readonly

Conversation

@lexfrei

@lexfrei Aleksei Sviridkin (lexfrei) commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What this PR does

The SeaweedFS COSI driver shipped at v0.1.2 hardcodes read-write S3 actions (Read,Write,List,Tagging) for every BucketAccess and never reads the accessPolicy BucketAccessClass parameter. The chart already defines a -readonly BucketAccessClass carrying parameters.accessPolicy: readonly, and the bucket app routes readonly: true users to it — but v0.1.2 ignores the parameter, so a credential meant to be read-only is silently issued with full read-write access and can upload and delete objects. This is an access-control bug.

Upstream seaweedfs/seaweedfs-cosi-driver added accessPolicy handling in v0.3.0: readonly maps to Read,List, while readwrite and the empty default stay Read,Write,List,Tagging. This bumps the driver to v0.3.1 via a seaweedfs.cosi.image override in the package values.yaml, so the override survives make update and the vendored chart is left untouched. The default read-write action set is unchanged, so existing read-write credentials are unaffected; only read-only grants are tightened to actually be read-only.

The extra/seaweedfs chart already runs v0.3.1 with the same objectstorage-sidecar, so the driver/sidecar combination is already proven in this repo. A chart unit test pins the rendered driver image so this fix cannot silently regress on a future re-vendor.

This does not close #1921. That issue bundles two features — read-only bucket access (fixed here) and Object Lock / WORM (the -lock BucketClass), which is independent and out of scope here. Relates to #1921.

Release note

Fix SeaweedFS read-only bucket credentials being issued with read-write access; the COSI driver now honours the read-only access policy.

Summary by CodeRabbit

  • Bug Fixes
    • Pin the SeaweedFS COSI driver image to ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.3.1 to keep access behavior consistent and avoid relying on a vendored default.
    • Ensure the rendered SeaweedFS COSI deployment uses the expected container name and the pinned driver image.
  • Tests
    • Add a YAML test suite to validate the generated COSI deployment template matches the expected container name and pinned image.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a security issue in the SeaweedFS COSI driver where the accessPolicy parameter was being ignored, resulting in read-only buckets being granted full read-write access. By upgrading the driver to v0.3.1 and enforcing this version via a configuration override, the system now correctly restricts permissions for read-only bucket access. A new unit test has been introduced to verify this configuration and ensure the fix persists through future dependency updates.

Highlights

  • Security Fix: Resolved an access-control vulnerability where read-only bucket credentials were incorrectly granted read-write permissions.
  • Driver Upgrade: Updated the SeaweedFS COSI driver to v0.3.1 to correctly support the accessPolicy parameter.
  • Regression Testing: Added a new unit test to ensure the COSI driver image remains pinned to v0.3.1, preventing accidental regressions during future chart updates.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added area/storage Issues or PRs related to storage (linstor, seaweedfs, bucket, velero, harbor) kind/bug Categorizes issue or PR as related to a bug size/M This PR changes 30-99 lines, ignoring generated files labels Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6ef22962-f8b2-42eb-ae90-bec4fe52404e

📥 Commits

Reviewing files that changed from the base of the PR and between 0d2389e and 0c6426f.

📒 Files selected for processing (2)
  • packages/system/seaweedfs/tests/cosi_image_test.yaml
  • packages/system/seaweedfs/values.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/system/seaweedfs/tests/cosi_image_test.yaml
  • packages/system/seaweedfs/values.yaml

📝 Walkthrough

Walkthrough

Pins the SeaweedFS COSI driver image to ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.3.1 in values.yaml and adds a Helm test that verifies the rendered COSI deployment uses that image.

Changes

SeaweedFS COSI driver image pin

Layer / File(s) Summary
Image pin in values and regression test
packages/system/seaweedfs/values.yaml, packages/system/seaweedfs/tests/cosi_image_test.yaml
Sets cosi.image to ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.3.1 with explanatory comments, and adds a test suite that asserts the rendered cosi-deployment.yaml uses container name seaweedfs-cosi-driver with that exact image.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • androndo
  • sircthulhu
  • kvaps
  • lllamnyp
  • IvanHunters
  • myasnikovdaniil

Poem

🐇 I pinned the driver, snug and neat,
No drifting tags can snag the seat.
A test now peeks at what gets spun,
And checks the image, one by one.
Hop hop, the COSI path stays true!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: enforcing read-only SeaweedFS bucket access by upgrading the COSI driver to v0.3.1.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/seaweedfs-cosi-readonly

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dosubot dosubot Bot added the security/fixed Fix released label Jun 29, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request overrides the vendored seaweedfs COSI driver image to version v0.3.1 in packages/system/seaweedfs/values.yaml to enforce read-only bucket access, which was ignored in the default v0.1.2 version. It also introduces a new Helm test suite cosi_image_test.yaml to ensure this image pin is preserved across future chart updates. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/system/seaweedfs/values.yaml (1)

207-211: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin the COSI driver image by digest. ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.3.1 is still mutable; use ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.3.1@sha256:eff99808360fae4f90d477fee80209905aeeb0ab6b39d96a5fd21c30124248cb so the deployed bits stay reproducible, matching the adjacent sidecar.image pin.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/system/seaweedfs/values.yaml` around lines 207 - 211, The seaweedfs
COSI driver image is still pinned by tag only, so update the image reference in
the values configuration to use the immutable digest form instead of the mutable
v0.3.1 tag. Keep the existing `image` setting for the SeaweedFS COSI driver and
change it to the digest-pinned
`ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.3.1@sha256:eff99808360fae4f90d477fee80209905aeeb0ab6b39d96a5fd21c30124248cb`,
matching the nearby `sidecar.image` pin.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/system/seaweedfs/values.yaml`:
- Around line 207-211: The seaweedfs COSI driver image is still pinned by tag
only, so update the image reference in the values configuration to use the
immutable digest form instead of the mutable v0.3.1 tag. Keep the existing
`image` setting for the SeaweedFS COSI driver and change it to the digest-pinned
`ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.3.1@sha256:eff99808360fae4f90d477fee80209905aeeb0ab6b39d96a5fd21c30124248cb`,
matching the nearby `sidecar.image` pin.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2492a085-03b5-429d-a0b0-39ddd6602266

📥 Commits

Reviewing files that changed from the base of the PR and between 4404c5c and 0d2389e.

📒 Files selected for processing (2)
  • packages/system/seaweedfs/tests/cosi_image_test.yaml
  • packages/system/seaweedfs/values.yaml

…r to v0.3.1

The seaweedfs COSI driver shipped at v0.1.2 hardcodes read-write S3
actions (Read, Write, List, Tagging) for every BucketAccess and never
reads the accessPolicy parameter. The chart already defines a -readonly
BucketAccessClass carrying parameters.accessPolicy: readonly, but v0.1.2
ignores it, so a credential meant to be read-only can still write
(upload and delete) objects.

Bump the driver to v0.3.1, which honours accessPolicy: readonly by
issuing Read,List-only credentials (read-write and the empty default
stay Read,Write,List,Tagging). The override lives in the package
values.yaml rather than the vendored chart so it survives make update;
the sister extra/seaweedfs chart already runs v0.3.1.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
@lexfrei
Aleksei Sviridkin (lexfrei) merged commit eab9b03 into main Jun 30, 2026
20 of 22 checks passed
@lexfrei
Aleksei Sviridkin (lexfrei) deleted the fix/seaweedfs-cosi-readonly branch June 30, 2026 13:04
@github-actions

Copy link
Copy Markdown

myasnikovdaniil added a commit that referenced this pull request Jul 3, 2026
…s by bumping cosi-driver to v0.3.1 (#3153)

# Description
Backport of #3136 to `release-1.5`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/storage Issues or PRs related to storage (linstor, seaweedfs, bucket, velero, harbor) backport Should change be backported on previous release kind/bug Categorizes issue or PR as related to a bug security/fixed Fix released size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(seaweedfs-cosi-driver): support Object Lock and read-only bucket access

2 participants