Skip to content

fix(openfga): return 403 for denied permission-API actions - #2087

Merged
c-thiel merged 1 commit into
mainfrom
christian/openfga-denial-403
Oct 6, 2026
Merged

c-thiel merged 1 commit into
mainfrom
christian/openfga-denial-403

Conversation

@c-thiel

@c-thiel c-thiel commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

A denied OpenFGA check in the /management/v1/permissions API (assignments, authorizer-actions, access, managed-access) now returns 403 Forbidden instead of 401 Unauthorized. Requests without authentication still return 401. The audit log already recorded these denials as ActionForbidden.

Summary by CodeRabbit

  • Bug Fixes
    • Authorization denials now return Forbidden, while missing authentication continues to return Unauthorized.

A denied OpenFGA check in the /management/v1/permissions API (assignments, authorizer-actions, access, managed-access) now returns 403 Forbidden instead of 401 Unauthorized. Requests without authentication still return 401. The audit log already recorded these denials as ActionForbidden.
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e5662ab0-3f76-47e7-ae70-d5c5ca95b412
📥 Commits

Reviewing files that changed from the base of the PR and between d04d1f6 and c84c338.

📒 Files selected for processing (1)
  • crates/authz-openfga/src/error.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.


Walkthrough

The OpenFGAError::Unauthorized response now uses HTTP Forbidden. A unit test checks this mapping and confirms that AuthenticationRequired still uses HTTP Unauthorized.

Changes

OpenFGA error status mapping

Layer / File(s) Summary
Error mapping and test
crates/authz-openfga/src/error.rs
OpenFGAError::Unauthorized maps to HTTP Forbidden. A unit test checks this mapping and confirms that AuthenticationRequired maps to HTTP Unauthorized.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to c84c3

Denied permission checks return Forbidden, while paths that explicitly require authentication remain Unauthorized. No actionable merge-blocking risk was established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: denied OpenFGA permission-API actions now return 403 Forbidden.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the status sign,
“Denied” now reads Forbidden, fine.
For missing auth, Unauthorized stays,
The test confirms both paths and ways.
Then hops away beneath the pines.

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

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

The title of this PR match the correct format. Thank you!

@c-thiel
c-thiel merged commit 6a0edd4 into main Oct 6, 2026
74 checks passed
@c-thiel
c-thiel deleted the christian/openfga-denial-403 branch October 6, 2026 10:11
brgr-s pushed a commit that referenced this pull request Oct 15, 2026
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.

1 participant