Repository navigation
fix: enforce effective permissions across console actions - #305
Merged
Merged
Conversation
Resolve bucket-policy grants through a caller-bound server query and match each control to the action, resource, version, and request facts used by its API operation. Refresh permission decisions before writes and background task execution while isolating cached grants by authenticated identity.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical issues can stall permission checks indefinitely, permit duplicate IAM imports, and leave multipart upload stages without refreshed authorization.
6 open issues
Lock IAM import submission before awaiting permissions · New Include the JSON envelope in the batch size guard · New Authorize upload headers and each multipart stage · New Preserve page state while revalidating the same route · New Trim namespace segments before building permission context · New Set operation and absent header facts for rename and restore · New
What changed in this PR
This PR addresses #298 by using server-provided effective permissions so bucket-policy grants can enable Console actions. It also aligns management controls with their actual write permissions while retaining a limited fallback for older servers.
Changes:
- Adds identity-scoped permission caching, batching, retries, and request-body log redaction.
- Checks actions against concrete resources, versions, and request facts, including fresh checks before submissions and background work.
- Expands permission regression tests and adds translated recovery messages.
| File | Description |
|---|---|
tests/lib/user-management-safety.test.js |
Updates group status permission assertions. |
tests/lib/upload-task.test.ts |
Covers upload authorization and cancellation. |
tests/lib/tier-deletion-components.test.ts |
Tests read-only controls and fresh denials. |
tests/lib/table-catalog-permission-context.test.ts |
Tests catalog resource mapping. |
tests/lib/sse-safety.test.js |
Updates KMS permission assertions. |
tests/lib/settings-layout-source.test.js |
Updates permission-aware submit assertions. |
tests/lib/object-versions-source.test.js |
Verifies version-specific restore checks. |
tests/lib/object-transfer.test.ts |
Covers transfer stages and permission revocation. |
tests/lib/object-lock.test.js |
Separates retention access from legal hold. |
tests/lib/object-info-source.test.js |
Updates retention visibility assertions. |
tests/lib/login-performance-source.test.js |
Verifies revised provider ordering. |
tests/lib/iam-remaining-safety.test.js |
Updates policy submission assertions. |
tests/lib/form-interaction.test.ts |
Verifies bucket setup authorization. |
tests/lib/force-cleanup-components.test.ts |
Covers object action checks and changed targets. |
tests/lib/delete-task.test.ts |
Tests exact-key, version, and cancellation checks. |
tests/lib/bucket-versioning-confirmation.test.ts |
Adds fresh permission checking to fixtures. |
tests/lib/bucket-navigation.test.ts |
Tests bucket-scoped navigation. |
tests/lib/api-client.test.ts |
Tests permission-body log redaction. |
tests/lib/api-client-source.test.js |
Updates redaction call assertions. |
tests/hooks/use-permissions-refresh.test.ts |
Tests bucket-policy route access. |
tests/hooks/use-oidc-logout.test.ts |
Updates route guard fixtures. |
tests/hooks/effective-permissions.test.ts |
Tests effective decisions and identity isolation. |
lib/upload-task.ts |
Checks upload permission before execution. |
lib/permission-resources.ts |
Adds request facts and preserves exact keys. |
lib/permission-endpoint.ts |
Resolves the v4 permission endpoint. |
lib/permission-capabilities.ts |
Maps capabilities to action-specific checks. |
lib/object-transfer.ts |
Authorizes copy and move stages. |
lib/object-lock.js |
Makes retention visibility independent of legal hold. |
lib/effective-permissions.ts |
Adds permission transport, caching, and retries. |
lib/delete-task.ts |
Authorizes deletion targets and versions. |
lib/console-policy-parser.ts |
Refines legacy permission evaluation. |
lib/bucket-navigation.ts |
Includes bucket identity in route checks. |
lib/api-request-log.ts |
Supports complete body redaction. |
lib/api-client.ts |
Applies optional body-log suppression. |
i18n/locales/zh-TW.json |
Adds permission recovery translation. |
i18n/locales/zh-CN.json |
Adds permission recovery translation. |
i18n/locales/vi-VN.json |
Adds permission recovery translation. |
i18n/locales/tr-TR.json |
Adds permission recovery translation. |
i18n/locales/ru-RU.json |
Adds permission recovery translation. |
i18n/locales/pt-BR.json |
Adds permission recovery translation. |
i18n/locales/ko-KR.json |
Adds permission recovery translation. |
i18n/locales/ja-JP.json |
Adds permission recovery translation. |
i18n/locales/it-IT.json |
Adds permission recovery translation. |
i18n/locales/id-ID.json |
Adds permission recovery translation. |
i18n/locales/fr-FR.json |
Adds permission recovery translation. |
i18n/locales/es-ES.json |
Adds permission recovery translation. |
i18n/locales/en-US.json |
Adds permission recovery text. |
i18n/locales/de-DE.json |
Adds permission recovery translation. |
i18n/locales/ar-MA.json |
Adds permission recovery translation. |
docs/ui-review/register.md |
Records the policy-control UI review. |
contexts/task-context.tsx |
Supplies permission checks to task handlers. |
components/user/edit-form.tsx |
Separates account mutation permissions. |
components/user-group/set-policies-multiple.tsx |
Authorizes bulk policy assignment. |
components/user-group/policies.tsx |
Gates and rechecks policy updates. |
components/user-group/new-form.tsx |
Authorizes group creation. |
components/user-group/members.tsx |
Authorizes membership updates. |
components/user-group/edit-form.tsx |
Authorizes group status changes. |
components/tiers/transition-job.tsx |
Gates transition job operations. |
components/tiers/new-form.tsx |
Authorizes tier creation. |
components/tiers/deletion-dialog.tsx |
Separates tier read and mutation checks. |
components/tiers/change-key.tsx |
Authorizes tier credential updates. |
components/table-catalog/view-dialog.tsx |
Checks exact view creation and edit targets. |
components/table-catalog/table-dialog.tsx |
Checks exact table creation targets. |
components/table-catalog/table-commit-dialog.tsx |
Authorizes commits for the selected table. |
components/table-catalog/permission-context.ts |
Builds catalog permission resource contexts. |
components/table-catalog/namespace-dialog.tsx |
Checks namespace mutation targets. |
components/sse/rekey-card.tsx |
Gates and rechecks rekey operations. |
components/replication/new-form.tsx |
Checks replication and target permissions. |
components/replication/edit-form.tsx |
Separates rule and target mutation permissions. |
components/object/view.tsx |
Authorizes object downloads. |
components/object/versions.tsx |
Uses version-specific action permissions. |
components/object/transfer-dialog.tsx |
Connects transfers to fresh action checks. |
components/object/info.tsx |
Checks object actions and submitted request facts. |
components/lifecycle/new-form.tsx |
Rechecks lifecycle write permission. |
components/events/new-form.tsx |
Rechecks notification creation permission. |
components/events/edit-form.tsx |
Rechecks notification update permission. |
components/events-target/new-form.tsx |
Authorizes event target creation. |
components/dashboard-auth-guard.tsx |
Handles scoped, pending, and unavailable decisions. |
components/buckets/replication-tab.tsx |
Checks rule deletion and target cleanup. |
components/buckets/new-form.tsx |
Checks named bucket creation and setup. |
components/buckets/lifecycle-tab.tsx |
Rechecks lifecycle mutation permission. |
components/buckets/info.tsx |
Rechecks bucket configuration writes. |
components/buckets/events-tab.tsx |
Rechecks notification deletion permission. |
components/audit-target/new-form.tsx |
Authorizes audit target creation. |
app/(dashboard)/user-groups/page.tsx |
Gates group management actions. |
app/(dashboard)/tiers/page.tsx |
Gates tier mutations. |
app/(dashboard)/table-catalog/page.tsx |
Applies resource-scoped catalog permissions. |
app/(dashboard)/sse/page.tsx |
Gates KMS configuration and key actions. |
app/(dashboard)/layout.tsx |
Places permissions above task providers. |
app/(dashboard)/import-export/page.tsx |
Separates IAM import and export permissions. |
app/(dashboard)/events-target/page.tsx |
Gates event destination mutations. |
app/(dashboard)/browser/page.tsx |
Uses discoverability hints for bucket creation. |
app/(dashboard)/browser/content.tsx |
Refreshes permissions and checks preview/download actions. |
app/(dashboard)/audit-target/page.tsx |
Gates audit target mutations. |
Review effort: Balanced
Lock IAM operations before authorization, reject checks that cannot fit their JSON envelope, preserve the current page during permission revalidation, and align namespace and copy/upload facts with actual SDK requests. Refresh authorization before every multipart upload stage.
Check warehouse-root and parent-namespace grants for creation, keep update targets exact, and authorize custom table locations independently. Preserve explicit empty-root facts while retaining legacy bucket ARN compatibility.
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.


Pull Request
Description
Bucket-policy grants were invisible to Console action controls because they evaluated only the identity policy from
/accountinfo. Several management controls also treated read access as permission to mutate. This change consumes caller-bound effective permission decisions fromPOST /rustfs/admin/v4/account/permissionsand maps each control to the actions, resources, selected versions, and request facts used by its API operation.Uploads, deletes, rename/copy/move, version operations, tags, retention, legal hold, bucket configuration/rules, IAM groups/users, tiers, target configuration, IAM import/export, KMS, and S3 Tables now check their actual contracts. Submission and background task execution refresh decisions; multipart copies check their real stages and preserve pinned source versions and conditional writes. Unknown-target hints only make an entry discoverable. Concrete unknown or denied decisions never authorize a write.
The shared client isolates grants by authenticated identity, rejects stale results after refresh/logout, batches within server limits, retains active checks while bounding idle cache entries, and retries transient failures without redirecting a pending or unavailable route to 403. Known buckets remain reachable through bucket policy; bucket discovery keeps the server's IAM behavior.
Type of Change
Testing
Verified
ff3b4c34754bf5217eef54f8114abfd640054376, based onf1efd4a40dce66776a79737e17a40fcec39ed2db:All required gates passed. The final suite executed 1,202 tests: 1,202 passed, zero failed or skipped. Regressions cover bucket-policy allowances, session/condition denials, exact keys/versions, staged-copy facts, permission revocation, identity isolation, refresh races, retries, cache pressure, payload limits, and complete permission-body log redaction.
The running Next.js application was exercised with controlled S3/admin responses across 15 before/after scenarios at 1280x720 and 390x844. This verifies Console rendering and controls; it does not establish a live RustFS/OIDC integration. Bucket CORS/encryption fixture reads expose their unavailable state, and KMS fixture health is unknown. The initial screenshot set captures the original policy-control patch before its rebase onto the upstream session fix. The supplemental refresh comparison below captures the final review fix. All gates passed again on the current head.
Checklist
Related Issues
Closes #298.
The accurate decisions require the companion RustFS effective-permission endpoint: rustfs/rustfs#9414.
Screenshots (if applicable)
All affected pages and mobile comparison
Evidence manifest records source revisions, dimensions, fixture limits, and image checksums. Images are hosted on a separate review-evidence branch and do not enter the application build. UI review entry:
UI-057, evidence keyeffective-permissions-298.Permission revalidation review fix
The same bucket-policy-only user selects
report.txtand refreshes with permission responses delayed by 15 seconds. The prior head unmounts the page into a spinner; the current head retains the selection while mutation controls fail closed.Supplemental manifest records both tested sources and the controlled scenario.
Catalog location validation
The updated creation dialog checks the parent namespace and rejects an invalid custom location before submission. The error state below was exercised on the current head with controlled responses; no table was created.
Catalog validation manifest records the source and fixture limits.
Additional Notes
The backend review also identified catalog scope mismatches, now corrected here: namespace creation uses an explicitly known warehouse root; table/view creation checks the parent namespace; updates/deletes keep exact targets; custom table locations require a separate ClaimTableLocation check against the raw S3 prefix. Empty-root legacy ARN compatibility and namespace segments containing tables/views have regressions.
The six review findings are fixed in the current head: synchronous IAM import/export locking, framed payload limits, stage-specific upload authorization, same-route state preservation, normalized namespace targets, and exact CopyObject/absent-header facts. Added component/SDK regressions cover duplicate clicks, revocation/cancellation, partial-upload resume, and denial or identity changes during revalidation.
Deploy the companion RustFS endpoint before upgrading Console for accurate bucket-policy, session, and condition decisions. Servers returning 404/405/501 on the initial endpoint lookup retain the explicitly limited legacy identity-policy fallback. A server that already supported the endpoint never silently falls back after a later error. Real S3/admin operations continue to enforce authorization independently. Rollback requires reverting Console; there is no data migration.
Three independent reviewers covered backend authorization, UI/API action contracts, and MinIO/reference behavior, with correctness, negative tests, UX, and simplification passes. The architecture follows MinIO's server-provided permission pattern (session implementation); the actual decisions use RustFS's authorization semantics rather than projecting raw policies in the browser. MinIO's session authorization also informed the review of inherited and session policy boundaries.