Skip to content

fix(admin): map IAM not found errors to 404#2685

Merged
overtrue merged 2 commits intorustfs:mainfrom
GatewayJ:fix/admin-iam-not-found-errors
Apr 26, 2026
Merged

fix(admin): map IAM not found errors to 404#2685
overtrue merged 2 commits intorustfs:mainfrom
GatewayJ:fix/admin-iam-not-found-errors

Conversation

@GatewayJ
Copy link
Copy Markdown
Member

Type of Change

  • New Feature
  • Bug Fix
  • Documentation
  • Performance Improvement
  • Test/CI
  • Refactor
  • Other:

Related Issues

Fixes #2681

Summary of Changes

Admin handlers previously wrapped IAM not-found errors as InternalError, which made s3s serialize missing users, groups, policies, and service accounts as HTTP 500 responses.

This change adds a shared IAM-to-S3 error mapper for admin handlers and maps IAM not-found variants to NoSuchKey, which s3s serializes as HTTP 404. Existing non-not-found IAM failures remain InternalError.

The affected group, user, policy, and service account admin paths now return a 404-class response for missing IAM resources so clients can avoid retrying user input errors as server failures.

Checklist

  • I have read and followed the CONTRIBUTING.md guidelines
  • Passed make pre-commit
  • Added/updated necessary tests
  • Documentation updated (if needed)
  • CI/CD passed (if applicable)

Verification:

  • git diff --check passed.
  • cargo fmt --all --check passed.
  • cargo test -p rustfs --lib admin::handlers passed: 221 passed, 0 failed, 1 ignored.
  • make pre-commit was not run per requester instruction.

Impact

  • Breaking change (compatibility)
  • Requires doc/config/deployment update
  • Other impact:

Missing IAM resources on affected admin endpoints now return HTTP 404 instead of HTTP 500.

Additional Notes

Non-not-found IAM errors are still treated as internal server errors.


Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md). If this is your first contribution, review the CLA document and sign it by commenting I have read and agree to the CLA. on the PR.

@github-actions
Copy link
Copy Markdown
Contributor

CLA requirements are satisfied for this pull request.

@GatewayJ GatewayJ marked this pull request as ready for review April 26, 2026 13:53
@GatewayJ GatewayJ requested review from loverustfs and overtrue April 26, 2026 13:53
@overtrue overtrue added this pull request to the merge queue Apr 26, 2026
Merged via the queue into rustfs:main with commit 37a3cbc Apr 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API returns status 500 instead of 404 when group is not found

2 participants